diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c148d7d5d..75bfd604f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,12 +2,16 @@ name: CI on: push: - branches: [main] + branches: [develop] pull_request: types: [opened, synchronize, reopened, ready_for_review] workflow_dispatch: schedule: [cron: "40 1 * * *"] +concurrency: + group: ci-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/develop' }} + permissions: contents: read diff --git a/.gitignore b/.gitignore index 408b8a57d..15b81efb4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ /target Cargo.lock -.idea \ No newline at end of file +.idea +*.dylib +__pycache__ diff --git a/bindings/README.md b/bindings/README.md deleted file mode 100644 index b899f3b30..000000000 --- a/bindings/README.md +++ /dev/null @@ -1,21 +0,0 @@ -This folder contains bindings generated with [UniFFI](https://github.com/mozilla/uniffi-rs). - -In order to generate bindings for a specific language, start by building the library. - -```sh -cargo build --lib --release -F uniffi -``` - -And then generate the bindings via the binary. - -```sh -cargo run -F uniffi --bin iota_graphql_client_bindings -- generate --library "target/release/libiota_graphql_client.dylib" --language python --out-dir bindings/python/lib --no-format - -cp target/release/libiota_graphql_client.* bindings/python/lib/ - -python bindings/python/test.py -``` - -## License - -This project is available under the terms of the [Apache 2.0 license](LICENSE). diff --git a/bindings/python/lib/iota_graphql_client.py b/bindings/python/lib/iota_graphql_client.py deleted file mode 100644 index b92709147..000000000 --- a/bindings/python/lib/iota_graphql_client.py +++ /dev/null @@ -1,8128 +0,0 @@ - - -# 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. - -from __future__ import annotations -import os -import sys -import ctypes -import enum -import struct -import contextlib -import datetime -import threading -import itertools -import traceback -import typing -import asyncio -import platform -from .iota_sdk_types import Address -from .iota_sdk_types import CheckpointDigest -from .iota_sdk_types import CheckpointSummary -from .iota_sdk_types import Coin -from .iota_sdk_types import Digest -from .iota_sdk_types import Event -from .iota_sdk_types import MovePackage -from .iota_sdk_types import Object -from .iota_sdk_types import SignedTransaction -from .iota_sdk_types import Transaction -from .iota_sdk_types import TransactionDigest -from .iota_sdk_types import TransactionEffects -from .iota_sdk_types import UniffiMovePackage -from .iota_sdk_types import UserSignature -from .iota_sdk_types import _UniffiConverterTypeAddress -from .iota_sdk_types import _UniffiConverterTypeCheckpointDigest -from .iota_sdk_types import _UniffiConverterTypeCheckpointSummary -from .iota_sdk_types import _UniffiConverterTypeCoin -from .iota_sdk_types import _UniffiConverterTypeDigest -from .iota_sdk_types import _UniffiConverterTypeEvent -from .iota_sdk_types import _UniffiConverterTypeMovePackage -from .iota_sdk_types import _UniffiConverterTypeObject -from .iota_sdk_types import _UniffiConverterTypeSignedTransaction -from .iota_sdk_types import _UniffiConverterTypeTransaction -from .iota_sdk_types import _UniffiConverterTypeTransactionDigest -from .iota_sdk_types import _UniffiConverterTypeTransactionEffects -from .iota_sdk_types import _UniffiConverterTypeUniffiMovePackage -from .iota_sdk_types import _UniffiConverterTypeUserSignature -from .iota_sdk_types import _UniffiRustBuffer as _UniffiRustBufferAddress -from .iota_sdk_types import _UniffiRustBuffer as _UniffiRustBufferCheckpointDigest -from .iota_sdk_types import _UniffiRustBuffer as _UniffiRustBufferCheckpointSummary -from .iota_sdk_types import _UniffiRustBuffer as _UniffiRustBufferCoin -from .iota_sdk_types import _UniffiRustBuffer as _UniffiRustBufferDigest -from .iota_sdk_types import _UniffiRustBuffer as _UniffiRustBufferEvent -from .iota_sdk_types import _UniffiRustBuffer as _UniffiRustBufferMovePackage -from .iota_sdk_types import _UniffiRustBuffer as _UniffiRustBufferObject -from .iota_sdk_types import _UniffiRustBuffer as _UniffiRustBufferSignedTransaction -from .iota_sdk_types import _UniffiRustBuffer as _UniffiRustBufferTransaction -from .iota_sdk_types import _UniffiRustBuffer as _UniffiRustBufferTransactionDigest -from .iota_sdk_types import _UniffiRustBuffer as _UniffiRustBufferTransactionEffects -from .iota_sdk_types import _UniffiRustBuffer as _UniffiRustBufferUniffiMovePackage -from .iota_sdk_types import _UniffiRustBuffer as _UniffiRustBufferUserSignature - -# Used for default argument values -_DEFAULT = object() # type: typing.Any - - -class _UniffiRustBuffer(ctypes.Structure): - _fields_ = [ - ("capacity", ctypes.c_uint64), - ("len", ctypes.c_uint64), - ("data", ctypes.POINTER(ctypes.c_char)), - ] - - @staticmethod - def default(): - return _UniffiRustBuffer(0, 0, None) - - @staticmethod - def alloc(size): - return _uniffi_rust_call(_UniffiLib.ffi_iota_graphql_client_rustbuffer_alloc, size) - - @staticmethod - def reserve(rbuf, additional): - return _uniffi_rust_call(_UniffiLib.ffi_iota_graphql_client_rustbuffer_reserve, rbuf, additional) - - def free(self): - return _uniffi_rust_call(_UniffiLib.ffi_iota_graphql_client_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") - -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_UNEXPECTED_ERROR = 2 - - @staticmethod - def default(): - return _UniffiRustCallStatus(code=_UniffiRustCallStatus.CALL_SUCCESS, error_buf=_UniffiRustBuffer.default()) - - 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_UNEXPECTED_ERROR: - return "_UniffiRustCallStatus(CALL_UNEXPECTED_ERROR)" - else: - return "_UniffiRustCallStatus()" - -def _uniffi_rust_call(fn, *args): - # Call a rust function - return _uniffi_rust_call_with_error(None, fn, *args) - -def _uniffi_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.default() - - 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("_uniffi_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_UNEXPECTED_ERROR: - # 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)) - -def _uniffi_trait_interface_call(call_status, make_call, write_return_value): - try: - return write_return_value(make_call()) - except Exception as e: - call_status.code = _UniffiRustCallStatus.CALL_UNEXPECTED_ERROR - call_status.error_buf = _UniffiConverterString.lower(repr(e)) - -def _uniffi_trait_interface_call_with_error(call_status, make_call, write_return_value, error_type, lower_error): - try: - try: - return write_return_value(make_call()) - except error_type as e: - call_status.code = _UniffiRustCallStatus.CALL_ERROR - call_status.error_buf = lower_error(e) - except Exception as e: - call_status.code = _UniffiRustCallStatus.CALL_UNEXPECTED_ERROR - call_status.error_buf = _UniffiConverterString.lower(repr(e)) -class _UniffiHandleMap: - """ - A map where inserting, getting and removing data is synchronized with a lock. - """ - - def __init__(self): - # type Handle = int - self._map = {} # type: Dict[Handle, Any] - self._lock = threading.Lock() - self._counter = itertools.count() - - def insert(self, obj): - with self._lock: - handle = next(self._counter) - self._map[handle] = obj - return handle - - def get(self, handle): - try: - with self._lock: - return self._map[handle] - except KeyError: - raise InternalError("_UniffiHandleMap.get: Invalid handle") - - def remove(self, handle): - try: - with self._lock: - return self._map.pop(handle) - except KeyError: - raise InternalError("_UniffiHandleMap.remove: Invalid handle") - - def __len__(self): - return len(self._map) -# Types conforming to `_UniffiConverterPrimitive` pass themselves directly over the FFI. -class _UniffiConverterPrimitive: - @classmethod - def lift(cls, value): - return value - - @classmethod - def lower(cls, value): - return value - -class _UniffiConverterPrimitiveInt(_UniffiConverterPrimitive): - @classmethod - def check_lower(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)) - -class _UniffiConverterPrimitiveFloat(_UniffiConverterPrimitive): - @classmethod - def check_lower(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__)) - -# 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 - -""" -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_uint64, 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("iota_graphql_client") - 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 = 29 - # Get the scaffolding contract version by calling the into the dylib - scaffolding_contract_version = lib.ffi_iota_graphql_client_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_iota_graphql_client_checksum_method_client_active_validators() != 56747: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_chain_id() != 24918: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_checkpoint() != 38759: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_checkpoints() != 47040: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_coin_metadata() != 43443: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_coins() != 46549: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_epoch() != 12920: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_epoch_total_checkpoints() != 18303: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_epoch_total_transaction_blocks() != 43068: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_epochs() != 31348: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_events() != 5353: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_execute_tx() != 53961: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_internal_total_transaction_blocks() != 49810: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_latest_checkpoint_sequence_number() != 47272: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_max_page_size() != 14967: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_move_object_contents_bcs() != 38373: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_normalized_move_function() != 38463: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_normalized_move_module() != 47271: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_object() != 49802: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_object_bcs() != 33024: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_objects() != 48130: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_package() != 40442: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_package_by_name() != 16102: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_package_latest() != 41132: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_package_versions() != 9606: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_packages() != 54249: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_pagination_filter() != 48068: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_protocol_config() != 31000: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_reference_gas_price() != 53704: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_total_supply() != 47653: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_total_transaction_blocks() != 35998: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_total_transaction_blocks_by_digest() != 52201: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_total_transaction_blocks_by_seq_num() != 47800: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_transaction() != 32100: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_transaction_data_effects() != 52013: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_transaction_effects() != 5195: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_transactions() != 8436: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_transactions_data_effects() != 40448: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_client_transactions_effects() != 41232: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_method_error_kind() != 44566: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_constructor_client_new() != 30926: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_constructor_client_new_devnet() != 1714: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_constructor_client_new_localhost() != 60569: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_constructor_client_new_mainnet() != 51011: - raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") - if lib.uniffi_iota_graphql_client_checksum_constructor_client_new_testnet() != 42249: - 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() -_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK = ctypes.CFUNCTYPE(None,ctypes.c_uint64,ctypes.c_int8, -) -_UNIFFI_FOREIGN_FUTURE_FREE = ctypes.CFUNCTYPE(None,ctypes.c_uint64, -) -_UNIFFI_CALLBACK_INTERFACE_FREE = ctypes.CFUNCTYPE(None,ctypes.c_uint64, -) -class _UniffiForeignFuture(ctypes.Structure): - _fields_ = [ - ("handle", ctypes.c_uint64), - ("free", _UNIFFI_FOREIGN_FUTURE_FREE), - ] -class _UniffiForeignFutureStructU8(ctypes.Structure): - _fields_ = [ - ("return_value", ctypes.c_uint8), - ("call_status", _UniffiRustCallStatus), - ] -_UNIFFI_FOREIGN_FUTURE_COMPLETE_U8 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructU8, -) -class _UniffiForeignFutureStructI8(ctypes.Structure): - _fields_ = [ - ("return_value", ctypes.c_int8), - ("call_status", _UniffiRustCallStatus), - ] -_UNIFFI_FOREIGN_FUTURE_COMPLETE_I8 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructI8, -) -class _UniffiForeignFutureStructU16(ctypes.Structure): - _fields_ = [ - ("return_value", ctypes.c_uint16), - ("call_status", _UniffiRustCallStatus), - ] -_UNIFFI_FOREIGN_FUTURE_COMPLETE_U16 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructU16, -) -class _UniffiForeignFutureStructI16(ctypes.Structure): - _fields_ = [ - ("return_value", ctypes.c_int16), - ("call_status", _UniffiRustCallStatus), - ] -_UNIFFI_FOREIGN_FUTURE_COMPLETE_I16 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructI16, -) -class _UniffiForeignFutureStructU32(ctypes.Structure): - _fields_ = [ - ("return_value", ctypes.c_uint32), - ("call_status", _UniffiRustCallStatus), - ] -_UNIFFI_FOREIGN_FUTURE_COMPLETE_U32 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructU32, -) -class _UniffiForeignFutureStructI32(ctypes.Structure): - _fields_ = [ - ("return_value", ctypes.c_int32), - ("call_status", _UniffiRustCallStatus), - ] -_UNIFFI_FOREIGN_FUTURE_COMPLETE_I32 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructI32, -) -class _UniffiForeignFutureStructU64(ctypes.Structure): - _fields_ = [ - ("return_value", ctypes.c_uint64), - ("call_status", _UniffiRustCallStatus), - ] -_UNIFFI_FOREIGN_FUTURE_COMPLETE_U64 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructU64, -) -class _UniffiForeignFutureStructI64(ctypes.Structure): - _fields_ = [ - ("return_value", ctypes.c_int64), - ("call_status", _UniffiRustCallStatus), - ] -_UNIFFI_FOREIGN_FUTURE_COMPLETE_I64 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructI64, -) -class _UniffiForeignFutureStructF32(ctypes.Structure): - _fields_ = [ - ("return_value", ctypes.c_float), - ("call_status", _UniffiRustCallStatus), - ] -_UNIFFI_FOREIGN_FUTURE_COMPLETE_F32 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructF32, -) -class _UniffiForeignFutureStructF64(ctypes.Structure): - _fields_ = [ - ("return_value", ctypes.c_double), - ("call_status", _UniffiRustCallStatus), - ] -_UNIFFI_FOREIGN_FUTURE_COMPLETE_F64 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructF64, -) -class _UniffiForeignFutureStructPointer(ctypes.Structure): - _fields_ = [ - ("return_value", ctypes.c_void_p), - ("call_status", _UniffiRustCallStatus), - ] -_UNIFFI_FOREIGN_FUTURE_COMPLETE_POINTER = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructPointer, -) -class _UniffiForeignFutureStructRustBuffer(ctypes.Structure): - _fields_ = [ - ("return_value", _UniffiRustBuffer), - ("call_status", _UniffiRustCallStatus), - ] -_UNIFFI_FOREIGN_FUTURE_COMPLETE_RUST_BUFFER = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructRustBuffer, -) -class _UniffiForeignFutureStructVoid(ctypes.Structure): - _fields_ = [ - ("call_status", _UniffiRustCallStatus), - ] -_UNIFFI_FOREIGN_FUTURE_COMPLETE_VOID = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructVoid, -) -_UniffiLib.uniffi_iota_graphql_client_fn_clone_client.argtypes = ( - ctypes.c_void_p, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.uniffi_iota_graphql_client_fn_clone_client.restype = ctypes.c_void_p -_UniffiLib.uniffi_iota_graphql_client_fn_free_client.argtypes = ( - ctypes.c_void_p, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.uniffi_iota_graphql_client_fn_free_client.restype = None -_UniffiLib.uniffi_iota_graphql_client_fn_constructor_client_new.argtypes = ( - _UniffiRustBuffer, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.uniffi_iota_graphql_client_fn_constructor_client_new.restype = ctypes.c_void_p -_UniffiLib.uniffi_iota_graphql_client_fn_constructor_client_new_devnet.argtypes = ( - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.uniffi_iota_graphql_client_fn_constructor_client_new_devnet.restype = ctypes.c_void_p -_UniffiLib.uniffi_iota_graphql_client_fn_constructor_client_new_localhost.argtypes = ( - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.uniffi_iota_graphql_client_fn_constructor_client_new_localhost.restype = ctypes.c_void_p -_UniffiLib.uniffi_iota_graphql_client_fn_constructor_client_new_mainnet.argtypes = ( - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.uniffi_iota_graphql_client_fn_constructor_client_new_mainnet.restype = ctypes.c_void_p -_UniffiLib.uniffi_iota_graphql_client_fn_constructor_client_new_testnet.argtypes = ( - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.uniffi_iota_graphql_client_fn_constructor_client_new_testnet.restype = ctypes.c_void_p -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_active_validators.argtypes = ( - ctypes.c_void_p, - _UniffiRustBuffer, - _UniffiRustBuffer, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_active_validators.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_chain_id.argtypes = ( - ctypes.c_void_p, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_chain_id.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_checkpoint.argtypes = ( - ctypes.c_void_p, - _UniffiRustBuffer, - _UniffiRustBuffer, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_checkpoint.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_checkpoints.argtypes = ( - ctypes.c_void_p, - _UniffiRustBuffer, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_checkpoints.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_coin_metadata.argtypes = ( - ctypes.c_void_p, - _UniffiRustBuffer, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_coin_metadata.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_coins.argtypes = ( - ctypes.c_void_p, - _UniffiRustBufferAddress, - _UniffiRustBuffer, - _UniffiRustBuffer, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_coins.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_epoch.argtypes = ( - ctypes.c_void_p, - _UniffiRustBuffer, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_epoch.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_epoch_total_checkpoints.argtypes = ( - ctypes.c_void_p, - _UniffiRustBuffer, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_epoch_total_checkpoints.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_epoch_total_transaction_blocks.argtypes = ( - ctypes.c_void_p, - _UniffiRustBuffer, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_epoch_total_transaction_blocks.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_epochs.argtypes = ( - ctypes.c_void_p, - _UniffiRustBuffer, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_epochs.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_events.argtypes = ( - ctypes.c_void_p, - _UniffiRustBuffer, - _UniffiRustBuffer, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_events.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_execute_tx.argtypes = ( - ctypes.c_void_p, - _UniffiRustBuffer, - _UniffiRustBufferTransaction, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_execute_tx.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_internal_total_transaction_blocks.argtypes = ( - ctypes.c_void_p, - _UniffiRustBuffer, - _UniffiRustBuffer, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_internal_total_transaction_blocks.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_latest_checkpoint_sequence_number.argtypes = ( - ctypes.c_void_p, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_latest_checkpoint_sequence_number.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_max_page_size.argtypes = ( - ctypes.c_void_p, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_max_page_size.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_move_object_contents_bcs.argtypes = ( - ctypes.c_void_p, - _UniffiRustBufferAddress, - _UniffiRustBuffer, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_move_object_contents_bcs.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_normalized_move_function.argtypes = ( - ctypes.c_void_p, - _UniffiRustBuffer, - _UniffiRustBuffer, - _UniffiRustBuffer, - _UniffiRustBuffer, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_normalized_move_function.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_normalized_move_module.argtypes = ( - ctypes.c_void_p, - _UniffiRustBuffer, - _UniffiRustBuffer, - _UniffiRustBuffer, - _UniffiRustBuffer, - _UniffiRustBuffer, - _UniffiRustBuffer, - _UniffiRustBuffer, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_normalized_move_module.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_object.argtypes = ( - ctypes.c_void_p, - _UniffiRustBufferAddress, - _UniffiRustBuffer, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_object.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_object_bcs.argtypes = ( - ctypes.c_void_p, - _UniffiRustBufferAddress, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_object_bcs.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_objects.argtypes = ( - ctypes.c_void_p, - _UniffiRustBuffer, - _UniffiRustBuffer, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_objects.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_package.argtypes = ( - ctypes.c_void_p, - _UniffiRustBufferAddress, - _UniffiRustBuffer, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_package.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_package_by_name.argtypes = ( - ctypes.c_void_p, - _UniffiRustBuffer, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_package_by_name.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_package_latest.argtypes = ( - ctypes.c_void_p, - _UniffiRustBufferAddress, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_package_latest.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_package_versions.argtypes = ( - ctypes.c_void_p, - _UniffiRustBufferAddress, - _UniffiRustBuffer, - _UniffiRustBuffer, - _UniffiRustBuffer, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_package_versions.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_packages.argtypes = ( - ctypes.c_void_p, - _UniffiRustBuffer, - _UniffiRustBuffer, - _UniffiRustBuffer, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_packages.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_pagination_filter.argtypes = ( - ctypes.c_void_p, - _UniffiRustBuffer, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_pagination_filter.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_protocol_config.argtypes = ( - ctypes.c_void_p, - _UniffiRustBuffer, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_protocol_config.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_reference_gas_price.argtypes = ( - ctypes.c_void_p, - _UniffiRustBuffer, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_reference_gas_price.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_total_supply.argtypes = ( - ctypes.c_void_p, - _UniffiRustBuffer, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_total_supply.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_total_transaction_blocks.argtypes = ( - ctypes.c_void_p, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_total_transaction_blocks.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_total_transaction_blocks_by_digest.argtypes = ( - ctypes.c_void_p, - _UniffiRustBufferDigest, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_total_transaction_blocks_by_digest.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_total_transaction_blocks_by_seq_num.argtypes = ( - ctypes.c_void_p, - ctypes.c_uint64, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_total_transaction_blocks_by_seq_num.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_transaction.argtypes = ( - ctypes.c_void_p, - _UniffiRustBufferDigest, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_transaction.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_transaction_data_effects.argtypes = ( - ctypes.c_void_p, - _UniffiRustBufferDigest, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_transaction_data_effects.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_transaction_effects.argtypes = ( - ctypes.c_void_p, - _UniffiRustBufferDigest, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_transaction_effects.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_transactions.argtypes = ( - ctypes.c_void_p, - _UniffiRustBuffer, - _UniffiRustBuffer, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_transactions.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_transactions_data_effects.argtypes = ( - ctypes.c_void_p, - _UniffiRustBuffer, - _UniffiRustBuffer, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_transactions_data_effects.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_transactions_effects.argtypes = ( - ctypes.c_void_p, - _UniffiRustBuffer, - _UniffiRustBuffer, -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_client_transactions_effects.restype = ctypes.c_uint64 -_UniffiLib.uniffi_iota_graphql_client_fn_clone_error.argtypes = ( - ctypes.c_void_p, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.uniffi_iota_graphql_client_fn_clone_error.restype = ctypes.c_void_p -_UniffiLib.uniffi_iota_graphql_client_fn_free_error.argtypes = ( - ctypes.c_void_p, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.uniffi_iota_graphql_client_fn_free_error.restype = None -_UniffiLib.uniffi_iota_graphql_client_fn_method_error_kind.argtypes = ( - ctypes.c_void_p, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.uniffi_iota_graphql_client_fn_method_error_kind.restype = _UniffiRustBuffer -_UniffiLib.ffi_iota_graphql_client_rustbuffer_alloc.argtypes = ( - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_graphql_client_rustbuffer_alloc.restype = _UniffiRustBuffer -_UniffiLib.ffi_iota_graphql_client_rustbuffer_from_bytes.argtypes = ( - _UniffiForeignBytes, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_graphql_client_rustbuffer_from_bytes.restype = _UniffiRustBuffer -_UniffiLib.ffi_iota_graphql_client_rustbuffer_free.argtypes = ( - _UniffiRustBuffer, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_graphql_client_rustbuffer_free.restype = None -_UniffiLib.ffi_iota_graphql_client_rustbuffer_reserve.argtypes = ( - _UniffiRustBuffer, - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_graphql_client_rustbuffer_reserve.restype = _UniffiRustBuffer -_UniffiLib.ffi_iota_graphql_client_rust_future_poll_u8.argtypes = ( - ctypes.c_uint64, - _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_poll_u8.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_cancel_u8.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_cancel_u8.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_free_u8.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_free_u8.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_complete_u8.argtypes = ( - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_graphql_client_rust_future_complete_u8.restype = ctypes.c_uint8 -_UniffiLib.ffi_iota_graphql_client_rust_future_poll_i8.argtypes = ( - ctypes.c_uint64, - _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_poll_i8.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_cancel_i8.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_cancel_i8.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_free_i8.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_free_i8.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_complete_i8.argtypes = ( - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_graphql_client_rust_future_complete_i8.restype = ctypes.c_int8 -_UniffiLib.ffi_iota_graphql_client_rust_future_poll_u16.argtypes = ( - ctypes.c_uint64, - _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_poll_u16.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_cancel_u16.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_cancel_u16.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_free_u16.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_free_u16.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_complete_u16.argtypes = ( - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_graphql_client_rust_future_complete_u16.restype = ctypes.c_uint16 -_UniffiLib.ffi_iota_graphql_client_rust_future_poll_i16.argtypes = ( - ctypes.c_uint64, - _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_poll_i16.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_cancel_i16.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_cancel_i16.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_free_i16.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_free_i16.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_complete_i16.argtypes = ( - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_graphql_client_rust_future_complete_i16.restype = ctypes.c_int16 -_UniffiLib.ffi_iota_graphql_client_rust_future_poll_u32.argtypes = ( - ctypes.c_uint64, - _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_poll_u32.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_cancel_u32.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_cancel_u32.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_free_u32.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_free_u32.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_complete_u32.argtypes = ( - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_graphql_client_rust_future_complete_u32.restype = ctypes.c_uint32 -_UniffiLib.ffi_iota_graphql_client_rust_future_poll_i32.argtypes = ( - ctypes.c_uint64, - _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_poll_i32.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_cancel_i32.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_cancel_i32.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_free_i32.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_free_i32.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_complete_i32.argtypes = ( - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_graphql_client_rust_future_complete_i32.restype = ctypes.c_int32 -_UniffiLib.ffi_iota_graphql_client_rust_future_poll_u64.argtypes = ( - ctypes.c_uint64, - _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_poll_u64.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_cancel_u64.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_cancel_u64.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_free_u64.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_free_u64.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_complete_u64.argtypes = ( - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_graphql_client_rust_future_complete_u64.restype = ctypes.c_uint64 -_UniffiLib.ffi_iota_graphql_client_rust_future_poll_i64.argtypes = ( - ctypes.c_uint64, - _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_poll_i64.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_cancel_i64.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_cancel_i64.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_free_i64.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_free_i64.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_complete_i64.argtypes = ( - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_graphql_client_rust_future_complete_i64.restype = ctypes.c_int64 -_UniffiLib.ffi_iota_graphql_client_rust_future_poll_f32.argtypes = ( - ctypes.c_uint64, - _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_poll_f32.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_cancel_f32.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_cancel_f32.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_free_f32.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_free_f32.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_complete_f32.argtypes = ( - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_graphql_client_rust_future_complete_f32.restype = ctypes.c_float -_UniffiLib.ffi_iota_graphql_client_rust_future_poll_f64.argtypes = ( - ctypes.c_uint64, - _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_poll_f64.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_cancel_f64.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_cancel_f64.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_free_f64.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_free_f64.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_complete_f64.argtypes = ( - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_graphql_client_rust_future_complete_f64.restype = ctypes.c_double -_UniffiLib.ffi_iota_graphql_client_rust_future_poll_pointer.argtypes = ( - ctypes.c_uint64, - _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_poll_pointer.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_cancel_pointer.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_cancel_pointer.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_free_pointer.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_free_pointer.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_complete_pointer.argtypes = ( - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_graphql_client_rust_future_complete_pointer.restype = ctypes.c_void_p -_UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer.argtypes = ( - ctypes.c_uint64, - _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_cancel_rust_buffer.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_cancel_rust_buffer.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer.argtypes = ( - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer.restype = _UniffiRustBuffer -_UniffiLib.ffi_iota_graphql_client_rust_future_poll_void.argtypes = ( - ctypes.c_uint64, - _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_poll_void.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_cancel_void.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_cancel_void.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_free_void.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_graphql_client_rust_future_free_void.restype = None -_UniffiLib.ffi_iota_graphql_client_rust_future_complete_void.argtypes = ( - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_graphql_client_rust_future_complete_void.restype = None -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_active_validators.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_active_validators.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_chain_id.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_chain_id.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_checkpoint.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_checkpoint.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_checkpoints.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_checkpoints.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_coin_metadata.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_coin_metadata.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_coins.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_coins.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_epoch.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_epoch.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_epoch_total_checkpoints.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_epoch_total_checkpoints.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_epoch_total_transaction_blocks.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_epoch_total_transaction_blocks.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_epochs.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_epochs.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_events.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_events.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_execute_tx.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_execute_tx.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_internal_total_transaction_blocks.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_internal_total_transaction_blocks.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_latest_checkpoint_sequence_number.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_latest_checkpoint_sequence_number.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_max_page_size.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_max_page_size.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_move_object_contents_bcs.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_move_object_contents_bcs.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_normalized_move_function.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_normalized_move_function.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_normalized_move_module.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_normalized_move_module.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_object.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_object.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_object_bcs.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_object_bcs.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_objects.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_objects.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_package.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_package.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_package_by_name.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_package_by_name.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_package_latest.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_package_latest.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_package_versions.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_package_versions.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_packages.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_packages.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_pagination_filter.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_pagination_filter.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_protocol_config.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_protocol_config.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_reference_gas_price.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_reference_gas_price.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_total_supply.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_total_supply.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_total_transaction_blocks.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_total_transaction_blocks.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_total_transaction_blocks_by_digest.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_total_transaction_blocks_by_digest.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_total_transaction_blocks_by_seq_num.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_total_transaction_blocks_by_seq_num.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_transaction.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_transaction.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_transaction_data_effects.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_transaction_data_effects.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_transaction_effects.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_transaction_effects.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_transactions.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_transactions.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_transactions_data_effects.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_transactions_data_effects.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_transactions_effects.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_client_transactions_effects.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_method_error_kind.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_method_error_kind.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_constructor_client_new.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_constructor_client_new.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_constructor_client_new_devnet.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_constructor_client_new_devnet.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_constructor_client_new_localhost.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_constructor_client_new_localhost.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_constructor_client_new_mainnet.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_constructor_client_new_mainnet.restype = ctypes.c_uint16 -_UniffiLib.uniffi_iota_graphql_client_checksum_constructor_client_new_testnet.argtypes = ( -) -_UniffiLib.uniffi_iota_graphql_client_checksum_constructor_client_new_testnet.restype = ctypes.c_uint16 -_UniffiLib.ffi_iota_graphql_client_uniffi_contract_version.argtypes = ( -) -_UniffiLib.ffi_iota_graphql_client_uniffi_contract_version.restype = ctypes.c_uint32 - -_uniffi_check_contract_api_version(_UniffiLib) -# _uniffi_check_api_checksums(_UniffiLib) - -# Public interface members begin here. - - -class _UniffiConverterInt32(_UniffiConverterPrimitiveInt): - CLASS_NAME = "i32" - VALUE_MIN = -2**31 - VALUE_MAX = 2**31 - - @staticmethod - def read(buf): - return buf.read_i32() - - @staticmethod - def write(value, buf): - buf.write_i32(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(value, buf): - buf.write_u64(value) - -class _UniffiConverterBool: - @classmethod - def check_lower(cls, value): - return not not value - - @classmethod - def lower(cls, value): - return 1 if value else 0 - - @staticmethod - def lift(value): - return value != 0 - - @classmethod - def read(cls, buf): - return cls.lift(buf.read_u8()) - - @classmethod - def write(cls, value, buf): - buf.write_u8(value) - -class _UniffiConverterString: - @staticmethod - def check_lower(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): - 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): - with _UniffiRustBuffer.alloc_with_builder() as builder: - builder.write(value.encode("utf-8")) - return builder.finalize() - -class _UniffiConverterBytes(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - size = buf.read_i32() - if size < 0: - raise InternalError("Unexpected negative byte string length") - return buf.read(size) - - @staticmethod - def check_lower(value): - try: - memoryview(value) - except TypeError: - raise TypeError("a bytes-like object is required, not {!r}".format(type(value).__name__)) - - @staticmethod - def write(value, buf): - buf.write_i32(len(value)) - buf.write(value) - - - - - - -class CheckpointSummaryPage: - page_info: "PageInfo" - data: "typing.List[CheckpointSummary]" - def __init__(self, *, page_info: "PageInfo", data: "typing.List[CheckpointSummary]"): - self.page_info = page_info - self.data = data - - def __str__(self): - return "CheckpointSummaryPage(page_info={}, data={})".format(self.page_info, self.data) - - def __eq__(self, other): - if self.page_info != other.page_info: - return False - if self.data != other.data: - return False - return True - -class _UniffiConverterTypeCheckpointSummaryPage(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return CheckpointSummaryPage( - page_info=_UniffiConverterTypePageInfo.read(buf), - data=_UniffiConverterSequenceTypeCheckpointSummary.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypePageInfo.check_lower(value.page_info) - _UniffiConverterSequenceTypeCheckpointSummary.check_lower(value.data) - - @staticmethod - def write(value, buf): - _UniffiConverterTypePageInfo.write(value.page_info, buf) - _UniffiConverterSequenceTypeCheckpointSummary.write(value.data, buf) - - -class CoinMetadata: - """ - The coin metadata associated with the given coin type. - """ - - decimals: "typing.Optional[int]" - """ - The number of decimal places used to represent the token. - """ - - description: "typing.Optional[str]" - """ - Optional description of the token, provided by the creator of the token. - """ - - icon_url: "typing.Optional[str]" - """ - Icon URL of the coin. - """ - - name: "typing.Optional[str]" - """ - Full, official name of the token. - """ - - symbol: "typing.Optional[str]" - """ - The token's identifying abbreviation. - """ - - supply: "typing.Optional[BigInt]" - """ - The overall quantity of tokens that will be issued. - """ - - version: "int" - """ - Version of the token. - """ - - def __init__(self, *, decimals: "typing.Optional[int]", description: "typing.Optional[str]", icon_url: "typing.Optional[str]", name: "typing.Optional[str]", symbol: "typing.Optional[str]", supply: "typing.Optional[BigInt]", version: "int"): - self.decimals = decimals - self.description = description - self.icon_url = icon_url - self.name = name - self.symbol = symbol - self.supply = supply - self.version = version - - def __str__(self): - return "CoinMetadata(decimals={}, description={}, icon_url={}, name={}, symbol={}, supply={}, version={})".format(self.decimals, self.description, self.icon_url, self.name, self.symbol, self.supply, self.version) - - def __eq__(self, other): - if self.decimals != other.decimals: - return False - if self.description != other.description: - return False - if self.icon_url != other.icon_url: - return False - if self.name != other.name: - return False - if self.symbol != other.symbol: - return False - if self.supply != other.supply: - return False - if self.version != other.version: - return False - return True - -class _UniffiConverterTypeCoinMetadata(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return CoinMetadata( - decimals=_UniffiConverterOptionalInt32.read(buf), - description=_UniffiConverterOptionalString.read(buf), - icon_url=_UniffiConverterOptionalString.read(buf), - name=_UniffiConverterOptionalString.read(buf), - symbol=_UniffiConverterOptionalString.read(buf), - supply=_UniffiConverterOptionalTypeBigInt.read(buf), - version=_UniffiConverterUInt64.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterOptionalInt32.check_lower(value.decimals) - _UniffiConverterOptionalString.check_lower(value.description) - _UniffiConverterOptionalString.check_lower(value.icon_url) - _UniffiConverterOptionalString.check_lower(value.name) - _UniffiConverterOptionalString.check_lower(value.symbol) - _UniffiConverterOptionalTypeBigInt.check_lower(value.supply) - _UniffiConverterUInt64.check_lower(value.version) - - @staticmethod - def write(value, buf): - _UniffiConverterOptionalInt32.write(value.decimals, buf) - _UniffiConverterOptionalString.write(value.description, buf) - _UniffiConverterOptionalString.write(value.icon_url, buf) - _UniffiConverterOptionalString.write(value.name, buf) - _UniffiConverterOptionalString.write(value.symbol, buf) - _UniffiConverterOptionalTypeBigInt.write(value.supply, buf) - _UniffiConverterUInt64.write(value.version, buf) - - -class CoinPage: - page_info: "PageInfo" - data: "typing.List[Coin]" - def __init__(self, *, page_info: "PageInfo", data: "typing.List[Coin]"): - self.page_info = page_info - self.data = data - - def __str__(self): - return "CoinPage(page_info={}, data={})".format(self.page_info, self.data) - - def __eq__(self, other): - if self.page_info != other.page_info: - return False - if self.data != other.data: - return False - return True - -class _UniffiConverterTypeCoinPage(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return CoinPage( - page_info=_UniffiConverterTypePageInfo.read(buf), - data=_UniffiConverterSequenceTypeCoin.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypePageInfo.check_lower(value.page_info) - _UniffiConverterSequenceTypeCoin.check_lower(value.data) - - @staticmethod - def write(value, buf): - _UniffiConverterTypePageInfo.write(value.page_info, buf) - _UniffiConverterSequenceTypeCoin.write(value.data, buf) - - -class Epoch: - epoch_id: "int" - """ - The epoch's id as a sequence number that starts at 0 and is incremented - by one at every epoch change. - """ - - fund_inflow: "typing.Optional[BigInt]" - """ - The storage fees paid for transactions executed during the epoch. - """ - - fund_outflow: "typing.Optional[BigInt]" - """ - The storage fee rebates paid to users who deleted the data associated - with past transactions. - """ - - fund_size: "typing.Optional[BigInt]" - """ - The storage fund available in this epoch. - This fund is used to redistribute storage fees from past transactions - to future validators. - """ - - live_object_set_digest: "typing.Optional[str]" - """ - A commitment by the committee at the end of epoch on the contents of the - live object set at that time. This can be used to verify state - snapshots. - """ - - net_inflow: "typing.Optional[BigInt]" - """ - The difference between the fund inflow and outflow, representing - the net amount of storage fees accumulated in this epoch. - """ - - protocol_configs: "typing.Optional[ProtocolConfigs]" - """ - The epoch's corresponding protocol configuration, including the feature - flags and the configuration options. - """ - - reference_gas_price: "typing.Optional[BigInt]" - """ - The minimum gas price that a quorum of validators are guaranteed to sign - a transaction for. - """ - - start_timestamp: "DateTime" - """ - The epoch's starting timestamp. - """ - - end_timestamp: "typing.Optional[DateTime]" - """ - The epoch's ending timestamp. Note that this is available only on epochs - that have ended. - """ - - system_state_version: "typing.Optional[int]" - """ - The value of the `version` field of `0x5`, the - `0x3::iota::IotaSystemState` object. This version changes whenever - the fields contained in the system state object (held in a dynamic - field attached to `0x5`) change. - """ - - total_checkpoints: "typing.Optional[int]" - """ - The total number of checkpoints in this epoch. - """ - - total_gas_fees: "typing.Optional[BigInt]" - """ - The total amount of gas fees (in MIST) that were paid in this epoch. - """ - - total_stake_rewards: "typing.Optional[BigInt]" - """ - The total MIST rewarded as stake. - """ - - total_stake_subsidies: "typing.Optional[BigInt]" - """ - The amount added to total gas fees to make up the total stake rewards. - """ - - total_transactions: "typing.Optional[int]" - """ - The total number of transaction in this epoch. - """ - - validator_set: "typing.Optional[ValidatorSet]" - """ - Validator related properties. For active validators, see - `active_validators` API. - """ - - def __init__(self, *, epoch_id: "int", fund_inflow: "typing.Optional[BigInt]", fund_outflow: "typing.Optional[BigInt]", fund_size: "typing.Optional[BigInt]", live_object_set_digest: "typing.Optional[str]", net_inflow: "typing.Optional[BigInt]", protocol_configs: "typing.Optional[ProtocolConfigs]", reference_gas_price: "typing.Optional[BigInt]", start_timestamp: "DateTime", end_timestamp: "typing.Optional[DateTime]", system_state_version: "typing.Optional[int]", total_checkpoints: "typing.Optional[int]", total_gas_fees: "typing.Optional[BigInt]", total_stake_rewards: "typing.Optional[BigInt]", total_stake_subsidies: "typing.Optional[BigInt]", total_transactions: "typing.Optional[int]", validator_set: "typing.Optional[ValidatorSet]"): - self.epoch_id = epoch_id - self.fund_inflow = fund_inflow - self.fund_outflow = fund_outflow - self.fund_size = fund_size - self.live_object_set_digest = live_object_set_digest - self.net_inflow = net_inflow - self.protocol_configs = protocol_configs - self.reference_gas_price = reference_gas_price - self.start_timestamp = start_timestamp - self.end_timestamp = end_timestamp - self.system_state_version = system_state_version - self.total_checkpoints = total_checkpoints - self.total_gas_fees = total_gas_fees - self.total_stake_rewards = total_stake_rewards - self.total_stake_subsidies = total_stake_subsidies - self.total_transactions = total_transactions - self.validator_set = validator_set - - def __str__(self): - return "Epoch(epoch_id={}, fund_inflow={}, fund_outflow={}, fund_size={}, live_object_set_digest={}, net_inflow={}, protocol_configs={}, reference_gas_price={}, start_timestamp={}, end_timestamp={}, system_state_version={}, total_checkpoints={}, total_gas_fees={}, total_stake_rewards={}, total_stake_subsidies={}, total_transactions={}, validator_set={})".format(self.epoch_id, self.fund_inflow, self.fund_outflow, self.fund_size, self.live_object_set_digest, self.net_inflow, self.protocol_configs, self.reference_gas_price, self.start_timestamp, self.end_timestamp, self.system_state_version, self.total_checkpoints, self.total_gas_fees, self.total_stake_rewards, self.total_stake_subsidies, self.total_transactions, self.validator_set) - - def __eq__(self, other): - if self.epoch_id != other.epoch_id: - return False - if self.fund_inflow != other.fund_inflow: - return False - if self.fund_outflow != other.fund_outflow: - return False - if self.fund_size != other.fund_size: - return False - if self.live_object_set_digest != other.live_object_set_digest: - return False - if self.net_inflow != other.net_inflow: - return False - if self.protocol_configs != other.protocol_configs: - return False - if self.reference_gas_price != other.reference_gas_price: - return False - if self.start_timestamp != other.start_timestamp: - return False - if self.end_timestamp != other.end_timestamp: - return False - if self.system_state_version != other.system_state_version: - return False - if self.total_checkpoints != other.total_checkpoints: - return False - if self.total_gas_fees != other.total_gas_fees: - return False - if self.total_stake_rewards != other.total_stake_rewards: - return False - if self.total_stake_subsidies != other.total_stake_subsidies: - return False - if self.total_transactions != other.total_transactions: - return False - if self.validator_set != other.validator_set: - return False - return True - -class _UniffiConverterTypeEpoch(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return Epoch( - epoch_id=_UniffiConverterUInt64.read(buf), - fund_inflow=_UniffiConverterOptionalTypeBigInt.read(buf), - fund_outflow=_UniffiConverterOptionalTypeBigInt.read(buf), - fund_size=_UniffiConverterOptionalTypeBigInt.read(buf), - live_object_set_digest=_UniffiConverterOptionalString.read(buf), - net_inflow=_UniffiConverterOptionalTypeBigInt.read(buf), - protocol_configs=_UniffiConverterOptionalTypeProtocolConfigs.read(buf), - reference_gas_price=_UniffiConverterOptionalTypeBigInt.read(buf), - start_timestamp=_UniffiConverterTypeDateTime.read(buf), - end_timestamp=_UniffiConverterOptionalTypeDateTime.read(buf), - system_state_version=_UniffiConverterOptionalUInt64.read(buf), - total_checkpoints=_UniffiConverterOptionalUInt64.read(buf), - total_gas_fees=_UniffiConverterOptionalTypeBigInt.read(buf), - total_stake_rewards=_UniffiConverterOptionalTypeBigInt.read(buf), - total_stake_subsidies=_UniffiConverterOptionalTypeBigInt.read(buf), - total_transactions=_UniffiConverterOptionalUInt64.read(buf), - validator_set=_UniffiConverterOptionalTypeValidatorSet.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterUInt64.check_lower(value.epoch_id) - _UniffiConverterOptionalTypeBigInt.check_lower(value.fund_inflow) - _UniffiConverterOptionalTypeBigInt.check_lower(value.fund_outflow) - _UniffiConverterOptionalTypeBigInt.check_lower(value.fund_size) - _UniffiConverterOptionalString.check_lower(value.live_object_set_digest) - _UniffiConverterOptionalTypeBigInt.check_lower(value.net_inflow) - _UniffiConverterOptionalTypeProtocolConfigs.check_lower(value.protocol_configs) - _UniffiConverterOptionalTypeBigInt.check_lower(value.reference_gas_price) - _UniffiConverterTypeDateTime.check_lower(value.start_timestamp) - _UniffiConverterOptionalTypeDateTime.check_lower(value.end_timestamp) - _UniffiConverterOptionalUInt64.check_lower(value.system_state_version) - _UniffiConverterOptionalUInt64.check_lower(value.total_checkpoints) - _UniffiConverterOptionalTypeBigInt.check_lower(value.total_gas_fees) - _UniffiConverterOptionalTypeBigInt.check_lower(value.total_stake_rewards) - _UniffiConverterOptionalTypeBigInt.check_lower(value.total_stake_subsidies) - _UniffiConverterOptionalUInt64.check_lower(value.total_transactions) - _UniffiConverterOptionalTypeValidatorSet.check_lower(value.validator_set) - - @staticmethod - def write(value, buf): - _UniffiConverterUInt64.write(value.epoch_id, buf) - _UniffiConverterOptionalTypeBigInt.write(value.fund_inflow, buf) - _UniffiConverterOptionalTypeBigInt.write(value.fund_outflow, buf) - _UniffiConverterOptionalTypeBigInt.write(value.fund_size, buf) - _UniffiConverterOptionalString.write(value.live_object_set_digest, buf) - _UniffiConverterOptionalTypeBigInt.write(value.net_inflow, buf) - _UniffiConverterOptionalTypeProtocolConfigs.write(value.protocol_configs, buf) - _UniffiConverterOptionalTypeBigInt.write(value.reference_gas_price, buf) - _UniffiConverterTypeDateTime.write(value.start_timestamp, buf) - _UniffiConverterOptionalTypeDateTime.write(value.end_timestamp, buf) - _UniffiConverterOptionalUInt64.write(value.system_state_version, buf) - _UniffiConverterOptionalUInt64.write(value.total_checkpoints, buf) - _UniffiConverterOptionalTypeBigInt.write(value.total_gas_fees, buf) - _UniffiConverterOptionalTypeBigInt.write(value.total_stake_rewards, buf) - _UniffiConverterOptionalTypeBigInt.write(value.total_stake_subsidies, buf) - _UniffiConverterOptionalUInt64.write(value.total_transactions, buf) - _UniffiConverterOptionalTypeValidatorSet.write(value.validator_set, buf) - - -class EpochPage: - page_info: "PageInfo" - data: "typing.List[Epoch]" - def __init__(self, *, page_info: "PageInfo", data: "typing.List[Epoch]"): - self.page_info = page_info - self.data = data - - def __str__(self): - return "EpochPage(page_info={}, data={})".format(self.page_info, self.data) - - def __eq__(self, other): - if self.page_info != other.page_info: - return False - if self.data != other.data: - return False - return True - -class _UniffiConverterTypeEpochPage(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return EpochPage( - page_info=_UniffiConverterTypePageInfo.read(buf), - data=_UniffiConverterSequenceTypeEpoch.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypePageInfo.check_lower(value.page_info) - _UniffiConverterSequenceTypeEpoch.check_lower(value.data) - - @staticmethod - def write(value, buf): - _UniffiConverterTypePageInfo.write(value.page_info, buf) - _UniffiConverterSequenceTypeEpoch.write(value.data, buf) - - -class EventFilter: - emitting_module: "typing.Optional[str]" - event_type: "typing.Optional[str]" - sender: "typing.Optional[Address]" - transaction_digest: "typing.Optional[str]" - def __init__(self, *, emitting_module: "typing.Optional[str]", event_type: "typing.Optional[str]", sender: "typing.Optional[Address]", transaction_digest: "typing.Optional[str]"): - self.emitting_module = emitting_module - self.event_type = event_type - self.sender = sender - self.transaction_digest = transaction_digest - - def __str__(self): - return "EventFilter(emitting_module={}, event_type={}, sender={}, transaction_digest={})".format(self.emitting_module, self.event_type, self.sender, self.transaction_digest) - - def __eq__(self, other): - if self.emitting_module != other.emitting_module: - return False - if self.event_type != other.event_type: - return False - if self.sender != other.sender: - return False - if self.transaction_digest != other.transaction_digest: - return False - return True - -class _UniffiConverterTypeEventFilter(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return EventFilter( - emitting_module=_UniffiConverterOptionalString.read(buf), - event_type=_UniffiConverterOptionalString.read(buf), - sender=_UniffiConverterOptionalTypeAddress.read(buf), - transaction_digest=_UniffiConverterOptionalString.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterOptionalString.check_lower(value.emitting_module) - _UniffiConverterOptionalString.check_lower(value.event_type) - _UniffiConverterOptionalTypeAddress.check_lower(value.sender) - _UniffiConverterOptionalString.check_lower(value.transaction_digest) - - @staticmethod - def write(value, buf): - _UniffiConverterOptionalString.write(value.emitting_module, buf) - _UniffiConverterOptionalString.write(value.event_type, buf) - _UniffiConverterOptionalTypeAddress.write(value.sender, buf) - _UniffiConverterOptionalString.write(value.transaction_digest, buf) - - -class GqlAddress: - address: "Address" - def __init__(self, *, address: "Address"): - self.address = address - - def __str__(self): - return "GqlAddress(address={})".format(self.address) - - def __eq__(self, other): - if self.address != other.address: - return False - return True - -class _UniffiConverterTypeGqlAddress(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return GqlAddress( - address=_UniffiConverterTypeAddress.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeAddress.check_lower(value.address) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeAddress.write(value.address, buf) - - -class MoveEnum: - abilities: "typing.Optional[typing.List[MoveAbility]]" - name: "str" - type_parameters: "typing.Optional[typing.List[MoveStructTypeParameter]]" - variants: "typing.Optional[typing.List[MoveEnumVariant]]" - def __init__(self, *, abilities: "typing.Optional[typing.List[MoveAbility]]", name: "str", type_parameters: "typing.Optional[typing.List[MoveStructTypeParameter]]", variants: "typing.Optional[typing.List[MoveEnumVariant]]"): - self.abilities = abilities - self.name = name - self.type_parameters = type_parameters - self.variants = variants - - def __str__(self): - return "MoveEnum(abilities={}, name={}, type_parameters={}, variants={})".format(self.abilities, self.name, self.type_parameters, self.variants) - - def __eq__(self, other): - if self.abilities != other.abilities: - return False - if self.name != other.name: - return False - if self.type_parameters != other.type_parameters: - return False - if self.variants != other.variants: - return False - return True - -class _UniffiConverterTypeMoveEnum(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return MoveEnum( - abilities=_UniffiConverterOptionalSequenceTypeMoveAbility.read(buf), - name=_UniffiConverterString.read(buf), - type_parameters=_UniffiConverterOptionalSequenceTypeMoveStructTypeParameter.read(buf), - variants=_UniffiConverterOptionalSequenceTypeMoveEnumVariant.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterOptionalSequenceTypeMoveAbility.check_lower(value.abilities) - _UniffiConverterString.check_lower(value.name) - _UniffiConverterOptionalSequenceTypeMoveStructTypeParameter.check_lower(value.type_parameters) - _UniffiConverterOptionalSequenceTypeMoveEnumVariant.check_lower(value.variants) - - @staticmethod - def write(value, buf): - _UniffiConverterOptionalSequenceTypeMoveAbility.write(value.abilities, buf) - _UniffiConverterString.write(value.name, buf) - _UniffiConverterOptionalSequenceTypeMoveStructTypeParameter.write(value.type_parameters, buf) - _UniffiConverterOptionalSequenceTypeMoveEnumVariant.write(value.variants, buf) - - -class MoveEnumConnection: - nodes: "typing.List[MoveEnum]" - page_info: "PageInfo" - def __init__(self, *, nodes: "typing.List[MoveEnum]", page_info: "PageInfo"): - self.nodes = nodes - self.page_info = page_info - - def __str__(self): - return "MoveEnumConnection(nodes={}, page_info={})".format(self.nodes, self.page_info) - - def __eq__(self, other): - if self.nodes != other.nodes: - return False - if self.page_info != other.page_info: - return False - return True - -class _UniffiConverterTypeMoveEnumConnection(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return MoveEnumConnection( - nodes=_UniffiConverterSequenceTypeMoveEnum.read(buf), - page_info=_UniffiConverterTypePageInfo.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterSequenceTypeMoveEnum.check_lower(value.nodes) - _UniffiConverterTypePageInfo.check_lower(value.page_info) - - @staticmethod - def write(value, buf): - _UniffiConverterSequenceTypeMoveEnum.write(value.nodes, buf) - _UniffiConverterTypePageInfo.write(value.page_info, buf) - - -class MoveEnumVariant: - fields: "typing.Optional[typing.List[MoveField]]" - name: "str" - def __init__(self, *, fields: "typing.Optional[typing.List[MoveField]]", name: "str"): - self.fields = fields - self.name = name - - def __str__(self): - return "MoveEnumVariant(fields={}, name={})".format(self.fields, self.name) - - def __eq__(self, other): - if self.fields != other.fields: - return False - if self.name != other.name: - return False - return True - -class _UniffiConverterTypeMoveEnumVariant(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return MoveEnumVariant( - fields=_UniffiConverterOptionalSequenceTypeMoveField.read(buf), - name=_UniffiConverterString.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterOptionalSequenceTypeMoveField.check_lower(value.fields) - _UniffiConverterString.check_lower(value.name) - - @staticmethod - def write(value, buf): - _UniffiConverterOptionalSequenceTypeMoveField.write(value.fields, buf) - _UniffiConverterString.write(value.name, buf) - - -class MoveField: - name: "str" - type: "typing.Optional[OpenMoveType]" - def __init__(self, *, name: "str", type: "typing.Optional[OpenMoveType]"): - self.name = name - self.type = type - - def __str__(self): - return "MoveField(name={}, type={})".format(self.name, self.type) - - def __eq__(self, other): - if self.name != other.name: - return False - if self.type != other.type: - return False - return True - -class _UniffiConverterTypeMoveField(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return MoveField( - name=_UniffiConverterString.read(buf), - type=_UniffiConverterOptionalTypeOpenMoveType.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterString.check_lower(value.name) - _UniffiConverterOptionalTypeOpenMoveType.check_lower(value.type) - - @staticmethod - def write(value, buf): - _UniffiConverterString.write(value.name, buf) - _UniffiConverterOptionalTypeOpenMoveType.write(value.type, buf) - - -class MoveFunction: - is_entry: "typing.Optional[bool]" - name: "str" - parameters: "typing.Optional[typing.List[OpenMoveType]]" - _return: "typing.Optional[typing.List[OpenMoveType]]" - type_parameters: "typing.Optional[typing.List[MoveFunctionTypeParameter]]" - visibility: "typing.Optional[MoveVisibility]" - def __init__(self, *, is_entry: "typing.Optional[bool]", name: "str", parameters: "typing.Optional[typing.List[OpenMoveType]]", _return: "typing.Optional[typing.List[OpenMoveType]]", type_parameters: "typing.Optional[typing.List[MoveFunctionTypeParameter]]", visibility: "typing.Optional[MoveVisibility]"): - self.is_entry = is_entry - self.name = name - self.parameters = parameters - self._return = _return - self.type_parameters = type_parameters - self.visibility = visibility - - def __str__(self): - return "MoveFunction(is_entry={}, name={}, parameters={}, _return={}, type_parameters={}, visibility={})".format(self.is_entry, self.name, self.parameters, self._return, self.type_parameters, self.visibility) - - def __eq__(self, other): - if self.is_entry != other.is_entry: - return False - if self.name != other.name: - return False - if self.parameters != other.parameters: - return False - if self._return != other._return: - return False - if self.type_parameters != other.type_parameters: - return False - if self.visibility != other.visibility: - return False - return True - -class _UniffiConverterTypeMoveFunction(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return MoveFunction( - is_entry=_UniffiConverterOptionalBool.read(buf), - name=_UniffiConverterString.read(buf), - parameters=_UniffiConverterOptionalSequenceTypeOpenMoveType.read(buf), - _return=_UniffiConverterOptionalSequenceTypeOpenMoveType.read(buf), - type_parameters=_UniffiConverterOptionalSequenceTypeMoveFunctionTypeParameter.read(buf), - visibility=_UniffiConverterOptionalTypeMoveVisibility.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterOptionalBool.check_lower(value.is_entry) - _UniffiConverterString.check_lower(value.name) - _UniffiConverterOptionalSequenceTypeOpenMoveType.check_lower(value.parameters) - _UniffiConverterOptionalSequenceTypeOpenMoveType.check_lower(value._return) - _UniffiConverterOptionalSequenceTypeMoveFunctionTypeParameter.check_lower(value.type_parameters) - _UniffiConverterOptionalTypeMoveVisibility.check_lower(value.visibility) - - @staticmethod - def write(value, buf): - _UniffiConverterOptionalBool.write(value.is_entry, buf) - _UniffiConverterString.write(value.name, buf) - _UniffiConverterOptionalSequenceTypeOpenMoveType.write(value.parameters, buf) - _UniffiConverterOptionalSequenceTypeOpenMoveType.write(value._return, buf) - _UniffiConverterOptionalSequenceTypeMoveFunctionTypeParameter.write(value.type_parameters, buf) - _UniffiConverterOptionalTypeMoveVisibility.write(value.visibility, buf) - - -class MoveFunctionConnection: - nodes: "typing.List[MoveFunction]" - page_info: "PageInfo" - def __init__(self, *, nodes: "typing.List[MoveFunction]", page_info: "PageInfo"): - self.nodes = nodes - self.page_info = page_info - - def __str__(self): - return "MoveFunctionConnection(nodes={}, page_info={})".format(self.nodes, self.page_info) - - def __eq__(self, other): - if self.nodes != other.nodes: - return False - if self.page_info != other.page_info: - return False - return True - -class _UniffiConverterTypeMoveFunctionConnection(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return MoveFunctionConnection( - nodes=_UniffiConverterSequenceTypeMoveFunction.read(buf), - page_info=_UniffiConverterTypePageInfo.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterSequenceTypeMoveFunction.check_lower(value.nodes) - _UniffiConverterTypePageInfo.check_lower(value.page_info) - - @staticmethod - def write(value, buf): - _UniffiConverterSequenceTypeMoveFunction.write(value.nodes, buf) - _UniffiConverterTypePageInfo.write(value.page_info, buf) - - -class MoveFunctionTypeParameter: - constraints: "typing.List[MoveAbility]" - def __init__(self, *, constraints: "typing.List[MoveAbility]"): - self.constraints = constraints - - def __str__(self): - return "MoveFunctionTypeParameter(constraints={})".format(self.constraints) - - def __eq__(self, other): - if self.constraints != other.constraints: - return False - return True - -class _UniffiConverterTypeMoveFunctionTypeParameter(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return MoveFunctionTypeParameter( - constraints=_UniffiConverterSequenceTypeMoveAbility.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterSequenceTypeMoveAbility.check_lower(value.constraints) - - @staticmethod - def write(value, buf): - _UniffiConverterSequenceTypeMoveAbility.write(value.constraints, buf) - - -class MoveModule: - file_format_version: "int" - enums: "typing.Optional[MoveEnumConnection]" - friends: "MoveModuleConnection" - functions: "typing.Optional[MoveFunctionConnection]" - structs: "typing.Optional[MoveStructConnection]" - def __init__(self, *, file_format_version: "int", enums: "typing.Optional[MoveEnumConnection]", friends: "MoveModuleConnection", functions: "typing.Optional[MoveFunctionConnection]", structs: "typing.Optional[MoveStructConnection]"): - self.file_format_version = file_format_version - self.enums = enums - self.friends = friends - self.functions = functions - self.structs = structs - - def __str__(self): - return "MoveModule(file_format_version={}, enums={}, friends={}, functions={}, structs={})".format(self.file_format_version, self.enums, self.friends, self.functions, self.structs) - - def __eq__(self, other): - if self.file_format_version != other.file_format_version: - return False - if self.enums != other.enums: - return False - if self.friends != other.friends: - return False - if self.functions != other.functions: - return False - if self.structs != other.structs: - return False - return True - -class _UniffiConverterTypeMoveModule(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return MoveModule( - file_format_version=_UniffiConverterInt32.read(buf), - enums=_UniffiConverterOptionalTypeMoveEnumConnection.read(buf), - friends=_UniffiConverterTypeMoveModuleConnection.read(buf), - functions=_UniffiConverterOptionalTypeMoveFunctionConnection.read(buf), - structs=_UniffiConverterOptionalTypeMoveStructConnection.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterInt32.check_lower(value.file_format_version) - _UniffiConverterOptionalTypeMoveEnumConnection.check_lower(value.enums) - _UniffiConverterTypeMoveModuleConnection.check_lower(value.friends) - _UniffiConverterOptionalTypeMoveFunctionConnection.check_lower(value.functions) - _UniffiConverterOptionalTypeMoveStructConnection.check_lower(value.structs) - - @staticmethod - def write(value, buf): - _UniffiConverterInt32.write(value.file_format_version, buf) - _UniffiConverterOptionalTypeMoveEnumConnection.write(value.enums, buf) - _UniffiConverterTypeMoveModuleConnection.write(value.friends, buf) - _UniffiConverterOptionalTypeMoveFunctionConnection.write(value.functions, buf) - _UniffiConverterOptionalTypeMoveStructConnection.write(value.structs, buf) - - -class MoveModule2: - name: "str" - def __init__(self, *, name: "str"): - self.name = name - - def __str__(self): - return "MoveModule2(name={})".format(self.name) - - def __eq__(self, other): - if self.name != other.name: - return False - return True - -class _UniffiConverterTypeMoveModule2(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return MoveModule2( - name=_UniffiConverterString.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterString.check_lower(value.name) - - @staticmethod - def write(value, buf): - _UniffiConverterString.write(value.name, buf) - - -class MoveModuleConnection: - nodes: "typing.List[MoveModule2]" - page_info: "PageInfo" - def __init__(self, *, nodes: "typing.List[MoveModule2]", page_info: "PageInfo"): - self.nodes = nodes - self.page_info = page_info - - def __str__(self): - return "MoveModuleConnection(nodes={}, page_info={})".format(self.nodes, self.page_info) - - def __eq__(self, other): - if self.nodes != other.nodes: - return False - if self.page_info != other.page_info: - return False - return True - -class _UniffiConverterTypeMoveModuleConnection(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return MoveModuleConnection( - nodes=_UniffiConverterSequenceTypeMoveModule2.read(buf), - page_info=_UniffiConverterTypePageInfo.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterSequenceTypeMoveModule2.check_lower(value.nodes) - _UniffiConverterTypePageInfo.check_lower(value.page_info) - - @staticmethod - def write(value, buf): - _UniffiConverterSequenceTypeMoveModule2.write(value.nodes, buf) - _UniffiConverterTypePageInfo.write(value.page_info, buf) - - -class MoveObject: - bcs: "typing.Optional[Base64]" - def __init__(self, *, bcs: "typing.Optional[Base64]"): - self.bcs = bcs - - def __str__(self): - return "MoveObject(bcs={})".format(self.bcs) - - def __eq__(self, other): - if self.bcs != other.bcs: - return False - return True - -class _UniffiConverterTypeMoveObject(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return MoveObject( - bcs=_UniffiConverterOptionalTypeBase64.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterOptionalTypeBase64.check_lower(value.bcs) - - @staticmethod - def write(value, buf): - _UniffiConverterOptionalTypeBase64.write(value.bcs, buf) - - -class MovePackagePage: - page_info: "PageInfo" - data: "typing.List[MovePackage]" - def __init__(self, *, page_info: "PageInfo", data: "typing.List[MovePackage]"): - self.page_info = page_info - self.data = data - - def __str__(self): - return "MovePackagePage(page_info={}, data={})".format(self.page_info, self.data) - - def __eq__(self, other): - if self.page_info != other.page_info: - return False - if self.data != other.data: - return False - return True - -class _UniffiConverterTypeMovePackagePage(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return MovePackagePage( - page_info=_UniffiConverterTypePageInfo.read(buf), - data=_UniffiConverterSequenceTypeMovePackage.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypePageInfo.check_lower(value.page_info) - _UniffiConverterSequenceTypeMovePackage.check_lower(value.data) - - @staticmethod - def write(value, buf): - _UniffiConverterTypePageInfo.write(value.page_info, buf) - _UniffiConverterSequenceTypeMovePackage.write(value.data, buf) - - -class MovePackageQuery: - package_bcs: "typing.Optional[Base64]" - def __init__(self, *, package_bcs: "typing.Optional[Base64]"): - self.package_bcs = package_bcs - - def __str__(self): - return "MovePackageQuery(package_bcs={})".format(self.package_bcs) - - def __eq__(self, other): - if self.package_bcs != other.package_bcs: - return False - return True - -class _UniffiConverterTypeMovePackageQuery(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return MovePackageQuery( - package_bcs=_UniffiConverterOptionalTypeBase64.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterOptionalTypeBase64.check_lower(value.package_bcs) - - @staticmethod - def write(value, buf): - _UniffiConverterOptionalTypeBase64.write(value.package_bcs, buf) - - -class MoveStruct: - abilities: "typing.Optional[typing.List[MoveAbility]]" - name: "str" - fields: "typing.Optional[typing.List[MoveField]]" - type_parameters: "typing.Optional[typing.List[MoveStructTypeParameter]]" - def __init__(self, *, abilities: "typing.Optional[typing.List[MoveAbility]]", name: "str", fields: "typing.Optional[typing.List[MoveField]]", type_parameters: "typing.Optional[typing.List[MoveStructTypeParameter]]"): - self.abilities = abilities - self.name = name - self.fields = fields - self.type_parameters = type_parameters - - def __str__(self): - return "MoveStruct(abilities={}, name={}, fields={}, type_parameters={})".format(self.abilities, self.name, self.fields, self.type_parameters) - - def __eq__(self, other): - if self.abilities != other.abilities: - return False - if self.name != other.name: - return False - if self.fields != other.fields: - return False - if self.type_parameters != other.type_parameters: - return False - return True - -class _UniffiConverterTypeMoveStruct(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return MoveStruct( - abilities=_UniffiConverterOptionalSequenceTypeMoveAbility.read(buf), - name=_UniffiConverterString.read(buf), - fields=_UniffiConverterOptionalSequenceTypeMoveField.read(buf), - type_parameters=_UniffiConverterOptionalSequenceTypeMoveStructTypeParameter.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterOptionalSequenceTypeMoveAbility.check_lower(value.abilities) - _UniffiConverterString.check_lower(value.name) - _UniffiConverterOptionalSequenceTypeMoveField.check_lower(value.fields) - _UniffiConverterOptionalSequenceTypeMoveStructTypeParameter.check_lower(value.type_parameters) - - @staticmethod - def write(value, buf): - _UniffiConverterOptionalSequenceTypeMoveAbility.write(value.abilities, buf) - _UniffiConverterString.write(value.name, buf) - _UniffiConverterOptionalSequenceTypeMoveField.write(value.fields, buf) - _UniffiConverterOptionalSequenceTypeMoveStructTypeParameter.write(value.type_parameters, buf) - - -class MoveStructConnection: - page_info: "PageInfo" - nodes: "typing.List[MoveStruct]" - def __init__(self, *, page_info: "PageInfo", nodes: "typing.List[MoveStruct]"): - self.page_info = page_info - self.nodes = nodes - - def __str__(self): - return "MoveStructConnection(page_info={}, nodes={})".format(self.page_info, self.nodes) - - def __eq__(self, other): - if self.page_info != other.page_info: - return False - if self.nodes != other.nodes: - return False - return True - -class _UniffiConverterTypeMoveStructConnection(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return MoveStructConnection( - page_info=_UniffiConverterTypePageInfo.read(buf), - nodes=_UniffiConverterSequenceTypeMoveStruct.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypePageInfo.check_lower(value.page_info) - _UniffiConverterSequenceTypeMoveStruct.check_lower(value.nodes) - - @staticmethod - def write(value, buf): - _UniffiConverterTypePageInfo.write(value.page_info, buf) - _UniffiConverterSequenceTypeMoveStruct.write(value.nodes, buf) - - -class MoveStructTypeParameter: - constraints: "typing.List[MoveAbility]" - is_phantom: "bool" - def __init__(self, *, constraints: "typing.List[MoveAbility]", is_phantom: "bool"): - self.constraints = constraints - self.is_phantom = is_phantom - - def __str__(self): - return "MoveStructTypeParameter(constraints={}, is_phantom={})".format(self.constraints, self.is_phantom) - - def __eq__(self, other): - if self.constraints != other.constraints: - return False - if self.is_phantom != other.is_phantom: - return False - return True - -class _UniffiConverterTypeMoveStructTypeParameter(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return MoveStructTypeParameter( - constraints=_UniffiConverterSequenceTypeMoveAbility.read(buf), - is_phantom=_UniffiConverterBool.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterSequenceTypeMoveAbility.check_lower(value.constraints) - _UniffiConverterBool.check_lower(value.is_phantom) - - @staticmethod - def write(value, buf): - _UniffiConverterSequenceTypeMoveAbility.write(value.constraints, buf) - _UniffiConverterBool.write(value.is_phantom, buf) - - -class ObjectFilter: - type: "typing.Optional[str]" - owner: "typing.Optional[Address]" - object_ids: "typing.Optional[typing.List[Address]]" - def __init__(self, *, type: "typing.Optional[str]", owner: "typing.Optional[Address]", object_ids: "typing.Optional[typing.List[Address]]"): - self.type = type - self.owner = owner - self.object_ids = object_ids - - def __str__(self): - return "ObjectFilter(type={}, owner={}, object_ids={})".format(self.type, self.owner, self.object_ids) - - def __eq__(self, other): - if self.type != other.type: - return False - if self.owner != other.owner: - return False - if self.object_ids != other.object_ids: - return False - return True - -class _UniffiConverterTypeObjectFilter(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return ObjectFilter( - type=_UniffiConverterOptionalString.read(buf), - owner=_UniffiConverterOptionalTypeAddress.read(buf), - object_ids=_UniffiConverterOptionalSequenceTypeAddress.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterOptionalString.check_lower(value.type) - _UniffiConverterOptionalTypeAddress.check_lower(value.owner) - _UniffiConverterOptionalSequenceTypeAddress.check_lower(value.object_ids) - - @staticmethod - def write(value, buf): - _UniffiConverterOptionalString.write(value.type, buf) - _UniffiConverterOptionalTypeAddress.write(value.owner, buf) - _UniffiConverterOptionalSequenceTypeAddress.write(value.object_ids, buf) - - -class ObjectPage: - page_info: "PageInfo" - data: "typing.List[Object]" - def __init__(self, *, page_info: "PageInfo", data: "typing.List[Object]"): - self.page_info = page_info - self.data = data - - def __str__(self): - return "ObjectPage(page_info={}, data={})".format(self.page_info, self.data) - - def __eq__(self, other): - if self.page_info != other.page_info: - return False - if self.data != other.data: - return False - return True - -class _UniffiConverterTypeObjectPage(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return ObjectPage( - page_info=_UniffiConverterTypePageInfo.read(buf), - data=_UniffiConverterSequenceTypeObject.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypePageInfo.check_lower(value.page_info) - _UniffiConverterSequenceTypeObject.check_lower(value.data) - - @staticmethod - def write(value, buf): - _UniffiConverterTypePageInfo.write(value.page_info, buf) - _UniffiConverterSequenceTypeObject.write(value.data, buf) - - -class OpenMoveType: - repr: "str" - def __init__(self, *, repr: "str"): - self.repr = repr - - def __str__(self): - return "OpenMoveType(repr={})".format(self.repr) - - def __eq__(self, other): - if self.repr != other.repr: - return False - return True - -class _UniffiConverterTypeOpenMoveType(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return OpenMoveType( - repr=_UniffiConverterString.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterString.check_lower(value.repr) - - @staticmethod - def write(value, buf): - _UniffiConverterString.write(value.repr, buf) - - -class PageInfo: - """ - Information about pagination in a connection. - """ - - has_previous_page: "bool" - """ - When paginating backwards, are there more items? - """ - - has_next_page: "bool" - """ - Are there more items when paginating forwards? - """ - - start_cursor: "typing.Optional[str]" - """ - When paginating backwards, the cursor to continue. - """ - - end_cursor: "typing.Optional[str]" - """ - When paginating forwards, the cursor to continue. - """ - - def __init__(self, *, has_previous_page: "bool", has_next_page: "bool", start_cursor: "typing.Optional[str]", end_cursor: "typing.Optional[str]"): - self.has_previous_page = has_previous_page - self.has_next_page = has_next_page - self.start_cursor = start_cursor - self.end_cursor = end_cursor - - def __str__(self): - return "PageInfo(has_previous_page={}, has_next_page={}, start_cursor={}, end_cursor={})".format(self.has_previous_page, self.has_next_page, self.start_cursor, self.end_cursor) - - def __eq__(self, other): - if self.has_previous_page != other.has_previous_page: - return False - if self.has_next_page != other.has_next_page: - return False - if self.start_cursor != other.start_cursor: - return False - if self.end_cursor != other.end_cursor: - return False - return True - -class _UniffiConverterTypePageInfo(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return PageInfo( - has_previous_page=_UniffiConverterBool.read(buf), - has_next_page=_UniffiConverterBool.read(buf), - start_cursor=_UniffiConverterOptionalString.read(buf), - end_cursor=_UniffiConverterOptionalString.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterBool.check_lower(value.has_previous_page) - _UniffiConverterBool.check_lower(value.has_next_page) - _UniffiConverterOptionalString.check_lower(value.start_cursor) - _UniffiConverterOptionalString.check_lower(value.end_cursor) - - @staticmethod - def write(value, buf): - _UniffiConverterBool.write(value.has_previous_page, buf) - _UniffiConverterBool.write(value.has_next_page, buf) - _UniffiConverterOptionalString.write(value.start_cursor, buf) - _UniffiConverterOptionalString.write(value.end_cursor, buf) - - -class PaginationFilter: - """ - Pagination options for querying the GraphQL server. It defaults to forward - pagination with the GraphQL server's max page size. - """ - - direction: "Direction" - """ - The direction of pagination. - """ - - cursor: "typing.Optional[str]" - """ - An opaque cursor used for pagination. - """ - - limit: "typing.Optional[int]" - """ - The maximum number of items to return. If this is ommitted, it will - lazily query the service configuration for the max page size. - """ - - def __init__(self, *, direction: "Direction", cursor: "typing.Optional[str]", limit: "typing.Optional[int]"): - self.direction = direction - self.cursor = cursor - self.limit = limit - - def __str__(self): - return "PaginationFilter(direction={}, cursor={}, limit={})".format(self.direction, self.cursor, self.limit) - - def __eq__(self, other): - if self.direction != other.direction: - return False - if self.cursor != other.cursor: - return False - if self.limit != other.limit: - return False - return True - -class _UniffiConverterTypePaginationFilter(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return PaginationFilter( - direction=_UniffiConverterTypeDirection.read(buf), - cursor=_UniffiConverterOptionalString.read(buf), - limit=_UniffiConverterOptionalInt32.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeDirection.check_lower(value.direction) - _UniffiConverterOptionalString.check_lower(value.cursor) - _UniffiConverterOptionalInt32.check_lower(value.limit) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeDirection.write(value.direction, buf) - _UniffiConverterOptionalString.write(value.cursor, buf) - _UniffiConverterOptionalInt32.write(value.limit, buf) - - -class PaginationFilterResponse: - after: "typing.Optional[str]" - before: "typing.Optional[str]" - first: "typing.Optional[int]" - last: "typing.Optional[int]" - def __init__(self, *, after: "typing.Optional[str]", before: "typing.Optional[str]", first: "typing.Optional[int]", last: "typing.Optional[int]"): - self.after = after - self.before = before - self.first = first - self.last = last - - def __str__(self): - return "PaginationFilterResponse(after={}, before={}, first={}, last={})".format(self.after, self.before, self.first, self.last) - - def __eq__(self, other): - if self.after != other.after: - return False - if self.before != other.before: - return False - if self.first != other.first: - return False - if self.last != other.last: - return False - return True - -class _UniffiConverterTypePaginationFilterResponse(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return PaginationFilterResponse( - after=_UniffiConverterOptionalString.read(buf), - before=_UniffiConverterOptionalString.read(buf), - first=_UniffiConverterOptionalInt32.read(buf), - last=_UniffiConverterOptionalInt32.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterOptionalString.check_lower(value.after) - _UniffiConverterOptionalString.check_lower(value.before) - _UniffiConverterOptionalInt32.check_lower(value.first) - _UniffiConverterOptionalInt32.check_lower(value.last) - - @staticmethod - def write(value, buf): - _UniffiConverterOptionalString.write(value.after, buf) - _UniffiConverterOptionalString.write(value.before, buf) - _UniffiConverterOptionalInt32.write(value.first, buf) - _UniffiConverterOptionalInt32.write(value.last, buf) - - -class ProtocolConfigAttr: - """ - A key-value protocol configuration attribute. - """ - - key: "str" - value: "typing.Optional[str]" - def __init__(self, *, key: "str", value: "typing.Optional[str]"): - self.key = key - self.value = value - - def __str__(self): - return "ProtocolConfigAttr(key={}, value={})".format(self.key, self.value) - - def __eq__(self, other): - if self.key != other.key: - return False - if self.value != other.value: - return False - return True - -class _UniffiConverterTypeProtocolConfigAttr(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return ProtocolConfigAttr( - key=_UniffiConverterString.read(buf), - value=_UniffiConverterOptionalString.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterString.check_lower(value.key) - _UniffiConverterOptionalString.check_lower(value.value) - - @staticmethod - def write(value, buf): - _UniffiConverterString.write(value.key, buf) - _UniffiConverterOptionalString.write(value.value, buf) - - -class ProtocolConfigFeatureFlag: - """ - Feature flags are a form of boolean configuration that are usually used to - gate features while they are in development. Once a lag has been enabled, it - is rare for it to be disabled. - """ - - key: "str" - value: "bool" - def __init__(self, *, key: "str", value: "bool"): - self.key = key - self.value = value - - def __str__(self): - return "ProtocolConfigFeatureFlag(key={}, value={})".format(self.key, self.value) - - def __eq__(self, other): - if self.key != other.key: - return False - if self.value != other.value: - return False - return True - -class _UniffiConverterTypeProtocolConfigFeatureFlag(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return ProtocolConfigFeatureFlag( - key=_UniffiConverterString.read(buf), - value=_UniffiConverterBool.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterString.check_lower(value.key) - _UniffiConverterBool.check_lower(value.value) - - @staticmethod - def write(value, buf): - _UniffiConverterString.write(value.key, buf) - _UniffiConverterBool.write(value.value, buf) - - -class ProtocolConfigs: - """ - Information about the configuration of the protocol. - Constants that control how the chain operates. - These can only change during protocol upgrades which happen on epoch - boundaries. - """ - - protocol_version: "int" - """ - The protocol is not required to change on every epoch boundary, so the - protocol version tracks which change to the protocol these configs - are from. - """ - - feature_flags: "typing.List[ProtocolConfigFeatureFlag]" - """ - List all available feature flags and their values. Feature flags are a - form of boolean configuration that are usually used to gate features - while they are in development. Once a flag has been enabled, it is - rare for it to be disabled. - """ - - configs: "typing.List[ProtocolConfigAttr]" - """ - List all available configurations and their values. These configurations - can take any value (but they will all be represented in string - form), and do not include feature flags. - """ - - def __init__(self, *, protocol_version: "int", feature_flags: "typing.List[ProtocolConfigFeatureFlag]", configs: "typing.List[ProtocolConfigAttr]"): - self.protocol_version = protocol_version - self.feature_flags = feature_flags - self.configs = configs - - def __str__(self): - return "ProtocolConfigs(protocol_version={}, feature_flags={}, configs={})".format(self.protocol_version, self.feature_flags, self.configs) - - def __eq__(self, other): - if self.protocol_version != other.protocol_version: - return False - if self.feature_flags != other.feature_flags: - return False - if self.configs != other.configs: - return False - return True - -class _UniffiConverterTypeProtocolConfigs(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return ProtocolConfigs( - protocol_version=_UniffiConverterUInt64.read(buf), - feature_flags=_UniffiConverterSequenceTypeProtocolConfigFeatureFlag.read(buf), - configs=_UniffiConverterSequenceTypeProtocolConfigAttr.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterUInt64.check_lower(value.protocol_version) - _UniffiConverterSequenceTypeProtocolConfigFeatureFlag.check_lower(value.feature_flags) - _UniffiConverterSequenceTypeProtocolConfigAttr.check_lower(value.configs) - - @staticmethod - def write(value, buf): - _UniffiConverterUInt64.write(value.protocol_version, buf) - _UniffiConverterSequenceTypeProtocolConfigFeatureFlag.write(value.feature_flags, buf) - _UniffiConverterSequenceTypeProtocolConfigAttr.write(value.configs, buf) - - -class ServiceConfig: - default_page_size: "int" - """ - Default number of elements allowed on a single page of a connection. - """ - - enabled_features: "typing.List[Feature]" - """ - List of all features that are enabled on this RPC service. - """ - - max_move_value_depth: "int" - """ - Maximum estimated cost of a database query used to serve a GraphQL - request. This is measured in the same units that the database uses - in EXPLAIN queries. - Maximum nesting allowed in struct fields when calculating the layout of - a single Move Type. - """ - - max_output_nodes: "int" - """ - The maximum number of output nodes in a GraphQL response. - Non-connection nodes have a count of 1, while connection nodes are - counted as the specified 'first' or 'last' number of items, or the - default_page_size as set by the server if those arguments are not - set. Counts accumulate multiplicatively down the query tree. For - example, if a query starts with a connection of first: 10 and has a - field to a connection with last: 20, the count at the second level - would be 200 nodes. This is then summed to the count of 10 nodes - at the first level, for a total of 210 nodes. - """ - - max_page_size: "int" - """ - Maximum number of elements allowed on a single page of a connection. - """ - - max_query_depth: "int" - """ - The maximum depth a GraphQL query can be to be accepted by this service. - """ - - max_query_nodes: "int" - """ - The maximum number of nodes (field names) the service will accept in a - single query. - """ - - max_query_payload_size: "int" - """ - Maximum length of a query payload string. - """ - - max_type_argument_depth: "int" - """ - Maximum nesting allowed in type arguments in Move Types resolved by this - service. - """ - - max_type_argument_width: "int" - """ - Maximum number of type arguments passed into a generic instantiation of - a Move Type resolved by this service. - """ - - max_type_nodes: "int" - """ - Maximum number of structs that need to be processed when calculating the - layout of a single Move Type. - """ - - mutation_timeout_ms: "int" - """ - Maximum time in milliseconds spent waiting for a response from fullnode - after issuing a a transaction to execute. Note that the transaction - may still succeed even in the case of a timeout. Transactions are - idempotent, so a transaction that times out should be resubmitted - until the network returns a definite response (success or failure, not - timeout). - """ - - request_timeout_ms: "int" - """ - Maximum time in milliseconds that will be spent to serve one query - request. - """ - - def __init__(self, *, default_page_size: "int", enabled_features: "typing.List[Feature]", max_move_value_depth: "int", max_output_nodes: "int", max_page_size: "int", max_query_depth: "int", max_query_nodes: "int", max_query_payload_size: "int", max_type_argument_depth: "int", max_type_argument_width: "int", max_type_nodes: "int", mutation_timeout_ms: "int", request_timeout_ms: "int"): - self.default_page_size = default_page_size - self.enabled_features = enabled_features - self.max_move_value_depth = max_move_value_depth - self.max_output_nodes = max_output_nodes - self.max_page_size = max_page_size - self.max_query_depth = max_query_depth - self.max_query_nodes = max_query_nodes - self.max_query_payload_size = max_query_payload_size - self.max_type_argument_depth = max_type_argument_depth - self.max_type_argument_width = max_type_argument_width - self.max_type_nodes = max_type_nodes - self.mutation_timeout_ms = mutation_timeout_ms - self.request_timeout_ms = request_timeout_ms - - def __str__(self): - return "ServiceConfig(default_page_size={}, enabled_features={}, max_move_value_depth={}, max_output_nodes={}, max_page_size={}, max_query_depth={}, max_query_nodes={}, max_query_payload_size={}, max_type_argument_depth={}, max_type_argument_width={}, max_type_nodes={}, mutation_timeout_ms={}, request_timeout_ms={})".format(self.default_page_size, self.enabled_features, self.max_move_value_depth, self.max_output_nodes, self.max_page_size, self.max_query_depth, self.max_query_nodes, self.max_query_payload_size, self.max_type_argument_depth, self.max_type_argument_width, self.max_type_nodes, self.mutation_timeout_ms, self.request_timeout_ms) - - def __eq__(self, other): - if self.default_page_size != other.default_page_size: - return False - if self.enabled_features != other.enabled_features: - return False - if self.max_move_value_depth != other.max_move_value_depth: - return False - if self.max_output_nodes != other.max_output_nodes: - return False - if self.max_page_size != other.max_page_size: - return False - if self.max_query_depth != other.max_query_depth: - return False - if self.max_query_nodes != other.max_query_nodes: - return False - if self.max_query_payload_size != other.max_query_payload_size: - return False - if self.max_type_argument_depth != other.max_type_argument_depth: - return False - if self.max_type_argument_width != other.max_type_argument_width: - return False - if self.max_type_nodes != other.max_type_nodes: - return False - if self.mutation_timeout_ms != other.mutation_timeout_ms: - return False - if self.request_timeout_ms != other.request_timeout_ms: - return False - return True - -class _UniffiConverterTypeServiceConfig(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return ServiceConfig( - default_page_size=_UniffiConverterInt32.read(buf), - enabled_features=_UniffiConverterSequenceTypeFeature.read(buf), - max_move_value_depth=_UniffiConverterInt32.read(buf), - max_output_nodes=_UniffiConverterInt32.read(buf), - max_page_size=_UniffiConverterInt32.read(buf), - max_query_depth=_UniffiConverterInt32.read(buf), - max_query_nodes=_UniffiConverterInt32.read(buf), - max_query_payload_size=_UniffiConverterInt32.read(buf), - max_type_argument_depth=_UniffiConverterInt32.read(buf), - max_type_argument_width=_UniffiConverterInt32.read(buf), - max_type_nodes=_UniffiConverterInt32.read(buf), - mutation_timeout_ms=_UniffiConverterInt32.read(buf), - request_timeout_ms=_UniffiConverterInt32.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterInt32.check_lower(value.default_page_size) - _UniffiConverterSequenceTypeFeature.check_lower(value.enabled_features) - _UniffiConverterInt32.check_lower(value.max_move_value_depth) - _UniffiConverterInt32.check_lower(value.max_output_nodes) - _UniffiConverterInt32.check_lower(value.max_page_size) - _UniffiConverterInt32.check_lower(value.max_query_depth) - _UniffiConverterInt32.check_lower(value.max_query_nodes) - _UniffiConverterInt32.check_lower(value.max_query_payload_size) - _UniffiConverterInt32.check_lower(value.max_type_argument_depth) - _UniffiConverterInt32.check_lower(value.max_type_argument_width) - _UniffiConverterInt32.check_lower(value.max_type_nodes) - _UniffiConverterInt32.check_lower(value.mutation_timeout_ms) - _UniffiConverterInt32.check_lower(value.request_timeout_ms) - - @staticmethod - def write(value, buf): - _UniffiConverterInt32.write(value.default_page_size, buf) - _UniffiConverterSequenceTypeFeature.write(value.enabled_features, buf) - _UniffiConverterInt32.write(value.max_move_value_depth, buf) - _UniffiConverterInt32.write(value.max_output_nodes, buf) - _UniffiConverterInt32.write(value.max_page_size, buf) - _UniffiConverterInt32.write(value.max_query_depth, buf) - _UniffiConverterInt32.write(value.max_query_nodes, buf) - _UniffiConverterInt32.write(value.max_query_payload_size, buf) - _UniffiConverterInt32.write(value.max_type_argument_depth, buf) - _UniffiConverterInt32.write(value.max_type_argument_width, buf) - _UniffiConverterInt32.write(value.max_type_nodes, buf) - _UniffiConverterInt32.write(value.mutation_timeout_ms, buf) - _UniffiConverterInt32.write(value.request_timeout_ms, buf) - - -class SignedTransactionPage: - page_info: "PageInfo" - data: "typing.List[SignedTransaction]" - def __init__(self, *, page_info: "PageInfo", data: "typing.List[SignedTransaction]"): - self.page_info = page_info - self.data = data - - def __str__(self): - return "SignedTransactionPage(page_info={}, data={})".format(self.page_info, self.data) - - def __eq__(self, other): - if self.page_info != other.page_info: - return False - if self.data != other.data: - return False - return True - -class _UniffiConverterTypeSignedTransactionPage(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return SignedTransactionPage( - page_info=_UniffiConverterTypePageInfo.read(buf), - data=_UniffiConverterSequenceTypeSignedTransaction.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypePageInfo.check_lower(value.page_info) - _UniffiConverterSequenceTypeSignedTransaction.check_lower(value.data) - - @staticmethod - def write(value, buf): - _UniffiConverterTypePageInfo.write(value.page_info, buf) - _UniffiConverterSequenceTypeSignedTransaction.write(value.data, buf) - - -class TransactionDataEffects: - tx: "SignedTransaction" - effects: "TransactionEffects" - def __init__(self, *, tx: "SignedTransaction", effects: "TransactionEffects"): - self.tx = tx - self.effects = effects - - def __str__(self): - return "TransactionDataEffects(tx={}, effects={})".format(self.tx, self.effects) - - def __eq__(self, other): - if self.tx != other.tx: - return False - if self.effects != other.effects: - return False - return True - -class _UniffiConverterTypeTransactionDataEffects(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return TransactionDataEffects( - tx=_UniffiConverterTypeSignedTransaction.read(buf), - effects=_UniffiConverterTypeTransactionEffects.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeSignedTransaction.check_lower(value.tx) - _UniffiConverterTypeTransactionEffects.check_lower(value.effects) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeSignedTransaction.write(value.tx, buf) - _UniffiConverterTypeTransactionEffects.write(value.effects, buf) - - -class TransactionDataEffectsPage: - page_info: "PageInfo" - data: "typing.List[TransactionDataEffects]" - def __init__(self, *, page_info: "PageInfo", data: "typing.List[TransactionDataEffects]"): - self.page_info = page_info - self.data = data - - def __str__(self): - return "TransactionDataEffectsPage(page_info={}, data={})".format(self.page_info, self.data) - - def __eq__(self, other): - if self.page_info != other.page_info: - return False - if self.data != other.data: - return False - return True - -class _UniffiConverterTypeTransactionDataEffectsPage(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return TransactionDataEffectsPage( - page_info=_UniffiConverterTypePageInfo.read(buf), - data=_UniffiConverterSequenceTypeTransactionDataEffects.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypePageInfo.check_lower(value.page_info) - _UniffiConverterSequenceTypeTransactionDataEffects.check_lower(value.data) - - @staticmethod - def write(value, buf): - _UniffiConverterTypePageInfo.write(value.page_info, buf) - _UniffiConverterSequenceTypeTransactionDataEffects.write(value.data, buf) - - -class TransactionEffectsPage: - page_info: "PageInfo" - data: "typing.List[TransactionEffects]" - def __init__(self, *, page_info: "PageInfo", data: "typing.List[TransactionEffects]"): - self.page_info = page_info - self.data = data - - def __str__(self): - return "TransactionEffectsPage(page_info={}, data={})".format(self.page_info, self.data) - - def __eq__(self, other): - if self.page_info != other.page_info: - return False - if self.data != other.data: - return False - return True - -class _UniffiConverterTypeTransactionEffectsPage(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return TransactionEffectsPage( - page_info=_UniffiConverterTypePageInfo.read(buf), - data=_UniffiConverterSequenceTypeTransactionEffects.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypePageInfo.check_lower(value.page_info) - _UniffiConverterSequenceTypeTransactionEffects.check_lower(value.data) - - @staticmethod - def write(value, buf): - _UniffiConverterTypePageInfo.write(value.page_info, buf) - _UniffiConverterSequenceTypeTransactionEffects.write(value.data, buf) - - -class TransactionEvent: - event: "Event" - digest: "TransactionDigest" - def __init__(self, *, event: "Event", digest: "TransactionDigest"): - self.event = event - self.digest = digest - - def __str__(self): - return "TransactionEvent(event={}, digest={})".format(self.event, self.digest) - - def __eq__(self, other): - if self.event != other.event: - return False - if self.digest != other.digest: - return False - return True - -class _UniffiConverterTypeTransactionEvent(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return TransactionEvent( - event=_UniffiConverterTypeEvent.read(buf), - digest=_UniffiConverterTypeTransactionDigest.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeEvent.check_lower(value.event) - _UniffiConverterTypeTransactionDigest.check_lower(value.digest) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeEvent.write(value.event, buf) - _UniffiConverterTypeTransactionDigest.write(value.digest, buf) - - -class TransactionEventPage: - page_info: "PageInfo" - data: "typing.List[TransactionEvent]" - def __init__(self, *, page_info: "PageInfo", data: "typing.List[TransactionEvent]"): - self.page_info = page_info - self.data = data - - def __str__(self): - return "TransactionEventPage(page_info={}, data={})".format(self.page_info, self.data) - - def __eq__(self, other): - if self.page_info != other.page_info: - return False - if self.data != other.data: - return False - return True - -class _UniffiConverterTypeTransactionEventPage(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return TransactionEventPage( - page_info=_UniffiConverterTypePageInfo.read(buf), - data=_UniffiConverterSequenceTypeTransactionEvent.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypePageInfo.check_lower(value.page_info) - _UniffiConverterSequenceTypeTransactionEvent.check_lower(value.data) - - @staticmethod - def write(value, buf): - _UniffiConverterTypePageInfo.write(value.page_info, buf) - _UniffiConverterSequenceTypeTransactionEvent.write(value.data, buf) - - -class TransactionsFilter: - function: "typing.Optional[str]" - kind: "typing.Optional[TransactionBlockKindInput]" - after_checkpoint: "typing.Optional[int]" - at_checkpoint: "typing.Optional[int]" - before_checkpoint: "typing.Optional[int]" - affected_address: "typing.Optional[Address]" - sent_address: "typing.Optional[Address]" - input_object: "typing.Optional[Address]" - changed_object: "typing.Optional[Address]" - transaction_ids: "typing.Optional[typing.List[str]]" - def __init__(self, *, function: "typing.Optional[str]", kind: "typing.Optional[TransactionBlockKindInput]", after_checkpoint: "typing.Optional[int]", at_checkpoint: "typing.Optional[int]", before_checkpoint: "typing.Optional[int]", affected_address: "typing.Optional[Address]", sent_address: "typing.Optional[Address]", input_object: "typing.Optional[Address]", changed_object: "typing.Optional[Address]", transaction_ids: "typing.Optional[typing.List[str]]"): - self.function = function - self.kind = kind - self.after_checkpoint = after_checkpoint - self.at_checkpoint = at_checkpoint - self.before_checkpoint = before_checkpoint - self.affected_address = affected_address - self.sent_address = sent_address - self.input_object = input_object - self.changed_object = changed_object - self.transaction_ids = transaction_ids - - def __str__(self): - return "TransactionsFilter(function={}, kind={}, after_checkpoint={}, at_checkpoint={}, before_checkpoint={}, affected_address={}, sent_address={}, input_object={}, changed_object={}, transaction_ids={})".format(self.function, self.kind, self.after_checkpoint, self.at_checkpoint, self.before_checkpoint, self.affected_address, self.sent_address, self.input_object, self.changed_object, self.transaction_ids) - - def __eq__(self, other): - if self.function != other.function: - return False - if self.kind != other.kind: - return False - if self.after_checkpoint != other.after_checkpoint: - return False - if self.at_checkpoint != other.at_checkpoint: - return False - if self.before_checkpoint != other.before_checkpoint: - return False - if self.affected_address != other.affected_address: - return False - if self.sent_address != other.sent_address: - return False - if self.input_object != other.input_object: - return False - if self.changed_object != other.changed_object: - return False - if self.transaction_ids != other.transaction_ids: - return False - return True - -class _UniffiConverterTypeTransactionsFilter(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return TransactionsFilter( - function=_UniffiConverterOptionalString.read(buf), - kind=_UniffiConverterOptionalTypeTransactionBlockKindInput.read(buf), - after_checkpoint=_UniffiConverterOptionalUInt64.read(buf), - at_checkpoint=_UniffiConverterOptionalUInt64.read(buf), - before_checkpoint=_UniffiConverterOptionalUInt64.read(buf), - affected_address=_UniffiConverterOptionalTypeAddress.read(buf), - sent_address=_UniffiConverterOptionalTypeAddress.read(buf), - input_object=_UniffiConverterOptionalTypeAddress.read(buf), - changed_object=_UniffiConverterOptionalTypeAddress.read(buf), - transaction_ids=_UniffiConverterOptionalSequenceString.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterOptionalString.check_lower(value.function) - _UniffiConverterOptionalTypeTransactionBlockKindInput.check_lower(value.kind) - _UniffiConverterOptionalUInt64.check_lower(value.after_checkpoint) - _UniffiConverterOptionalUInt64.check_lower(value.at_checkpoint) - _UniffiConverterOptionalUInt64.check_lower(value.before_checkpoint) - _UniffiConverterOptionalTypeAddress.check_lower(value.affected_address) - _UniffiConverterOptionalTypeAddress.check_lower(value.sent_address) - _UniffiConverterOptionalTypeAddress.check_lower(value.input_object) - _UniffiConverterOptionalTypeAddress.check_lower(value.changed_object) - _UniffiConverterOptionalSequenceString.check_lower(value.transaction_ids) - - @staticmethod - def write(value, buf): - _UniffiConverterOptionalString.write(value.function, buf) - _UniffiConverterOptionalTypeTransactionBlockKindInput.write(value.kind, buf) - _UniffiConverterOptionalUInt64.write(value.after_checkpoint, buf) - _UniffiConverterOptionalUInt64.write(value.at_checkpoint, buf) - _UniffiConverterOptionalUInt64.write(value.before_checkpoint, buf) - _UniffiConverterOptionalTypeAddress.write(value.affected_address, buf) - _UniffiConverterOptionalTypeAddress.write(value.sent_address, buf) - _UniffiConverterOptionalTypeAddress.write(value.input_object, buf) - _UniffiConverterOptionalTypeAddress.write(value.changed_object, buf) - _UniffiConverterOptionalSequenceString.write(value.transaction_ids, buf) - - -class Validator: - """ - Represents a validator in the system. - """ - - apy: "typing.Optional[int]" - """ - The APY of this validator in basis points. - To get the APY in percentage, divide by 100. - """ - - address: "GqlAddress" - """ - The validator's address. - """ - - commission_rate: "typing.Optional[int]" - """ - The fee charged by the validator for staking services. - """ - - credentials: "typing.Optional[ValidatorCredentials]" - """ - Validator's credentials. - """ - - description: "typing.Optional[str]" - """ - Validator's description. - """ - - exchange_rates_size: "typing.Optional[int]" - """ - Number of exchange rates in the table. - """ - - gas_price: "typing.Optional[BigInt]" - """ - The reference gas price for this epoch. - """ - - name: "typing.Optional[str]" - """ - Validator's name. - """ - - image_url: "typing.Optional[str]" - """ - Validator's url containing their custom image. - """ - - next_epoch_commission_rate: "typing.Optional[int]" - """ - The proposed next epoch fee for the validator's staking services. - """ - - next_epoch_credentials: "typing.Optional[ValidatorCredentials]" - """ - Validator's credentials for the next epoch. - """ - - next_epoch_gas_price: "typing.Optional[BigInt]" - """ - The validator's gas price quote for the next epoch. - """ - - next_epoch_stake: "typing.Optional[BigInt]" - """ - The total number of IOTA tokens in this pool plus - the pending stake amount for this epoch. - """ - - operation_cap: "typing.Optional[MoveObject]" - """ - The validator's current valid `Cap` object. Validators can delegate - the operation ability to another address. The address holding this `Cap` - object can then update the reference gas price and tallying rule on - behalf of the validator. - """ - - pending_pool_token_withdraw: "typing.Optional[BigInt]" - """ - Pending pool token withdrawn during the current epoch, emptied at epoch - boundaries. - """ - - pending_stake: "typing.Optional[BigInt]" - """ - Pending stake amount for this epoch. - """ - - pending_total_iota_withdraw: "typing.Optional[BigInt]" - """ - Pending stake withdrawn during the current epoch, emptied at epoch - boundaries. - """ - - pool_token_balance: "typing.Optional[BigInt]" - """ - Total number of pool tokens issued by the pool. - """ - - project_url: "typing.Optional[str]" - """ - Validator's homepage URL. - """ - - rewards_pool: "typing.Optional[BigInt]" - """ - The epoch stake rewards will be added here at the end of each epoch. - """ - - staking_pool_activation_epoch: "typing.Optional[int]" - """ - The epoch at which this pool became active. - """ - - staking_pool_id: "Address" - """ - The ID of this validator's `0x3::staking_pool::StakingPool`. - """ - - staking_pool_iota_balance: "typing.Optional[BigInt]" - """ - The total number of IOTA tokens in this pool. - """ - - voting_power: "typing.Optional[int]" - """ - The voting power of this validator in basis points (e.g., 100 = 1% - voting power). - """ - - def __init__(self, *, apy: "typing.Optional[int]", address: "GqlAddress", commission_rate: "typing.Optional[int]", credentials: "typing.Optional[ValidatorCredentials]", description: "typing.Optional[str]", exchange_rates_size: "typing.Optional[int]", gas_price: "typing.Optional[BigInt]", name: "typing.Optional[str]", image_url: "typing.Optional[str]", next_epoch_commission_rate: "typing.Optional[int]", next_epoch_credentials: "typing.Optional[ValidatorCredentials]", next_epoch_gas_price: "typing.Optional[BigInt]", next_epoch_stake: "typing.Optional[BigInt]", operation_cap: "typing.Optional[MoveObject]", pending_pool_token_withdraw: "typing.Optional[BigInt]", pending_stake: "typing.Optional[BigInt]", pending_total_iota_withdraw: "typing.Optional[BigInt]", pool_token_balance: "typing.Optional[BigInt]", project_url: "typing.Optional[str]", rewards_pool: "typing.Optional[BigInt]", staking_pool_activation_epoch: "typing.Optional[int]", staking_pool_id: "Address", staking_pool_iota_balance: "typing.Optional[BigInt]", voting_power: "typing.Optional[int]"): - self.apy = apy - self.address = address - self.commission_rate = commission_rate - self.credentials = credentials - self.description = description - self.exchange_rates_size = exchange_rates_size - self.gas_price = gas_price - self.name = name - self.image_url = image_url - self.next_epoch_commission_rate = next_epoch_commission_rate - self.next_epoch_credentials = next_epoch_credentials - self.next_epoch_gas_price = next_epoch_gas_price - self.next_epoch_stake = next_epoch_stake - self.operation_cap = operation_cap - self.pending_pool_token_withdraw = pending_pool_token_withdraw - self.pending_stake = pending_stake - self.pending_total_iota_withdraw = pending_total_iota_withdraw - self.pool_token_balance = pool_token_balance - self.project_url = project_url - self.rewards_pool = rewards_pool - self.staking_pool_activation_epoch = staking_pool_activation_epoch - self.staking_pool_id = staking_pool_id - self.staking_pool_iota_balance = staking_pool_iota_balance - self.voting_power = voting_power - - def __str__(self): - return "Validator(apy={}, address={}, commission_rate={}, credentials={}, description={}, exchange_rates_size={}, gas_price={}, name={}, image_url={}, next_epoch_commission_rate={}, next_epoch_credentials={}, next_epoch_gas_price={}, next_epoch_stake={}, operation_cap={}, pending_pool_token_withdraw={}, pending_stake={}, pending_total_iota_withdraw={}, pool_token_balance={}, project_url={}, rewards_pool={}, staking_pool_activation_epoch={}, staking_pool_id={}, staking_pool_iota_balance={}, voting_power={})".format(self.apy, self.address, self.commission_rate, self.credentials, self.description, self.exchange_rates_size, self.gas_price, self.name, self.image_url, self.next_epoch_commission_rate, self.next_epoch_credentials, self.next_epoch_gas_price, self.next_epoch_stake, self.operation_cap, self.pending_pool_token_withdraw, self.pending_stake, self.pending_total_iota_withdraw, self.pool_token_balance, self.project_url, self.rewards_pool, self.staking_pool_activation_epoch, self.staking_pool_id, self.staking_pool_iota_balance, self.voting_power) - - def __eq__(self, other): - if self.apy != other.apy: - return False - if self.address != other.address: - return False - if self.commission_rate != other.commission_rate: - return False - if self.credentials != other.credentials: - return False - if self.description != other.description: - return False - if self.exchange_rates_size != other.exchange_rates_size: - return False - if self.gas_price != other.gas_price: - return False - if self.name != other.name: - return False - if self.image_url != other.image_url: - return False - if self.next_epoch_commission_rate != other.next_epoch_commission_rate: - return False - if self.next_epoch_credentials != other.next_epoch_credentials: - return False - if self.next_epoch_gas_price != other.next_epoch_gas_price: - return False - if self.next_epoch_stake != other.next_epoch_stake: - return False - if self.operation_cap != other.operation_cap: - return False - if self.pending_pool_token_withdraw != other.pending_pool_token_withdraw: - return False - if self.pending_stake != other.pending_stake: - return False - if self.pending_total_iota_withdraw != other.pending_total_iota_withdraw: - return False - if self.pool_token_balance != other.pool_token_balance: - return False - if self.project_url != other.project_url: - return False - if self.rewards_pool != other.rewards_pool: - return False - if self.staking_pool_activation_epoch != other.staking_pool_activation_epoch: - return False - if self.staking_pool_id != other.staking_pool_id: - return False - if self.staking_pool_iota_balance != other.staking_pool_iota_balance: - return False - if self.voting_power != other.voting_power: - return False - return True - -class _UniffiConverterTypeValidator(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return Validator( - apy=_UniffiConverterOptionalInt32.read(buf), - address=_UniffiConverterTypeGqlAddress.read(buf), - commission_rate=_UniffiConverterOptionalInt32.read(buf), - credentials=_UniffiConverterOptionalTypeValidatorCredentials.read(buf), - description=_UniffiConverterOptionalString.read(buf), - exchange_rates_size=_UniffiConverterOptionalUInt64.read(buf), - gas_price=_UniffiConverterOptionalTypeBigInt.read(buf), - name=_UniffiConverterOptionalString.read(buf), - image_url=_UniffiConverterOptionalString.read(buf), - next_epoch_commission_rate=_UniffiConverterOptionalInt32.read(buf), - next_epoch_credentials=_UniffiConverterOptionalTypeValidatorCredentials.read(buf), - next_epoch_gas_price=_UniffiConverterOptionalTypeBigInt.read(buf), - next_epoch_stake=_UniffiConverterOptionalTypeBigInt.read(buf), - operation_cap=_UniffiConverterOptionalTypeMoveObject.read(buf), - pending_pool_token_withdraw=_UniffiConverterOptionalTypeBigInt.read(buf), - pending_stake=_UniffiConverterOptionalTypeBigInt.read(buf), - pending_total_iota_withdraw=_UniffiConverterOptionalTypeBigInt.read(buf), - pool_token_balance=_UniffiConverterOptionalTypeBigInt.read(buf), - project_url=_UniffiConverterOptionalString.read(buf), - rewards_pool=_UniffiConverterOptionalTypeBigInt.read(buf), - staking_pool_activation_epoch=_UniffiConverterOptionalUInt64.read(buf), - staking_pool_id=_UniffiConverterTypeAddress.read(buf), - staking_pool_iota_balance=_UniffiConverterOptionalTypeBigInt.read(buf), - voting_power=_UniffiConverterOptionalInt32.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterOptionalInt32.check_lower(value.apy) - _UniffiConverterTypeGqlAddress.check_lower(value.address) - _UniffiConverterOptionalInt32.check_lower(value.commission_rate) - _UniffiConverterOptionalTypeValidatorCredentials.check_lower(value.credentials) - _UniffiConverterOptionalString.check_lower(value.description) - _UniffiConverterOptionalUInt64.check_lower(value.exchange_rates_size) - _UniffiConverterOptionalTypeBigInt.check_lower(value.gas_price) - _UniffiConverterOptionalString.check_lower(value.name) - _UniffiConverterOptionalString.check_lower(value.image_url) - _UniffiConverterOptionalInt32.check_lower(value.next_epoch_commission_rate) - _UniffiConverterOptionalTypeValidatorCredentials.check_lower(value.next_epoch_credentials) - _UniffiConverterOptionalTypeBigInt.check_lower(value.next_epoch_gas_price) - _UniffiConverterOptionalTypeBigInt.check_lower(value.next_epoch_stake) - _UniffiConverterOptionalTypeMoveObject.check_lower(value.operation_cap) - _UniffiConverterOptionalTypeBigInt.check_lower(value.pending_pool_token_withdraw) - _UniffiConverterOptionalTypeBigInt.check_lower(value.pending_stake) - _UniffiConverterOptionalTypeBigInt.check_lower(value.pending_total_iota_withdraw) - _UniffiConverterOptionalTypeBigInt.check_lower(value.pool_token_balance) - _UniffiConverterOptionalString.check_lower(value.project_url) - _UniffiConverterOptionalTypeBigInt.check_lower(value.rewards_pool) - _UniffiConverterOptionalUInt64.check_lower(value.staking_pool_activation_epoch) - _UniffiConverterTypeAddress.check_lower(value.staking_pool_id) - _UniffiConverterOptionalTypeBigInt.check_lower(value.staking_pool_iota_balance) - _UniffiConverterOptionalInt32.check_lower(value.voting_power) - - @staticmethod - def write(value, buf): - _UniffiConverterOptionalInt32.write(value.apy, buf) - _UniffiConverterTypeGqlAddress.write(value.address, buf) - _UniffiConverterOptionalInt32.write(value.commission_rate, buf) - _UniffiConverterOptionalTypeValidatorCredentials.write(value.credentials, buf) - _UniffiConverterOptionalString.write(value.description, buf) - _UniffiConverterOptionalUInt64.write(value.exchange_rates_size, buf) - _UniffiConverterOptionalTypeBigInt.write(value.gas_price, buf) - _UniffiConverterOptionalString.write(value.name, buf) - _UniffiConverterOptionalString.write(value.image_url, buf) - _UniffiConverterOptionalInt32.write(value.next_epoch_commission_rate, buf) - _UniffiConverterOptionalTypeValidatorCredentials.write(value.next_epoch_credentials, buf) - _UniffiConverterOptionalTypeBigInt.write(value.next_epoch_gas_price, buf) - _UniffiConverterOptionalTypeBigInt.write(value.next_epoch_stake, buf) - _UniffiConverterOptionalTypeMoveObject.write(value.operation_cap, buf) - _UniffiConverterOptionalTypeBigInt.write(value.pending_pool_token_withdraw, buf) - _UniffiConverterOptionalTypeBigInt.write(value.pending_stake, buf) - _UniffiConverterOptionalTypeBigInt.write(value.pending_total_iota_withdraw, buf) - _UniffiConverterOptionalTypeBigInt.write(value.pool_token_balance, buf) - _UniffiConverterOptionalString.write(value.project_url, buf) - _UniffiConverterOptionalTypeBigInt.write(value.rewards_pool, buf) - _UniffiConverterOptionalUInt64.write(value.staking_pool_activation_epoch, buf) - _UniffiConverterTypeAddress.write(value.staking_pool_id, buf) - _UniffiConverterOptionalTypeBigInt.write(value.staking_pool_iota_balance, buf) - _UniffiConverterOptionalInt32.write(value.voting_power, buf) - - -class ValidatorCredentials: - """ - The credentials related fields associated with a validator. - """ - - protocol_pub_key: "typing.Optional[Base64]" - network_pub_key: "typing.Optional[Base64]" - worker_pub_key: "typing.Optional[Base64]" - proof_of_possession: "typing.Optional[Base64]" - net_address: "typing.Optional[str]" - primary_address: "typing.Optional[str]" - worker_address: "typing.Optional[str]" - def __init__(self, *, protocol_pub_key: "typing.Optional[Base64]", network_pub_key: "typing.Optional[Base64]", worker_pub_key: "typing.Optional[Base64]", proof_of_possession: "typing.Optional[Base64]", net_address: "typing.Optional[str]", primary_address: "typing.Optional[str]", worker_address: "typing.Optional[str]"): - self.protocol_pub_key = protocol_pub_key - self.network_pub_key = network_pub_key - self.worker_pub_key = worker_pub_key - self.proof_of_possession = proof_of_possession - self.net_address = net_address - self.primary_address = primary_address - self.worker_address = worker_address - - def __str__(self): - return "ValidatorCredentials(protocol_pub_key={}, network_pub_key={}, worker_pub_key={}, proof_of_possession={}, net_address={}, primary_address={}, worker_address={})".format(self.protocol_pub_key, self.network_pub_key, self.worker_pub_key, self.proof_of_possession, self.net_address, self.primary_address, self.worker_address) - - def __eq__(self, other): - if self.protocol_pub_key != other.protocol_pub_key: - return False - if self.network_pub_key != other.network_pub_key: - return False - if self.worker_pub_key != other.worker_pub_key: - return False - if self.proof_of_possession != other.proof_of_possession: - return False - if self.net_address != other.net_address: - return False - if self.primary_address != other.primary_address: - return False - if self.worker_address != other.worker_address: - return False - return True - -class _UniffiConverterTypeValidatorCredentials(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return ValidatorCredentials( - protocol_pub_key=_UniffiConverterOptionalTypeBase64.read(buf), - network_pub_key=_UniffiConverterOptionalTypeBase64.read(buf), - worker_pub_key=_UniffiConverterOptionalTypeBase64.read(buf), - proof_of_possession=_UniffiConverterOptionalTypeBase64.read(buf), - net_address=_UniffiConverterOptionalString.read(buf), - primary_address=_UniffiConverterOptionalString.read(buf), - worker_address=_UniffiConverterOptionalString.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterOptionalTypeBase64.check_lower(value.protocol_pub_key) - _UniffiConverterOptionalTypeBase64.check_lower(value.network_pub_key) - _UniffiConverterOptionalTypeBase64.check_lower(value.worker_pub_key) - _UniffiConverterOptionalTypeBase64.check_lower(value.proof_of_possession) - _UniffiConverterOptionalString.check_lower(value.net_address) - _UniffiConverterOptionalString.check_lower(value.primary_address) - _UniffiConverterOptionalString.check_lower(value.worker_address) - - @staticmethod - def write(value, buf): - _UniffiConverterOptionalTypeBase64.write(value.protocol_pub_key, buf) - _UniffiConverterOptionalTypeBase64.write(value.network_pub_key, buf) - _UniffiConverterOptionalTypeBase64.write(value.worker_pub_key, buf) - _UniffiConverterOptionalTypeBase64.write(value.proof_of_possession, buf) - _UniffiConverterOptionalString.write(value.net_address, buf) - _UniffiConverterOptionalString.write(value.primary_address, buf) - _UniffiConverterOptionalString.write(value.worker_address, buf) - - -class ValidatorPage: - page_info: "PageInfo" - data: "typing.List[Validator]" - def __init__(self, *, page_info: "PageInfo", data: "typing.List[Validator]"): - self.page_info = page_info - self.data = data - - def __str__(self): - return "ValidatorPage(page_info={}, data={})".format(self.page_info, self.data) - - def __eq__(self, other): - if self.page_info != other.page_info: - return False - if self.data != other.data: - return False - return True - -class _UniffiConverterTypeValidatorPage(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return ValidatorPage( - page_info=_UniffiConverterTypePageInfo.read(buf), - data=_UniffiConverterSequenceTypeValidator.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypePageInfo.check_lower(value.page_info) - _UniffiConverterSequenceTypeValidator.check_lower(value.data) - - @staticmethod - def write(value, buf): - _UniffiConverterTypePageInfo.write(value.page_info, buf) - _UniffiConverterSequenceTypeValidator.write(value.data, buf) - - -class ValidatorSet: - inactive_pools_id: "typing.Optional[Address]" - """ - Object ID of the `Table` storing the inactive staking pools. - """ - - inactive_pools_size: "typing.Optional[int]" - """ - Size of the inactive pools `Table`. - """ - - pending_active_validators_id: "typing.Optional[Address]" - """ - Object ID of the wrapped object `TableVec` storing the pending active - validators. - """ - - pending_active_validators_size: "typing.Optional[int]" - """ - Size of the pending active validators table. - """ - - pending_removals: "typing.Optional[typing.List[int]]" - """ - Validators that are pending removal from the active validator set, - expressed as indices in to `activeValidators`. - """ - - staking_pool_mappings_id: "typing.Optional[Address]" - """ - Object ID of the `Table` storing the mapping from staking pool ids to - the addresses of the corresponding validators. This is needed - because a validator's address can potentially change but the object - ID of its pool will not. - """ - - staking_pool_mappings_size: "typing.Optional[int]" - """ - Size of the stake pool mappings `Table`. - """ - - total_stake: "typing.Optional[BigInt]" - """ - Total amount of stake for all active validators at the beginning of the - epoch. - """ - - validator_candidates_size: "typing.Optional[int]" - """ - Size of the validator candidates `Table`. - """ - - validator_candidates_id: "typing.Optional[Address]" - """ - Object ID of the `Table` storing the validator candidates. - """ - - def __init__(self, *, inactive_pools_id: "typing.Optional[Address]", inactive_pools_size: "typing.Optional[int]", pending_active_validators_id: "typing.Optional[Address]", pending_active_validators_size: "typing.Optional[int]", pending_removals: "typing.Optional[typing.List[int]]", staking_pool_mappings_id: "typing.Optional[Address]", staking_pool_mappings_size: "typing.Optional[int]", total_stake: "typing.Optional[BigInt]", validator_candidates_size: "typing.Optional[int]", validator_candidates_id: "typing.Optional[Address]"): - self.inactive_pools_id = inactive_pools_id - self.inactive_pools_size = inactive_pools_size - self.pending_active_validators_id = pending_active_validators_id - self.pending_active_validators_size = pending_active_validators_size - self.pending_removals = pending_removals - self.staking_pool_mappings_id = staking_pool_mappings_id - self.staking_pool_mappings_size = staking_pool_mappings_size - self.total_stake = total_stake - self.validator_candidates_size = validator_candidates_size - self.validator_candidates_id = validator_candidates_id - - def __str__(self): - return "ValidatorSet(inactive_pools_id={}, inactive_pools_size={}, pending_active_validators_id={}, pending_active_validators_size={}, pending_removals={}, staking_pool_mappings_id={}, staking_pool_mappings_size={}, total_stake={}, validator_candidates_size={}, validator_candidates_id={})".format(self.inactive_pools_id, self.inactive_pools_size, self.pending_active_validators_id, self.pending_active_validators_size, self.pending_removals, self.staking_pool_mappings_id, self.staking_pool_mappings_size, self.total_stake, self.validator_candidates_size, self.validator_candidates_id) - - def __eq__(self, other): - if self.inactive_pools_id != other.inactive_pools_id: - return False - if self.inactive_pools_size != other.inactive_pools_size: - return False - if self.pending_active_validators_id != other.pending_active_validators_id: - return False - if self.pending_active_validators_size != other.pending_active_validators_size: - return False - if self.pending_removals != other.pending_removals: - return False - if self.staking_pool_mappings_id != other.staking_pool_mappings_id: - return False - if self.staking_pool_mappings_size != other.staking_pool_mappings_size: - return False - if self.total_stake != other.total_stake: - return False - if self.validator_candidates_size != other.validator_candidates_size: - return False - if self.validator_candidates_id != other.validator_candidates_id: - return False - return True - -class _UniffiConverterTypeValidatorSet(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return ValidatorSet( - inactive_pools_id=_UniffiConverterOptionalTypeAddress.read(buf), - inactive_pools_size=_UniffiConverterOptionalInt32.read(buf), - pending_active_validators_id=_UniffiConverterOptionalTypeAddress.read(buf), - pending_active_validators_size=_UniffiConverterOptionalInt32.read(buf), - pending_removals=_UniffiConverterOptionalSequenceInt32.read(buf), - staking_pool_mappings_id=_UniffiConverterOptionalTypeAddress.read(buf), - staking_pool_mappings_size=_UniffiConverterOptionalInt32.read(buf), - total_stake=_UniffiConverterOptionalTypeBigInt.read(buf), - validator_candidates_size=_UniffiConverterOptionalInt32.read(buf), - validator_candidates_id=_UniffiConverterOptionalTypeAddress.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterOptionalTypeAddress.check_lower(value.inactive_pools_id) - _UniffiConverterOptionalInt32.check_lower(value.inactive_pools_size) - _UniffiConverterOptionalTypeAddress.check_lower(value.pending_active_validators_id) - _UniffiConverterOptionalInt32.check_lower(value.pending_active_validators_size) - _UniffiConverterOptionalSequenceInt32.check_lower(value.pending_removals) - _UniffiConverterOptionalTypeAddress.check_lower(value.staking_pool_mappings_id) - _UniffiConverterOptionalInt32.check_lower(value.staking_pool_mappings_size) - _UniffiConverterOptionalTypeBigInt.check_lower(value.total_stake) - _UniffiConverterOptionalInt32.check_lower(value.validator_candidates_size) - _UniffiConverterOptionalTypeAddress.check_lower(value.validator_candidates_id) - - @staticmethod - def write(value, buf): - _UniffiConverterOptionalTypeAddress.write(value.inactive_pools_id, buf) - _UniffiConverterOptionalInt32.write(value.inactive_pools_size, buf) - _UniffiConverterOptionalTypeAddress.write(value.pending_active_validators_id, buf) - _UniffiConverterOptionalInt32.write(value.pending_active_validators_size, buf) - _UniffiConverterOptionalSequenceInt32.write(value.pending_removals, buf) - _UniffiConverterOptionalTypeAddress.write(value.staking_pool_mappings_id, buf) - _UniffiConverterOptionalInt32.write(value.staking_pool_mappings_size, buf) - _UniffiConverterOptionalTypeBigInt.write(value.total_stake, buf) - _UniffiConverterOptionalInt32.write(value.validator_candidates_size, buf) - _UniffiConverterOptionalTypeAddress.write(value.validator_candidates_id, buf) - - - - - -class Direction(enum.Enum): - """ - Pagination direction. - """ - - FORWARD = 0 - - BACKWARD = 1 - - - -class _UniffiConverterTypeDirection(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return Direction.FORWARD - if variant == 2: - return Direction.BACKWARD - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value == Direction.FORWARD: - return - if value == Direction.BACKWARD: - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value == Direction.FORWARD: - buf.write_i32(1) - if value == Direction.BACKWARD: - buf.write_i32(2) - - - - - - - -class Feature(enum.Enum): - ANALYTICS = 0 - - COINS = 1 - - DYNAMIC_FIELDS = 2 - - NAME_SERVICE = 3 - - SUBSCRIPTIONS = 4 - - SYSTEM_STATE = 5 - - MOVE_REGISTRY = 6 - - - -class _UniffiConverterTypeFeature(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return Feature.ANALYTICS - if variant == 2: - return Feature.COINS - if variant == 3: - return Feature.DYNAMIC_FIELDS - if variant == 4: - return Feature.NAME_SERVICE - if variant == 5: - return Feature.SUBSCRIPTIONS - if variant == 6: - return Feature.SYSTEM_STATE - if variant == 7: - return Feature.MOVE_REGISTRY - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value == Feature.ANALYTICS: - return - if value == Feature.COINS: - return - if value == Feature.DYNAMIC_FIELDS: - return - if value == Feature.NAME_SERVICE: - return - if value == Feature.SUBSCRIPTIONS: - return - if value == Feature.SYSTEM_STATE: - return - if value == Feature.MOVE_REGISTRY: - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value == Feature.ANALYTICS: - buf.write_i32(1) - if value == Feature.COINS: - buf.write_i32(2) - if value == Feature.DYNAMIC_FIELDS: - buf.write_i32(3) - if value == Feature.NAME_SERVICE: - buf.write_i32(4) - if value == Feature.SUBSCRIPTIONS: - buf.write_i32(5) - if value == Feature.SYSTEM_STATE: - buf.write_i32(6) - if value == Feature.MOVE_REGISTRY: - buf.write_i32(7) - - - - - - - -class Kind(enum.Enum): - DESERIALIZATION = 0 - - PARSE = 1 - - QUERY = 2 - - OTHER = 3 - - - -class _UniffiConverterTypeKind(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return Kind.DESERIALIZATION - if variant == 2: - return Kind.PARSE - if variant == 3: - return Kind.QUERY - if variant == 4: - return Kind.OTHER - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value == Kind.DESERIALIZATION: - return - if value == Kind.PARSE: - return - if value == Kind.QUERY: - return - if value == Kind.OTHER: - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value == Kind.DESERIALIZATION: - buf.write_i32(1) - if value == Kind.PARSE: - buf.write_i32(2) - if value == Kind.QUERY: - buf.write_i32(3) - if value == Kind.OTHER: - buf.write_i32(4) - - - - - - - -class MoveAbility(enum.Enum): - COPY = 0 - - DROP = 1 - - KEY = 2 - - STORE = 3 - - - -class _UniffiConverterTypeMoveAbility(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return MoveAbility.COPY - if variant == 2: - return MoveAbility.DROP - if variant == 3: - return MoveAbility.KEY - if variant == 4: - return MoveAbility.STORE - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value == MoveAbility.COPY: - return - if value == MoveAbility.DROP: - return - if value == MoveAbility.KEY: - return - if value == MoveAbility.STORE: - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value == MoveAbility.COPY: - buf.write_i32(1) - if value == MoveAbility.DROP: - buf.write_i32(2) - if value == MoveAbility.KEY: - buf.write_i32(3) - if value == MoveAbility.STORE: - buf.write_i32(4) - - - - - - - -class MoveVisibility(enum.Enum): - PUBLIC = 0 - - PRIVATE = 1 - - FRIEND = 2 - - - -class _UniffiConverterTypeMoveVisibility(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return MoveVisibility.PUBLIC - if variant == 2: - return MoveVisibility.PRIVATE - if variant == 3: - return MoveVisibility.FRIEND - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value == MoveVisibility.PUBLIC: - return - if value == MoveVisibility.PRIVATE: - return - if value == MoveVisibility.FRIEND: - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value == MoveVisibility.PUBLIC: - buf.write_i32(1) - if value == MoveVisibility.PRIVATE: - buf.write_i32(2) - if value == MoveVisibility.FRIEND: - buf.write_i32(3) - - - - - - - -class TransactionBlockKindInput(enum.Enum): - SYSTEM_TX = 0 - - PROGRAMMABLE_TX = 1 - - - -class _UniffiConverterTypeTransactionBlockKindInput(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return TransactionBlockKindInput.SYSTEM_TX - if variant == 2: - return TransactionBlockKindInput.PROGRAMMABLE_TX - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value == TransactionBlockKindInput.SYSTEM_TX: - return - if value == TransactionBlockKindInput.PROGRAMMABLE_TX: - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value == TransactionBlockKindInput.SYSTEM_TX: - buf.write_i32(1) - if value == TransactionBlockKindInput.PROGRAMMABLE_TX: - buf.write_i32(2) - - - - - -class _UniffiConverterOptionalInt32(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterInt32.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterInt32.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterInt32.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalUInt64(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterUInt64.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterUInt64.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterUInt64.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalBool(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterBool.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterBool.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterBool.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalString(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterString.check_lower(value) - - @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 _UniffiConverterOptionalBytes(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterBytes.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterBytes.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterBytes.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeCoinMetadata(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeCoinMetadata.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeCoinMetadata.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeCoinMetadata.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeEpoch(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeEpoch.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeEpoch.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeEpoch.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeEventFilter(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeEventFilter.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeEventFilter.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeEventFilter.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeMoveEnumConnection(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeMoveEnumConnection.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeMoveEnumConnection.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeMoveEnumConnection.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeMoveFunction(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeMoveFunction.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeMoveFunction.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeMoveFunction.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeMoveFunctionConnection(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeMoveFunctionConnection.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeMoveFunctionConnection.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeMoveFunctionConnection.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeMoveModule(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeMoveModule.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeMoveModule.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeMoveModule.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeMoveObject(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeMoveObject.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeMoveObject.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeMoveObject.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeMoveStructConnection(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeMoveStructConnection.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeMoveStructConnection.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeMoveStructConnection.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeObjectFilter(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeObjectFilter.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeObjectFilter.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeObjectFilter.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeOpenMoveType(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeOpenMoveType.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeOpenMoveType.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeOpenMoveType.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeProtocolConfigs(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeProtocolConfigs.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeProtocolConfigs.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeProtocolConfigs.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeTransactionDataEffects(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeTransactionDataEffects.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeTransactionDataEffects.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeTransactionDataEffects.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeTransactionsFilter(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeTransactionsFilter.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeTransactionsFilter.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeTransactionsFilter.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeValidatorCredentials(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeValidatorCredentials.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeValidatorCredentials.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeValidatorCredentials.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeValidatorSet(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeValidatorSet.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeValidatorSet.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeValidatorSet.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeCheckpointSummary(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeCheckpointSummary.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeCheckpointSummary.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeCheckpointSummary.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeObject(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeObject.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeObject.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeObject.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeSignedTransaction(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeSignedTransaction.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeSignedTransaction.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeSignedTransaction.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeMoveVisibility(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeMoveVisibility.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeMoveVisibility.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeMoveVisibility.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeTransactionBlockKindInput(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeTransactionBlockKindInput.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeTransactionBlockKindInput.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeTransactionBlockKindInput.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeTransactionEffects(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeTransactionEffects.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeTransactionEffects.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeTransactionEffects.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalSequenceInt32(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterSequenceInt32.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterSequenceInt32.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterSequenceInt32.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalSequenceString(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterSequenceString.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterSequenceString.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterSequenceString.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalSequenceTypeMoveEnumVariant(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterSequenceTypeMoveEnumVariant.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterSequenceTypeMoveEnumVariant.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterSequenceTypeMoveEnumVariant.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalSequenceTypeMoveField(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterSequenceTypeMoveField.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterSequenceTypeMoveField.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterSequenceTypeMoveField.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalSequenceTypeMoveFunctionTypeParameter(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterSequenceTypeMoveFunctionTypeParameter.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterSequenceTypeMoveFunctionTypeParameter.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterSequenceTypeMoveFunctionTypeParameter.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalSequenceTypeMoveStructTypeParameter(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterSequenceTypeMoveStructTypeParameter.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterSequenceTypeMoveStructTypeParameter.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterSequenceTypeMoveStructTypeParameter.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalSequenceTypeOpenMoveType(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterSequenceTypeOpenMoveType.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterSequenceTypeOpenMoveType.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterSequenceTypeOpenMoveType.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalSequenceTypeMoveAbility(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterSequenceTypeMoveAbility.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterSequenceTypeMoveAbility.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterSequenceTypeMoveAbility.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalSequenceTypeAddress(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterSequenceTypeAddress.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterSequenceTypeAddress.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterSequenceTypeAddress.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeBase64(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeBase64.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeBase64.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeBase64.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeBigInt(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeBigInt.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeBigInt.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeBigInt.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeDateTime(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeDateTime.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeDateTime.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeDateTime.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeAddress(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeAddress.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeAddress.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeAddress.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeCheckpointDigest(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeCheckpointDigest.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeCheckpointDigest.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeCheckpointDigest.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeMovePackage(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeMovePackage.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeMovePackage.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeMovePackage.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterSequenceInt32(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterInt32.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterInt32.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterInt32.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceString(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterString.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterString.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterString.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeEpoch(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeEpoch.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeEpoch.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeEpoch.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeMoveEnum(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeMoveEnum.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeMoveEnum.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeMoveEnum.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeMoveEnumVariant(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeMoveEnumVariant.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeMoveEnumVariant.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeMoveEnumVariant.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeMoveField(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeMoveField.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeMoveField.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeMoveField.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeMoveFunction(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeMoveFunction.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeMoveFunction.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeMoveFunction.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeMoveFunctionTypeParameter(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeMoveFunctionTypeParameter.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeMoveFunctionTypeParameter.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeMoveFunctionTypeParameter.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeMoveModule2(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeMoveModule2.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeMoveModule2.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeMoveModule2.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeMoveStruct(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeMoveStruct.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeMoveStruct.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeMoveStruct.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeMoveStructTypeParameter(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeMoveStructTypeParameter.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeMoveStructTypeParameter.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeMoveStructTypeParameter.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeOpenMoveType(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeOpenMoveType.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeOpenMoveType.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeOpenMoveType.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeProtocolConfigAttr(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeProtocolConfigAttr.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeProtocolConfigAttr.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeProtocolConfigAttr.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeProtocolConfigFeatureFlag(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeProtocolConfigFeatureFlag.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeProtocolConfigFeatureFlag.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeProtocolConfigFeatureFlag.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeTransactionDataEffects(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeTransactionDataEffects.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeTransactionDataEffects.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeTransactionDataEffects.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeTransactionEvent(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeTransactionEvent.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeTransactionEvent.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeTransactionEvent.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeValidator(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeValidator.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeValidator.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeValidator.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeCheckpointSummary(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeCheckpointSummary.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeCheckpointSummary.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeCheckpointSummary.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeCoin(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeCoin.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeCoin.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeCoin.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeObject(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeObject.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeObject.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeObject.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeSignedTransaction(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeSignedTransaction.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeSignedTransaction.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeSignedTransaction.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeFeature(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeFeature.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeFeature.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeFeature.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeMoveAbility(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeMoveAbility.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeMoveAbility.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeMoveAbility.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeTransactionEffects(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeTransactionEffects.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeTransactionEffects.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeTransactionEffects.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeUserSignature(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeUserSignature.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeUserSignature.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeUserSignature.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeAddress(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeAddress.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeAddress.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeAddress.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeMovePackage(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeMovePackage.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeMovePackage.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeMovePackage.read(buf) for i in range(count) - ] - - -class _UniffiConverterTypeBase64: - @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 check_lower(value): - return _UniffiConverterString.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterString.lower(value) - - -class _UniffiConverterTypeBcsName: - @staticmethod - def write(value, buf): - _UniffiConverterBytes.write(value, buf) - - @staticmethod - def read(buf): - return _UniffiConverterBytes.read(buf) - - @staticmethod - def lift(value): - return _UniffiConverterBytes.lift(value) - - @staticmethod - def check_lower(value): - return _UniffiConverterBytes.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterBytes.lower(value) - - -class _UniffiConverterTypeBigInt: - @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 check_lower(value): - return _UniffiConverterString.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterString.lower(value) - - -class _UniffiConverterTypeDateTime: - @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 check_lower(value): - return _UniffiConverterString.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterString.lower(value) - - -class _UniffiConverterTypeNameValue: - @staticmethod - def write(value, buf): - _UniffiConverterBytes.write(value, buf) - - @staticmethod - def read(buf): - return _UniffiConverterBytes.read(buf) - - @staticmethod - def lift(value): - return _UniffiConverterBytes.lift(value) - - @staticmethod - def check_lower(value): - return _UniffiConverterBytes.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterBytes.lower(value) - -# objects. -class ClientProtocol(typing.Protocol): - """ - The GraphQL client for interacting with the IOTA blockchain. - By default, it uses the `reqwest` crate as the HTTP client. - """ - - def active_validators(self, epoch: "typing.Optional[int]",pagination_filter: "PaginationFilter"): - """ - Get the list of active validators for the provided epoch, including - related metadata. If no epoch is provided, it will return the active - validators for the current epoch. - """ - - raise NotImplementedError - def chain_id(self, ): - """ - Get the chain identifier. - """ - - raise NotImplementedError - def checkpoint(self, digest: "typing.Optional[CheckpointDigest]",seq_num: "typing.Optional[int]"): - """ - Get the [`CheckpointSummary`] for a given checkpoint digest or - checkpoint id. If none is provided, it will use the last known - checkpoint id. - """ - - raise NotImplementedError - def checkpoints(self, pagination_filter: "PaginationFilter"): - """ - Get a page of [`CheckpointSummary`] for the provided parameters. - """ - - raise NotImplementedError - def coin_metadata(self, coin_type: "str"): - """ - Get the coin metadata for the coin type. - """ - - raise NotImplementedError - def coins(self, owner: "Address",coin_type: "typing.Optional[str]",pagination_filter: "PaginationFilter"): - """ - Get the list of coins for the specified address. - - If `coin_type` is not provided, it will default to `0x2::coin::Coin`, - which will return all coins. For IOTA coin, pass in the coin type: - `0x2::coin::Coin<0x2::iota::IOTA>`. - """ - - raise NotImplementedError - def epoch(self, epoch: "typing.Optional[int]"): - """ - Return the epoch information for the provided epoch. If no epoch is - provided, it will return the last known epoch. - """ - - raise NotImplementedError - def epoch_total_checkpoints(self, epoch: "typing.Optional[int]"): - """ - Return the number of checkpoints in this epoch. This will return - `Ok(None)` if the epoch requested is not available in the GraphQL - service (e.g., due to pruning). - """ - - raise NotImplementedError - def epoch_total_transaction_blocks(self, epoch: "typing.Optional[int]"): - """ - Return the number of transaction blocks in this epoch. This will return - `Ok(None)` if the epoch requested is not available in the GraphQL - service (e.g., due to pruning). - """ - - raise NotImplementedError - def epochs(self, pagination_filter: "PaginationFilter"): - """ - Return a page of epochs. - """ - - raise NotImplementedError - def events(self, filter: "typing.Optional[EventFilter]",pagination_filter: "PaginationFilter"): - """ - Return a page of tuple (event, transaction digest) based on the - (optional) event filter. - """ - - raise NotImplementedError - def execute_tx(self, signatures: "typing.List[UserSignature]",tx: "Transaction"): - """ - Execute a transaction. - """ - - raise NotImplementedError - def internal_total_transaction_blocks(self, digest: "typing.Optional[str]",seq_num: "typing.Optional[int]"): - """ - Internal function to get the total number of transaction blocks based on - the provided checkpoint digest or sequence number. - """ - - raise NotImplementedError - def latest_checkpoint_sequence_number(self, ): - """ - Return the sequence number of the latest checkpoint that has been - executed. - """ - - raise NotImplementedError - def max_page_size(self, ): - """ - Lazily fetch the max page size - """ - - raise NotImplementedError - def move_object_contents_bcs(self, address: "Address",version: "typing.Optional[int]"): - """ - Return the BCS of an object that is a Move object. - - If the object does not exist (e.g., due to pruning), this will return - `Ok(None)`. Similarly, if this is not an object but an address, it - will return `Ok(None)`. - """ - - raise NotImplementedError - def normalized_move_function(self, package: "str",module: "str",function: "str",version: "typing.Optional[int]"): - """ - Return the normalized Move function data for the provided package, - module, and function. - """ - - raise NotImplementedError - def normalized_move_module(self, package: "str",module: "str",version: "typing.Optional[int]",pagination_filter_enums: "PaginationFilter",pagination_filter_friends: "PaginationFilter",pagination_filter_functions: "PaginationFilter",pagination_filter_structs: "PaginationFilter"): - """ - Return the normalized Move module data for the provided module. - """ - - raise NotImplementedError - def object(self, address: "Address",version: "typing.Optional[int]"): - """ - Return an object based on the provided [`Address`]. - - If the object does not exist (e.g., due to pruning), this will return - `Ok(None)`. Similarly, if this is not an object but an address, it - will return `Ok(None)`. - """ - - raise NotImplementedError - def object_bcs(self, object_id: "Address"): - """ - Return the object's bcs content [`Vec`] based on the provided - [`Address`]. - """ - - raise NotImplementedError - def objects(self, filter: "typing.Optional[ObjectFilter]",pagination_filter: "PaginationFilter"): - """ - Return a page of objects based on the provided parameters. - - Use this function together with the [`ObjectFilter::owner`] to get the - objects owned by an address. - - # Example - - ```rust,ignore - let filter = ObjectFilter { - type_: None, - owner: Some(Address::from_str("test").unwrap().into()), - object_ids: None, - }; - - let owned_objects = client.objects(None, None, Some(filter), None, None).await; - ``` - """ - - raise NotImplementedError - def package(self, address: "Address",version: "typing.Optional[int]"): - """ - The package corresponding to the given address (at the optionally given - version). When no version is given, the package is loaded directly - from the address given. Otherwise, the address is translated before - loading to point to the package whose original ID matches - the package at address, but whose version is version. For non-system - packages, this might result in a different address than address - because different versions of a package, introduced by upgrades, - exist at distinct addresses. - - Note that this interpretation of version is different from a historical - object read (the interpretation of version for the object query). - """ - - raise NotImplementedError - def package_by_name(self, name: "str"): - """ - Fetch a package by its name (using Move Registry Service) - """ - - raise NotImplementedError - def package_latest(self, address: "Address"): - """ - Fetch the latest version of the package at address. - This corresponds to the package with the highest version that shares its - original ID with the package at address. - """ - - raise NotImplementedError - def package_versions(self, address: "Address",pagination_filter: "PaginationFilter",after_version: "typing.Optional[int]",before_version: "typing.Optional[int]"): - """ - Fetch all versions of package at address (packages that share this - package's original ID), optionally bounding the versions exclusively - from below with afterVersion, or from above with beforeVersion. - """ - - raise NotImplementedError - def packages(self, pagination_filter: "PaginationFilter",after_checkpoint: "typing.Optional[int]",before_checkpoint: "typing.Optional[int]"): - """ - The Move packages that exist in the network, optionally filtered to be - strictly before beforeCheckpoint and/or strictly after - afterCheckpoint. - - This query returns all versions of a given user package that appear - between the specified checkpoints, but only records the latest - versions of system packages. - """ - - raise NotImplementedError - def pagination_filter(self, pagination_filter: "PaginationFilter"): - """ - Handle pagination filters and return the appropriate values. If limit is - omitted, it will use the max page size from the service config. - """ - - raise NotImplementedError - def protocol_config(self, version: "typing.Optional[int]"): - """ - Get the protocol configuration. - """ - - raise NotImplementedError - def reference_gas_price(self, epoch: "typing.Optional[int]"): - """ - Get the reference gas price for the provided epoch or the last known one - if no epoch is provided. - - This will return `Ok(None)` if the epoch requested is not available in - the GraphQL service (e.g., due to pruning). - """ - - raise NotImplementedError - def total_supply(self, coin_type: "str"): - """ - Get total supply for the coin type. - """ - - raise NotImplementedError - def total_transaction_blocks(self, ): - """ - The total number of transaction blocks in the network by the end of the - last known checkpoint. - """ - - raise NotImplementedError - def total_transaction_blocks_by_digest(self, digest: "CheckpointDigest"): - """ - The total number of transaction blocks in the network by the end of the - provided checkpoint digest. - """ - - raise NotImplementedError - def total_transaction_blocks_by_seq_num(self, seq_num: "int"): - """ - The total number of transaction blocks in the network by the end of the - provided checkpoint sequence number. - """ - - raise NotImplementedError - def transaction(self, digest: "TransactionDigest"): - """ - Get a transaction by its digest. - """ - - raise NotImplementedError - def transaction_data_effects(self, digest: "TransactionDigest"): - """ - Get a transaction's data and effects by its digest. - """ - - raise NotImplementedError - def transaction_effects(self, digest: "TransactionDigest"): - """ - Get a transaction's effects by its digest. - """ - - raise NotImplementedError - def transactions(self, filter: "typing.Optional[TransactionsFilter]",pagination_filter: "PaginationFilter"): - """ - Get a page of transactions based on the provided filters. - """ - - raise NotImplementedError - def transactions_data_effects(self, filter: "typing.Optional[TransactionsFilter]",pagination_filter: "PaginationFilter"): - """ - Get a page of transactions' data and effects based on the provided - filters. - """ - - raise NotImplementedError - def transactions_effects(self, filter: "typing.Optional[TransactionsFilter]",pagination_filter: "PaginationFilter"): - """ - Get a page of transactions' effects based on the provided filters. - """ - - raise NotImplementedError -# Client is a Rust-only trait - it's a wrapper around a Rust implementation. -class Client(): - """ - The GraphQL client for interacting with the IOTA blockchain. - By default, it uses the `reqwest` crate as the HTTP client. - """ - - _pointer: ctypes.c_void_p - def __init__(self, server: "str"): - """ - Create a new GraphQL client with the provided server address. - """ - - _UniffiConverterString.check_lower(server) - - self._pointer = _uniffi_rust_call_with_error(_UniffiConverterTypeError__as_error,_UniffiLib.uniffi_iota_graphql_client_fn_constructor_client_new, - _UniffiConverterString.lower(server)) - - def __del__(self): - # In case of partial initialization of instances. - pointer = getattr(self, "_pointer", None) - if pointer is not None: - _uniffi_rust_call(_UniffiLib.uniffi_iota_graphql_client_fn_free_client, pointer) - - def _uniffi_clone_pointer(self): - return _uniffi_rust_call(_UniffiLib.uniffi_iota_graphql_client_fn_clone_client, self._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_devnet(cls, ): - """ - Create a new GraphQL client connected to the `devnet` GraphQL server: - {DEVNET_HOST}. - """ - - # Call the (fallible) function before creating any half-baked object instances. - pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_graphql_client_fn_constructor_client_new_devnet,) - return cls._make_instance_(pointer) - - @classmethod - def new_localhost(cls, ): - """ - Create a new GraphQL client connected to the `localhost` GraphQL server: - {DEFAULT_LOCAL_HOST}. - """ - - # Call the (fallible) function before creating any half-baked object instances. - pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_graphql_client_fn_constructor_client_new_localhost,) - return cls._make_instance_(pointer) - - @classmethod - def new_mainnet(cls, ): - """ - Create a new GraphQL client connected to the `mainnet` GraphQL server: - {MAINNET_HOST}. - """ - - # Call the (fallible) function before creating any half-baked object instances. - pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_graphql_client_fn_constructor_client_new_mainnet,) - return cls._make_instance_(pointer) - - @classmethod - def new_testnet(cls, ): - """ - Create a new GraphQL client connected to the `testnet` GraphQL server: - {TESTNET_HOST}. - """ - - # Call the (fallible) function before creating any half-baked object instances. - pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_graphql_client_fn_constructor_client_new_testnet,) - return cls._make_instance_(pointer) - - - async def active_validators(self, epoch: "typing.Optional[int]",pagination_filter: "PaginationFilter") -> "ValidatorPage": - """ - Get the list of active validators for the provided epoch, including - related metadata. If no epoch is provided, it will return the active - validators for the current epoch. - """ - - _UniffiConverterOptionalUInt64.check_lower(epoch) - - _UniffiConverterTypePaginationFilter.check_lower(pagination_filter) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_active_validators( - self._uniffi_clone_pointer(), - _UniffiConverterOptionalUInt64.lower(epoch), - _UniffiConverterTypePaginationFilter.lower(pagination_filter) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterTypeValidatorPage.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def chain_id(self, ) -> "str": - """ - Get the chain identifier. - """ - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_chain_id( - self._uniffi_clone_pointer(), - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterString.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def checkpoint(self, digest: "typing.Optional[CheckpointDigest]",seq_num: "typing.Optional[int]") -> "typing.Optional[CheckpointSummary]": - """ - Get the [`CheckpointSummary`] for a given checkpoint digest or - checkpoint id. If none is provided, it will use the last known - checkpoint id. - """ - - _UniffiConverterOptionalTypeCheckpointDigest.check_lower(digest) - - _UniffiConverterOptionalUInt64.check_lower(seq_num) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_checkpoint( - self._uniffi_clone_pointer(), - _UniffiConverterOptionalTypeCheckpointDigest.lower(digest), - _UniffiConverterOptionalUInt64.lower(seq_num) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterOptionalTypeCheckpointSummary.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def checkpoints(self, pagination_filter: "PaginationFilter") -> "CheckpointSummaryPage": - """ - Get a page of [`CheckpointSummary`] for the provided parameters. - """ - - _UniffiConverterTypePaginationFilter.check_lower(pagination_filter) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_checkpoints( - self._uniffi_clone_pointer(), - _UniffiConverterTypePaginationFilter.lower(pagination_filter) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterTypeCheckpointSummaryPage.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def coin_metadata(self, coin_type: "str") -> "typing.Optional[CoinMetadata]": - """ - Get the coin metadata for the coin type. - """ - - _UniffiConverterString.check_lower(coin_type) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_coin_metadata( - self._uniffi_clone_pointer(), - _UniffiConverterString.lower(coin_type) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterOptionalTypeCoinMetadata.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def coins(self, owner: "Address",coin_type: "typing.Optional[str]",pagination_filter: "PaginationFilter") -> "CoinPage": - """ - Get the list of coins for the specified address. - - If `coin_type` is not provided, it will default to `0x2::coin::Coin`, - which will return all coins. For IOTA coin, pass in the coin type: - `0x2::coin::Coin<0x2::iota::IOTA>`. - """ - - _UniffiConverterTypeAddress.check_lower(owner) - - _UniffiConverterOptionalString.check_lower(coin_type) - - _UniffiConverterTypePaginationFilter.check_lower(pagination_filter) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_coins( - self._uniffi_clone_pointer(), - _UniffiConverterTypeAddress.lower(owner), - _UniffiConverterOptionalString.lower(coin_type), - _UniffiConverterTypePaginationFilter.lower(pagination_filter) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterTypeCoinPage.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def epoch(self, epoch: "typing.Optional[int]") -> "typing.Optional[Epoch]": - """ - Return the epoch information for the provided epoch. If no epoch is - provided, it will return the last known epoch. - """ - - _UniffiConverterOptionalUInt64.check_lower(epoch) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_epoch( - self._uniffi_clone_pointer(), - _UniffiConverterOptionalUInt64.lower(epoch) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterOptionalTypeEpoch.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def epoch_total_checkpoints(self, epoch: "typing.Optional[int]") -> "typing.Optional[int]": - """ - Return the number of checkpoints in this epoch. This will return - `Ok(None)` if the epoch requested is not available in the GraphQL - service (e.g., due to pruning). - """ - - _UniffiConverterOptionalUInt64.check_lower(epoch) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_epoch_total_checkpoints( - self._uniffi_clone_pointer(), - _UniffiConverterOptionalUInt64.lower(epoch) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterOptionalUInt64.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def epoch_total_transaction_blocks(self, epoch: "typing.Optional[int]") -> "typing.Optional[int]": - """ - Return the number of transaction blocks in this epoch. This will return - `Ok(None)` if the epoch requested is not available in the GraphQL - service (e.g., due to pruning). - """ - - _UniffiConverterOptionalUInt64.check_lower(epoch) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_epoch_total_transaction_blocks( - self._uniffi_clone_pointer(), - _UniffiConverterOptionalUInt64.lower(epoch) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterOptionalUInt64.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def epochs(self, pagination_filter: "PaginationFilter") -> "EpochPage": - """ - Return a page of epochs. - """ - - _UniffiConverterTypePaginationFilter.check_lower(pagination_filter) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_epochs( - self._uniffi_clone_pointer(), - _UniffiConverterTypePaginationFilter.lower(pagination_filter) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterTypeEpochPage.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def events(self, filter: "typing.Optional[EventFilter]",pagination_filter: "PaginationFilter") -> "TransactionEventPage": - """ - Return a page of tuple (event, transaction digest) based on the - (optional) event filter. - """ - - _UniffiConverterOptionalTypeEventFilter.check_lower(filter) - - _UniffiConverterTypePaginationFilter.check_lower(pagination_filter) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_events( - self._uniffi_clone_pointer(), - _UniffiConverterOptionalTypeEventFilter.lower(filter), - _UniffiConverterTypePaginationFilter.lower(pagination_filter) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterTypeTransactionEventPage.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def execute_tx(self, signatures: "typing.List[UserSignature]",tx: "Transaction") -> "typing.Optional[TransactionEffects]": - """ - Execute a transaction. - """ - - _UniffiConverterSequenceTypeUserSignature.check_lower(signatures) - - _UniffiConverterTypeTransaction.check_lower(tx) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_execute_tx( - self._uniffi_clone_pointer(), - _UniffiConverterSequenceTypeUserSignature.lower(signatures), - _UniffiConverterTypeTransaction.lower(tx) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterOptionalTypeTransactionEffects.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def internal_total_transaction_blocks(self, digest: "typing.Optional[str]",seq_num: "typing.Optional[int]") -> "typing.Optional[int]": - """ - Internal function to get the total number of transaction blocks based on - the provided checkpoint digest or sequence number. - """ - - _UniffiConverterOptionalString.check_lower(digest) - - _UniffiConverterOptionalUInt64.check_lower(seq_num) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_internal_total_transaction_blocks( - self._uniffi_clone_pointer(), - _UniffiConverterOptionalString.lower(digest), - _UniffiConverterOptionalUInt64.lower(seq_num) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterOptionalUInt64.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def latest_checkpoint_sequence_number(self, ) -> "typing.Optional[int]": - """ - Return the sequence number of the latest checkpoint that has been - executed. - """ - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_latest_checkpoint_sequence_number( - self._uniffi_clone_pointer(), - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterOptionalUInt64.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def max_page_size(self, ) -> "int": - """ - Lazily fetch the max page size - """ - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_max_page_size( - self._uniffi_clone_pointer(), - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_i32, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_i32, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_i32, - # lift function - _UniffiConverterInt32.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def move_object_contents_bcs(self, address: "Address",version: "typing.Optional[int]") -> "typing.Optional[bytes]": - """ - Return the BCS of an object that is a Move object. - - If the object does not exist (e.g., due to pruning), this will return - `Ok(None)`. Similarly, if this is not an object but an address, it - will return `Ok(None)`. - """ - - _UniffiConverterTypeAddress.check_lower(address) - - _UniffiConverterOptionalUInt64.check_lower(version) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_move_object_contents_bcs( - self._uniffi_clone_pointer(), - _UniffiConverterTypeAddress.lower(address), - _UniffiConverterOptionalUInt64.lower(version) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterOptionalBytes.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def normalized_move_function(self, package: "str",module: "str",function: "str",version: "typing.Optional[int]") -> "typing.Optional[MoveFunction]": - """ - Return the normalized Move function data for the provided package, - module, and function. - """ - - _UniffiConverterString.check_lower(package) - - _UniffiConverterString.check_lower(module) - - _UniffiConverterString.check_lower(function) - - _UniffiConverterOptionalUInt64.check_lower(version) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_normalized_move_function( - self._uniffi_clone_pointer(), - _UniffiConverterString.lower(package), - _UniffiConverterString.lower(module), - _UniffiConverterString.lower(function), - _UniffiConverterOptionalUInt64.lower(version) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterOptionalTypeMoveFunction.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def normalized_move_module(self, package: "str",module: "str",version: "typing.Optional[int]",pagination_filter_enums: "PaginationFilter",pagination_filter_friends: "PaginationFilter",pagination_filter_functions: "PaginationFilter",pagination_filter_structs: "PaginationFilter") -> "typing.Optional[MoveModule]": - """ - Return the normalized Move module data for the provided module. - """ - - _UniffiConverterString.check_lower(package) - - _UniffiConverterString.check_lower(module) - - _UniffiConverterOptionalUInt64.check_lower(version) - - _UniffiConverterTypePaginationFilter.check_lower(pagination_filter_enums) - - _UniffiConverterTypePaginationFilter.check_lower(pagination_filter_friends) - - _UniffiConverterTypePaginationFilter.check_lower(pagination_filter_functions) - - _UniffiConverterTypePaginationFilter.check_lower(pagination_filter_structs) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_normalized_move_module( - self._uniffi_clone_pointer(), - _UniffiConverterString.lower(package), - _UniffiConverterString.lower(module), - _UniffiConverterOptionalUInt64.lower(version), - _UniffiConverterTypePaginationFilter.lower(pagination_filter_enums), - _UniffiConverterTypePaginationFilter.lower(pagination_filter_friends), - _UniffiConverterTypePaginationFilter.lower(pagination_filter_functions), - _UniffiConverterTypePaginationFilter.lower(pagination_filter_structs) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterOptionalTypeMoveModule.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def object(self, address: "Address",version: "typing.Optional[int]") -> "typing.Optional[Object]": - """ - Return an object based on the provided [`Address`]. - - If the object does not exist (e.g., due to pruning), this will return - `Ok(None)`. Similarly, if this is not an object but an address, it - will return `Ok(None)`. - """ - - _UniffiConverterTypeAddress.check_lower(address) - - _UniffiConverterOptionalUInt64.check_lower(version) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_object( - self._uniffi_clone_pointer(), - _UniffiConverterTypeAddress.lower(address), - _UniffiConverterOptionalUInt64.lower(version) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterOptionalTypeObject.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def object_bcs(self, object_id: "Address") -> "typing.Optional[bytes]": - """ - Return the object's bcs content [`Vec`] based on the provided - [`Address`]. - """ - - _UniffiConverterTypeAddress.check_lower(object_id) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_object_bcs( - self._uniffi_clone_pointer(), - _UniffiConverterTypeAddress.lower(object_id) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterOptionalBytes.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def objects(self, filter: "typing.Optional[ObjectFilter]",pagination_filter: "PaginationFilter") -> "ObjectPage": - """ - Return a page of objects based on the provided parameters. - - Use this function together with the [`ObjectFilter::owner`] to get the - objects owned by an address. - - # Example - - ```rust,ignore - let filter = ObjectFilter { - type_: None, - owner: Some(Address::from_str("test").unwrap().into()), - object_ids: None, - }; - - let owned_objects = client.objects(None, None, Some(filter), None, None).await; - ``` - """ - - _UniffiConverterOptionalTypeObjectFilter.check_lower(filter) - - _UniffiConverterTypePaginationFilter.check_lower(pagination_filter) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_objects( - self._uniffi_clone_pointer(), - _UniffiConverterOptionalTypeObjectFilter.lower(filter), - _UniffiConverterTypePaginationFilter.lower(pagination_filter) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterTypeObjectPage.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def package(self, address: "Address",version: "typing.Optional[int]") -> "typing.Optional[MovePackage]": - """ - The package corresponding to the given address (at the optionally given - version). When no version is given, the package is loaded directly - from the address given. Otherwise, the address is translated before - loading to point to the package whose original ID matches - the package at address, but whose version is version. For non-system - packages, this might result in a different address than address - because different versions of a package, introduced by upgrades, - exist at distinct addresses. - - Note that this interpretation of version is different from a historical - object read (the interpretation of version for the object query). - """ - - _UniffiConverterTypeAddress.check_lower(address) - - _UniffiConverterOptionalUInt64.check_lower(version) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_package( - self._uniffi_clone_pointer(), - _UniffiConverterTypeAddress.lower(address), - _UniffiConverterOptionalUInt64.lower(version) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterOptionalTypeMovePackage.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def package_by_name(self, name: "str") -> "typing.Optional[MovePackage]": - """ - Fetch a package by its name (using Move Registry Service) - """ - - _UniffiConverterString.check_lower(name) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_package_by_name( - self._uniffi_clone_pointer(), - _UniffiConverterString.lower(name) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterOptionalTypeMovePackage.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def package_latest(self, address: "Address") -> "typing.Optional[MovePackage]": - """ - Fetch the latest version of the package at address. - This corresponds to the package with the highest version that shares its - original ID with the package at address. - """ - - _UniffiConverterTypeAddress.check_lower(address) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_package_latest( - self._uniffi_clone_pointer(), - _UniffiConverterTypeAddress.lower(address) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterOptionalTypeMovePackage.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def package_versions(self, address: "Address",pagination_filter: "PaginationFilter",after_version: "typing.Optional[int]",before_version: "typing.Optional[int]") -> "MovePackagePage": - """ - Fetch all versions of package at address (packages that share this - package's original ID), optionally bounding the versions exclusively - from below with afterVersion, or from above with beforeVersion. - """ - - _UniffiConverterTypeAddress.check_lower(address) - - _UniffiConverterTypePaginationFilter.check_lower(pagination_filter) - - _UniffiConverterOptionalUInt64.check_lower(after_version) - - _UniffiConverterOptionalUInt64.check_lower(before_version) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_package_versions( - self._uniffi_clone_pointer(), - _UniffiConverterTypeAddress.lower(address), - _UniffiConverterTypePaginationFilter.lower(pagination_filter), - _UniffiConverterOptionalUInt64.lower(after_version), - _UniffiConverterOptionalUInt64.lower(before_version) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterTypeMovePackagePage.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def packages(self, pagination_filter: "PaginationFilter",after_checkpoint: "typing.Optional[int]",before_checkpoint: "typing.Optional[int]") -> "MovePackagePage": - """ - The Move packages that exist in the network, optionally filtered to be - strictly before beforeCheckpoint and/or strictly after - afterCheckpoint. - - This query returns all versions of a given user package that appear - between the specified checkpoints, but only records the latest - versions of system packages. - """ - - _UniffiConverterTypePaginationFilter.check_lower(pagination_filter) - - _UniffiConverterOptionalUInt64.check_lower(after_checkpoint) - - _UniffiConverterOptionalUInt64.check_lower(before_checkpoint) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_packages( - self._uniffi_clone_pointer(), - _UniffiConverterTypePaginationFilter.lower(pagination_filter), - _UniffiConverterOptionalUInt64.lower(after_checkpoint), - _UniffiConverterOptionalUInt64.lower(before_checkpoint) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterTypeMovePackagePage.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def pagination_filter(self, pagination_filter: "PaginationFilter") -> "PaginationFilterResponse": - """ - Handle pagination filters and return the appropriate values. If limit is - omitted, it will use the max page size from the service config. - """ - - _UniffiConverterTypePaginationFilter.check_lower(pagination_filter) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_pagination_filter( - self._uniffi_clone_pointer(), - _UniffiConverterTypePaginationFilter.lower(pagination_filter) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterTypePaginationFilterResponse.lift, - - # Error FFI converter - - None, - - ) - - - - async def protocol_config(self, version: "typing.Optional[int]") -> "typing.Optional[ProtocolConfigs]": - """ - Get the protocol configuration. - """ - - _UniffiConverterOptionalUInt64.check_lower(version) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_protocol_config( - self._uniffi_clone_pointer(), - _UniffiConverterOptionalUInt64.lower(version) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterOptionalTypeProtocolConfigs.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def reference_gas_price(self, epoch: "typing.Optional[int]") -> "typing.Optional[int]": - """ - Get the reference gas price for the provided epoch or the last known one - if no epoch is provided. - - This will return `Ok(None)` if the epoch requested is not available in - the GraphQL service (e.g., due to pruning). - """ - - _UniffiConverterOptionalUInt64.check_lower(epoch) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_reference_gas_price( - self._uniffi_clone_pointer(), - _UniffiConverterOptionalUInt64.lower(epoch) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterOptionalUInt64.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def total_supply(self, coin_type: "str") -> "typing.Optional[int]": - """ - Get total supply for the coin type. - """ - - _UniffiConverterString.check_lower(coin_type) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_total_supply( - self._uniffi_clone_pointer(), - _UniffiConverterString.lower(coin_type) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterOptionalUInt64.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def total_transaction_blocks(self, ) -> "typing.Optional[int]": - """ - The total number of transaction blocks in the network by the end of the - last known checkpoint. - """ - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_total_transaction_blocks( - self._uniffi_clone_pointer(), - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterOptionalUInt64.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def total_transaction_blocks_by_digest(self, digest: "CheckpointDigest") -> "typing.Optional[int]": - """ - The total number of transaction blocks in the network by the end of the - provided checkpoint digest. - """ - - _UniffiConverterTypeCheckpointDigest.check_lower(digest) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_total_transaction_blocks_by_digest( - self._uniffi_clone_pointer(), - _UniffiConverterTypeCheckpointDigest.lower(digest) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterOptionalUInt64.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def total_transaction_blocks_by_seq_num(self, seq_num: "int") -> "typing.Optional[int]": - """ - The total number of transaction blocks in the network by the end of the - provided checkpoint sequence number. - """ - - _UniffiConverterUInt64.check_lower(seq_num) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_total_transaction_blocks_by_seq_num( - self._uniffi_clone_pointer(), - _UniffiConverterUInt64.lower(seq_num) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterOptionalUInt64.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def transaction(self, digest: "TransactionDigest") -> "typing.Optional[SignedTransaction]": - """ - Get a transaction by its digest. - """ - - _UniffiConverterTypeTransactionDigest.check_lower(digest) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_transaction( - self._uniffi_clone_pointer(), - _UniffiConverterTypeTransactionDigest.lower(digest) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterOptionalTypeSignedTransaction.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def transaction_data_effects(self, digest: "TransactionDigest") -> "typing.Optional[TransactionDataEffects]": - """ - Get a transaction's data and effects by its digest. - """ - - _UniffiConverterTypeTransactionDigest.check_lower(digest) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_transaction_data_effects( - self._uniffi_clone_pointer(), - _UniffiConverterTypeTransactionDigest.lower(digest) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterOptionalTypeTransactionDataEffects.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def transaction_effects(self, digest: "TransactionDigest") -> "typing.Optional[TransactionEffects]": - """ - Get a transaction's effects by its digest. - """ - - _UniffiConverterTypeTransactionDigest.check_lower(digest) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_transaction_effects( - self._uniffi_clone_pointer(), - _UniffiConverterTypeTransactionDigest.lower(digest) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterOptionalTypeTransactionEffects.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def transactions(self, filter: "typing.Optional[TransactionsFilter]",pagination_filter: "PaginationFilter") -> "SignedTransactionPage": - """ - Get a page of transactions based on the provided filters. - """ - - _UniffiConverterOptionalTypeTransactionsFilter.check_lower(filter) - - _UniffiConverterTypePaginationFilter.check_lower(pagination_filter) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_transactions( - self._uniffi_clone_pointer(), - _UniffiConverterOptionalTypeTransactionsFilter.lower(filter), - _UniffiConverterTypePaginationFilter.lower(pagination_filter) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterTypeSignedTransactionPage.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def transactions_data_effects(self, filter: "typing.Optional[TransactionsFilter]",pagination_filter: "PaginationFilter") -> "TransactionDataEffectsPage": - """ - Get a page of transactions' data and effects based on the provided - filters. - """ - - _UniffiConverterOptionalTypeTransactionsFilter.check_lower(filter) - - _UniffiConverterTypePaginationFilter.check_lower(pagination_filter) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_transactions_data_effects( - self._uniffi_clone_pointer(), - _UniffiConverterOptionalTypeTransactionsFilter.lower(filter), - _UniffiConverterTypePaginationFilter.lower(pagination_filter) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterTypeTransactionDataEffectsPage.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - async def transactions_effects(self, filter: "typing.Optional[TransactionsFilter]",pagination_filter: "PaginationFilter") -> "TransactionEffectsPage": - """ - Get a page of transactions' effects based on the provided filters. - """ - - _UniffiConverterOptionalTypeTransactionsFilter.check_lower(filter) - - _UniffiConverterTypePaginationFilter.check_lower(pagination_filter) - - return await _uniffi_rust_call_async( - _UniffiLib.uniffi_iota_graphql_client_fn_method_client_transactions_effects( - self._uniffi_clone_pointer(), - _UniffiConverterOptionalTypeTransactionsFilter.lower(filter), - _UniffiConverterTypePaginationFilter.lower(pagination_filter) - ), - _UniffiLib.ffi_iota_graphql_client_rust_future_poll_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_complete_rust_buffer, - _UniffiLib.ffi_iota_graphql_client_rust_future_free_rust_buffer, - # lift function - _UniffiConverterTypeTransactionEffectsPage.lift, - - # Error FFI converter -_UniffiConverterTypeError__as_error, - - ) - - - - - -class _UniffiConverterTypeClient: - - @staticmethod - def lift(value: int): - return Client._make_instance_(value) - - @staticmethod - def check_lower(value: Client): - if not isinstance(value, Client): - raise TypeError("Expected Client instance, {} found".format(type(value).__name__)) - - @staticmethod - def lower(value: ClientProtocol): - if not isinstance(value, Client): - raise TypeError("Expected Client instance, {} found".format(type(value).__name__)) - return value._uniffi_clone_pointer() - - @classmethod - def read(cls, buf: _UniffiRustBuffer): - ptr = buf.read_u64() - if ptr == 0: - raise InternalError("Raw pointer value was null") - return cls.lift(ptr) - - @classmethod - def write(cls, value: ClientProtocol, buf: _UniffiRustBuffer): - buf.write_u64(cls.lower(value)) -class ErrorProtocol(typing.Protocol): - """ - General error type for the client. It is used to wrap all the possible - errors that can occur. - """ - - def kind(self, ): - """ - Returns the kind of error. - """ - - raise NotImplementedError -# Error is a Rust-only trait - it's a wrapper around a Rust implementation. -class Error(Exception): - """ - General error type for the client. It is used to wrap all the possible - errors that can occur. - """ - - _pointer: ctypes.c_void_p - - def __init__(self, *args, **kwargs): - raise ValueError("This class has no default constructor") - - def __del__(self): - # In case of partial initialization of instances. - pointer = getattr(self, "_pointer", None) - if pointer is not None: - _uniffi_rust_call(_UniffiLib.uniffi_iota_graphql_client_fn_free_error, pointer) - - def _uniffi_clone_pointer(self): - return _uniffi_rust_call(_UniffiLib.uniffi_iota_graphql_client_fn_clone_error, self._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 kind(self, ) -> "Kind": - """ - Returns the kind of error. - """ - - return _UniffiConverterTypeKind.lift( - _uniffi_rust_call(_UniffiLib.uniffi_iota_graphql_client_fn_method_error_kind,self._uniffi_clone_pointer(),) - ) - - - - - - -class _UniffiConverterTypeError__as_error(_UniffiConverterRustBuffer): - @classmethod - def read(cls, buf): - raise NotImplementedError() - - @classmethod - def write(cls, value, buf): - raise NotImplementedError() - - @staticmethod - def lift(value): - # Errors are always a rust buffer holding a pointer - which is a "read" - with value.consume_with_stream() as stream: - return _UniffiConverterTypeError.read(stream) - - @staticmethod - def lower(value): - raise NotImplementedError() - -class _UniffiConverterTypeError: - - @staticmethod - def lift(value: int): - return Error._make_instance_(value) - - @staticmethod - def check_lower(value: Error): - if not isinstance(value, Error): - raise TypeError("Expected Error instance, {} found".format(type(value).__name__)) - - @staticmethod - def lower(value: ErrorProtocol): - if not isinstance(value, Error): - raise TypeError("Expected Error instance, {} found".format(type(value).__name__)) - return value._uniffi_clone_pointer() - - @classmethod - def read(cls, buf: _UniffiRustBuffer): - ptr = buf.read_u64() - if ptr == 0: - raise InternalError("Raw pointer value was null") - return cls.lift(ptr) - - @classmethod - def write(cls, value: ErrorProtocol, buf: _UniffiRustBuffer): - buf.write_u64(cls.lower(value)) - -# External type CheckpointSummary: `from .iota_sdk_types import CheckpointSummary` - -# External type Coin: `from .iota_sdk_types import Coin` - -# External type Event: `from .iota_sdk_types import Event` - -# External type Object: `from .iota_sdk_types import Object` - -# External type SignedTransaction: `from .iota_sdk_types import SignedTransaction` - -# External type Transaction: `from .iota_sdk_types import Transaction` - -# External type UniffiMovePackage: `from .iota_sdk_types import UniffiMovePackage` - -# External type TransactionEffects: `from .iota_sdk_types import TransactionEffects` - -# External type UserSignature: `from .iota_sdk_types import UserSignature` - -# External type Address: `from .iota_sdk_types import Address` - -# External type CheckpointDigest: `from .iota_sdk_types import CheckpointDigest` - -# External type Digest: `from .iota_sdk_types import Digest` - -# External type MovePackage: `from .iota_sdk_types import MovePackage` - -# External type TransactionDigest: `from .iota_sdk_types import TransactionDigest` -Base64 = str -BcsName = bytes -BigInt = str -DateTime = str -NameValue = bytes - -# Async support# RustFuturePoll values -_UNIFFI_RUST_FUTURE_POLL_READY = 0 -_UNIFFI_RUST_FUTURE_POLL_MAYBE_READY = 1 - -# Stores futures for _uniffi_continuation_callback -_UniffiContinuationHandleMap = _UniffiHandleMap() - -_UNIFFI_GLOBAL_EVENT_LOOP = None - -""" -Set the event loop to use for async functions - -This is needed if some async functions run outside of the eventloop, for example: - - A non-eventloop thread is spawned, maybe from `EventLoop.run_in_executor` or maybe from the - Rust code spawning its own thread. - - The Rust code calls an async callback method from a sync callback function, using something - like `pollster` to block on the async call. - -In this case, we need an event loop to run the Python async function, but there's no eventloop set -for the thread. Use `uniffi_set_event_loop` to force an eventloop to be used in this case. -""" -def uniffi_set_event_loop(eventloop: asyncio.BaseEventLoop): - global _UNIFFI_GLOBAL_EVENT_LOOP - _UNIFFI_GLOBAL_EVENT_LOOP = eventloop - -def _uniffi_get_event_loop(): - if _UNIFFI_GLOBAL_EVENT_LOOP is not None: - return _UNIFFI_GLOBAL_EVENT_LOOP - else: - return asyncio.get_running_loop() - -# Continuation callback for async functions -# lift the return value or error and resolve the future, causing the async function to resume. -@_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK -def _uniffi_continuation_callback(future_ptr, poll_code): - (eventloop, future) = _UniffiContinuationHandleMap.remove(future_ptr) - eventloop.call_soon_threadsafe(_uniffi_set_future_result, future, poll_code) - -def _uniffi_set_future_result(future, poll_code): - if not future.cancelled(): - future.set_result(poll_code) - -async def _uniffi_rust_call_async(rust_future, ffi_poll, ffi_complete, ffi_free, lift_func, error_ffi_converter): - try: - eventloop = _uniffi_get_event_loop() - - # Loop and poll until we see a _UNIFFI_RUST_FUTURE_POLL_READY value - while True: - future = eventloop.create_future() - ffi_poll( - rust_future, - _uniffi_continuation_callback, - _UniffiContinuationHandleMap.insert((eventloop, future)), - ) - poll_code = await future - if poll_code == _UNIFFI_RUST_FUTURE_POLL_READY: - break - - return lift_func( - _uniffi_rust_call_with_error(error_ffi_converter, ffi_complete, rust_future) - ) - finally: - ffi_free(rust_future) - -__all__ = [ - "InternalError", - "Direction", - "Feature", - "Kind", - "MoveAbility", - "MoveVisibility", - "TransactionBlockKindInput", - "CheckpointSummaryPage", - "CoinMetadata", - "CoinPage", - "Epoch", - "EpochPage", - "EventFilter", - "GqlAddress", - "MoveEnum", - "MoveEnumConnection", - "MoveEnumVariant", - "MoveField", - "MoveFunction", - "MoveFunctionConnection", - "MoveFunctionTypeParameter", - "MoveModule", - "MoveModule2", - "MoveModuleConnection", - "MoveObject", - "MovePackagePage", - "MovePackageQuery", - "MoveStruct", - "MoveStructConnection", - "MoveStructTypeParameter", - "ObjectFilter", - "ObjectPage", - "OpenMoveType", - "PageInfo", - "PaginationFilter", - "PaginationFilterResponse", - "ProtocolConfigAttr", - "ProtocolConfigFeatureFlag", - "ProtocolConfigs", - "ServiceConfig", - "SignedTransactionPage", - "TransactionDataEffects", - "TransactionDataEffectsPage", - "TransactionEffectsPage", - "TransactionEvent", - "TransactionEventPage", - "TransactionsFilter", - "Validator", - "ValidatorCredentials", - "ValidatorPage", - "ValidatorSet", - "Client", - "Error", -] - diff --git a/bindings/python/lib/iota_sdk_ffi.py b/bindings/python/lib/iota_sdk_ffi.py new file mode 100644 index 000000000..4033b086a --- /dev/null +++ b/bindings/python/lib/iota_sdk_ffi.py @@ -0,0 +1,13103 @@ + + +# 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. + +from __future__ import annotations +import os +import sys +import ctypes +import enum +import struct +import contextlib +import datetime +import threading +import itertools +import traceback +import typing +import asyncio +import platform + +# Used for default argument values +_DEFAULT = object() # type: typing.Any + + +class _UniffiRustBuffer(ctypes.Structure): + _fields_ = [ + ("capacity", ctypes.c_uint64), + ("len", ctypes.c_uint64), + ("data", ctypes.POINTER(ctypes.c_char)), + ] + + @staticmethod + def default(): + return _UniffiRustBuffer(0, 0, None) + + @staticmethod + def alloc(size): + return _uniffi_rust_call(_UniffiLib.ffi_iota_sdk_ffi_rustbuffer_alloc, size) + + @staticmethod + def reserve(rbuf, additional): + return _uniffi_rust_call(_UniffiLib.ffi_iota_sdk_ffi_rustbuffer_reserve, rbuf, additional) + + def free(self): + return _uniffi_rust_call(_UniffiLib.ffi_iota_sdk_ffi_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") + +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_UNEXPECTED_ERROR = 2 + + @staticmethod + def default(): + return _UniffiRustCallStatus(code=_UniffiRustCallStatus.CALL_SUCCESS, error_buf=_UniffiRustBuffer.default()) + + 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_UNEXPECTED_ERROR: + return "_UniffiRustCallStatus(CALL_UNEXPECTED_ERROR)" + else: + return "_UniffiRustCallStatus()" + +def _uniffi_rust_call(fn, *args): + # Call a rust function + return _uniffi_rust_call_with_error(None, fn, *args) + +def _uniffi_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.default() + + 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("_uniffi_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_UNEXPECTED_ERROR: + # 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)) + +def _uniffi_trait_interface_call(call_status, make_call, write_return_value): + try: + return write_return_value(make_call()) + except Exception as e: + call_status.code = _UniffiRustCallStatus.CALL_UNEXPECTED_ERROR + call_status.error_buf = _UniffiConverterString.lower(repr(e)) + +def _uniffi_trait_interface_call_with_error(call_status, make_call, write_return_value, error_type, lower_error): + try: + try: + return write_return_value(make_call()) + except error_type as e: + call_status.code = _UniffiRustCallStatus.CALL_ERROR + call_status.error_buf = lower_error(e) + except Exception as e: + call_status.code = _UniffiRustCallStatus.CALL_UNEXPECTED_ERROR + call_status.error_buf = _UniffiConverterString.lower(repr(e)) +class _UniffiHandleMap: + """ + A map where inserting, getting and removing data is synchronized with a lock. + """ + + def __init__(self): + # type Handle = int + self._map = {} # type: Dict[Handle, Any] + self._lock = threading.Lock() + self._counter = itertools.count() + + def insert(self, obj): + with self._lock: + handle = next(self._counter) + self._map[handle] = obj + return handle + + def get(self, handle): + try: + with self._lock: + return self._map[handle] + except KeyError: + raise InternalError("_UniffiHandleMap.get: Invalid handle") + + def remove(self, handle): + try: + with self._lock: + return self._map.pop(handle) + except KeyError: + raise InternalError("_UniffiHandleMap.remove: Invalid handle") + + def __len__(self): + return len(self._map) +# Types conforming to `_UniffiConverterPrimitive` pass themselves directly over the FFI. +class _UniffiConverterPrimitive: + @classmethod + def lift(cls, value): + return value + + @classmethod + def lower(cls, value): + return value + +class _UniffiConverterPrimitiveInt(_UniffiConverterPrimitive): + @classmethod + def check_lower(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)) + +class _UniffiConverterPrimitiveFloat(_UniffiConverterPrimitive): + @classmethod + def check_lower(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__)) + +# 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 + +""" +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_uint64, 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("iota_sdk_ffi") + 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 = 29 + # Get the scaffolding contract version by calling the into the dylib + scaffolding_contract_version = lib.ffi_iota_sdk_ffi_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_iota_sdk_ffi_checksum_method_address_to_bytes() != 57710: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_address_to_hex() != 22032: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_bls12381publickey_to_bytes() != 9890: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_checkpointcommitment_as_ecmh_live_object_set_digest() != 41616: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_checkpointcommitment_is_ecmh_live_object_set() != 22589: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_checkpointsummarypage_data() != 44115: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_checkpointsummarypage_is_empty() != 48209: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_checkpointsummarypage_page_info() != 63456: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_coin_balance() != 29928: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_coin_coin_type() != 18211: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_coin_id() != 40013: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_coinpage_data() != 29556: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_coinpage_is_empty() != 6966: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_coinpage_page_info() != 50368: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_dynamicfieldoutputpage_data() != 46262: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_dynamicfieldoutputpage_is_empty() != 38341: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_dynamicfieldoutputpage_page_info() != 21447: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_ed25519publickey_to_bytes() != 16656: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_epochpage_data() != 13705: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_epochpage_is_empty() != 19239: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_epochpage_page_info() != 57718: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_faucetclient_request() != 28782: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_faucetclient_request_and_wait() != 33961: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_faucetclient_request_status() != 52543: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_active_validators() != 7381: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_balance() != 7900: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_chain_id() != 64969: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_checkpoint() != 44276: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_checkpoints() != 60371: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_coin_metadata() != 43684: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_coins() != 32600: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_dry_run_tx() != 30963: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_dry_run_tx_kind() != 2819: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_dynamic_field() != 44529: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_dynamic_fields() != 17114: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_dynamic_object_field() != 30230: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_epoch() != 56696: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_epoch_total_checkpoints() != 46856: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_epoch_total_transaction_blocks() != 38784: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_epochs() != 28721: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_events() != 52220: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_execute_tx() != 21554: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_latest_checkpoint_sequence_number() != 57599: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_max_page_size() != 7485: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_move_object_contents() != 45984: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_move_object_contents_bcs() != 56613: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_normalized_move_function() != 55119: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_normalized_move_module() != 6469: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_object() != 19423: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_object_bcs() != 59810: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_objects() != 44576: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_package() != 16485: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_package_by_name() != 10686: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_package_latest() != 49400: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_package_versions() != 30956: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_packages() != 59954: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_protocol_config() != 6346: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_reference_gas_price() != 19973: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_service_config() != 55367: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_set_rpc_server() != 20273: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_total_supply() != 12543: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_total_transaction_blocks() != 37459: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_total_transaction_blocks_by_digest() != 770: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_total_transaction_blocks_by_seq_num() != 53241: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_transaction() != 56863: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_transaction_data_effects() != 3688: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_transaction_effects() != 32891: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_transactions() != 13103: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_transactions_data_effects() != 49700: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_transactions_effects() != 42153: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_movepackagepage_data() != 63718: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_movepackagepage_is_empty() != 64716: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_movepackagepage_page_info() != 5493: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_object_as_struct() != 2473: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_object_data() != 4330: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_object_object_id() != 6575: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_object_object_type() != 1843: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_object_owner() != 3724: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_object_previous_transaction() != 455: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_object_storage_rebate() != 24969: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_object_version() != 18433: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_objectid_to_address() != 21880: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_objectid_to_bytes() != 38367: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_objectid_to_hex() != 4418: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_objectpage_data() != 3639: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_objectpage_is_empty() != 56778: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_objectpage_page_info() != 10226: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_secp256k1publickey_to_bytes() != 49170: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_secp256r1publickey_to_bytes() != 21066: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_signedtransaction_signatures() != 59055: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_signedtransaction_transaction() != 60873: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_signedtransactionpage_data() != 7316: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_signedtransactionpage_is_empty() != 52119: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_signedtransactionpage_page_info() != 4757: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_transaction_expiration() != 4282: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_transaction_gas_payment() != 5316: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_transaction_kind() != 49492: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_transaction_sender() != 38190: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_transactiondataeffects_effects() != 62613: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_transactiondataeffects_tx() != 13303: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_transactiondataeffectspage_data() != 63792: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_transactiondataeffectspage_is_empty() != 31504: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_transactiondataeffectspage_page_info() != 59789: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_transactioneffectspage_data() != 20040: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_transactioneffectspage_is_empty() != 19615: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_transactioneffectspage_page_info() != 44668: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_transactioneventpage_data() != 64576: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_transactioneventpage_is_empty() != 45340: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_transactioneventpage_page_info() != 13980: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_validatorpage_data() != 23633: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_validatorpage_is_empty() != 5938: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_method_validatorpage_page_info() != 50813: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_address_from_bytes() != 47175: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_address_from_hex() != 15021: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_address_generate() != 48865: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381publickey_from_bytes() != 43705: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381publickey_from_str() != 52380: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381publickey_generate() != 30791: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_coin_try_from_object() != 8695: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_ed25519publickey_from_bytes() != 60161: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_ed25519publickey_from_str() != 40167: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_ed25519publickey_generate() != 46412: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_endofepochtransactionkind_authenticator_state_create() != 18946: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_endofepochtransactionkind_authenticator_state_expire() != 49861: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_endofepochtransactionkind_bridge_committee_init() != 35816: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_endofepochtransactionkind_bridge_state_create() != 11518: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_endofepochtransactionkind_change_epoch() != 16640: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_endofepochtransactionkind_change_epoch_v2() != 17262: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_endofepochtransactionkind_store_execution_time_observations() != 32604: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_faucetclient_devnet() != 37366: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_faucetclient_local() != 55393: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_faucetclient_new() != 13557: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_faucetclient_testnet() != 16109: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_graphqlclient_new() != 31562: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_graphqlclient_new_devnet() != 6494: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_graphqlclient_new_localhost() != 5570: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_graphqlclient_new_mainnet() != 3613: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_graphqlclient_new_testnet() != 48529: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_object_new() != 56232: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_objectid_from_bytes() != 47226: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_objectid_from_hex() != 14286: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_secp256k1publickey_from_bytes() != 2925: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_secp256k1publickey_from_str() != 43622: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_secp256k1publickey_generate() != 36411: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_secp256r1publickey_from_bytes() != 35682: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_secp256r1publickey_from_str() != 3131: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_secp256r1publickey_generate() != 49992: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_signedtransaction_new() != 6988: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_transaction_new() != 36271: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_transactiondataeffects_new() != 30302: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_transactionkind_authenticator_state_update_v1() != 37860: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_transactionkind_consensus_commit_prologue_v1() != 50635: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_transactionkind_end_of_epoch() != 65525: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_transactionkind_genesis() != 65272: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_transactionkind_programmable_transaction() != 51205: + raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") + if lib.uniffi_iota_sdk_ffi_checksum_constructor_transactionkind_randomness_state_update() != 45772: + 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() +_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK = ctypes.CFUNCTYPE(None,ctypes.c_uint64,ctypes.c_int8, +) +_UNIFFI_FOREIGN_FUTURE_FREE = ctypes.CFUNCTYPE(None,ctypes.c_uint64, +) +_UNIFFI_CALLBACK_INTERFACE_FREE = ctypes.CFUNCTYPE(None,ctypes.c_uint64, +) +class _UniffiForeignFuture(ctypes.Structure): + _fields_ = [ + ("handle", ctypes.c_uint64), + ("free", _UNIFFI_FOREIGN_FUTURE_FREE), + ] +class _UniffiForeignFutureStructU8(ctypes.Structure): + _fields_ = [ + ("return_value", ctypes.c_uint8), + ("call_status", _UniffiRustCallStatus), + ] +_UNIFFI_FOREIGN_FUTURE_COMPLETE_U8 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructU8, +) +class _UniffiForeignFutureStructI8(ctypes.Structure): + _fields_ = [ + ("return_value", ctypes.c_int8), + ("call_status", _UniffiRustCallStatus), + ] +_UNIFFI_FOREIGN_FUTURE_COMPLETE_I8 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructI8, +) +class _UniffiForeignFutureStructU16(ctypes.Structure): + _fields_ = [ + ("return_value", ctypes.c_uint16), + ("call_status", _UniffiRustCallStatus), + ] +_UNIFFI_FOREIGN_FUTURE_COMPLETE_U16 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructU16, +) +class _UniffiForeignFutureStructI16(ctypes.Structure): + _fields_ = [ + ("return_value", ctypes.c_int16), + ("call_status", _UniffiRustCallStatus), + ] +_UNIFFI_FOREIGN_FUTURE_COMPLETE_I16 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructI16, +) +class _UniffiForeignFutureStructU32(ctypes.Structure): + _fields_ = [ + ("return_value", ctypes.c_uint32), + ("call_status", _UniffiRustCallStatus), + ] +_UNIFFI_FOREIGN_FUTURE_COMPLETE_U32 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructU32, +) +class _UniffiForeignFutureStructI32(ctypes.Structure): + _fields_ = [ + ("return_value", ctypes.c_int32), + ("call_status", _UniffiRustCallStatus), + ] +_UNIFFI_FOREIGN_FUTURE_COMPLETE_I32 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructI32, +) +class _UniffiForeignFutureStructU64(ctypes.Structure): + _fields_ = [ + ("return_value", ctypes.c_uint64), + ("call_status", _UniffiRustCallStatus), + ] +_UNIFFI_FOREIGN_FUTURE_COMPLETE_U64 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructU64, +) +class _UniffiForeignFutureStructI64(ctypes.Structure): + _fields_ = [ + ("return_value", ctypes.c_int64), + ("call_status", _UniffiRustCallStatus), + ] +_UNIFFI_FOREIGN_FUTURE_COMPLETE_I64 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructI64, +) +class _UniffiForeignFutureStructF32(ctypes.Structure): + _fields_ = [ + ("return_value", ctypes.c_float), + ("call_status", _UniffiRustCallStatus), + ] +_UNIFFI_FOREIGN_FUTURE_COMPLETE_F32 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructF32, +) +class _UniffiForeignFutureStructF64(ctypes.Structure): + _fields_ = [ + ("return_value", ctypes.c_double), + ("call_status", _UniffiRustCallStatus), + ] +_UNIFFI_FOREIGN_FUTURE_COMPLETE_F64 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructF64, +) +class _UniffiForeignFutureStructPointer(ctypes.Structure): + _fields_ = [ + ("return_value", ctypes.c_void_p), + ("call_status", _UniffiRustCallStatus), + ] +_UNIFFI_FOREIGN_FUTURE_COMPLETE_POINTER = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructPointer, +) +class _UniffiForeignFutureStructRustBuffer(ctypes.Structure): + _fields_ = [ + ("return_value", _UniffiRustBuffer), + ("call_status", _UniffiRustCallStatus), + ] +_UNIFFI_FOREIGN_FUTURE_COMPLETE_RUST_BUFFER = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructRustBuffer, +) +class _UniffiForeignFutureStructVoid(ctypes.Structure): + _fields_ = [ + ("call_status", _UniffiRustCallStatus), + ] +_UNIFFI_FOREIGN_FUTURE_COMPLETE_VOID = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructVoid, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_address.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_address.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_address.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_address.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_address_from_bytes.argtypes = ( + _UniffiRustBuffer, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_address_from_bytes.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_address_from_hex.argtypes = ( + _UniffiRustBuffer, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_address_from_hex.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_address_generate.argtypes = ( + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_address_generate.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_address_to_bytes.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_address_to_bytes.restype = _UniffiRustBuffer +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_address_to_hex.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_address_to_hex.restype = _UniffiRustBuffer +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_authenticatorstateexpire.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_authenticatorstateexpire.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_authenticatorstateexpire.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_authenticatorstateexpire.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_authenticatorstateupdatev1.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_authenticatorstateupdatev1.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_authenticatorstateupdatev1.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_authenticatorstateupdatev1.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_batchsendstatus.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_batchsendstatus.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_batchsendstatus.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_batchsendstatus.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_bls12381publickey.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_bls12381publickey.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_bls12381publickey.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_bls12381publickey.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_bls12381publickey_from_bytes.argtypes = ( + _UniffiRustBuffer, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_bls12381publickey_from_bytes.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_bls12381publickey_from_str.argtypes = ( + _UniffiRustBuffer, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_bls12381publickey_from_str.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_bls12381publickey_generate.argtypes = ( + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_bls12381publickey_generate.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_bls12381publickey_to_bytes.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_bls12381publickey_to_bytes.restype = _UniffiRustBuffer +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_changeepoch.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_changeepoch.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_changeepoch.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_changeepoch.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_changeepochv2.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_changeepochv2.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_changeepochv2.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_changeepochv2.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_checkpointcommitment.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_checkpointcommitment.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_checkpointcommitment.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_checkpointcommitment.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_checkpointcommitment_as_ecmh_live_object_set_digest.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_checkpointcommitment_as_ecmh_live_object_set_digest.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_checkpointcommitment_is_ecmh_live_object_set.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_checkpointcommitment_is_ecmh_live_object_set.restype = ctypes.c_int8 +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_checkpointcontentsdigest.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_checkpointcontentsdigest.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_checkpointcontentsdigest.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_checkpointcontentsdigest.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_checkpointdigest.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_checkpointdigest.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_checkpointdigest.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_checkpointdigest.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_checkpointsummarypage.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_checkpointsummarypage.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_checkpointsummarypage.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_checkpointsummarypage.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_checkpointsummarypage_data.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_checkpointsummarypage_data.restype = _UniffiRustBuffer +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_checkpointsummarypage_is_empty.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_checkpointsummarypage_is_empty.restype = ctypes.c_int8 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_checkpointsummarypage_page_info.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_checkpointsummarypage_page_info.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_coin.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_coin.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_coin.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_coin.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_coin_try_from_object.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_coin_try_from_object.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_coin_balance.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_coin_balance.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_coin_coin_type.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_coin_coin_type.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_coin_id.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_coin_id.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_coinmetadata.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_coinmetadata.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_coinmetadata.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_coinmetadata.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_coinpage.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_coinpage.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_coinpage.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_coinpage.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_coinpage_data.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_coinpage_data.restype = _UniffiRustBuffer +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_coinpage_is_empty.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_coinpage_is_empty.restype = ctypes.c_int8 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_coinpage_page_info.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_coinpage_page_info.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_consensuscommitdigest.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_consensuscommitdigest.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_consensuscommitdigest.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_consensuscommitdigest.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_consensuscommitprologuev1.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_consensuscommitprologuev1.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_consensuscommitprologuev1.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_consensuscommitprologuev1.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_digest.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_digest.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_digest.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_digest.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_dryrunresult.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_dryrunresult.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_dryrunresult.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_dryrunresult.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_dynamicfieldoutput.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_dynamicfieldoutput.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_dynamicfieldoutput.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_dynamicfieldoutput.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_dynamicfieldoutputpage.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_dynamicfieldoutputpage.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_dynamicfieldoutputpage.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_dynamicfieldoutputpage.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_dynamicfieldoutputpage_data.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_dynamicfieldoutputpage_data.restype = _UniffiRustBuffer +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_dynamicfieldoutputpage_is_empty.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_dynamicfieldoutputpage_is_empty.restype = ctypes.c_int8 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_dynamicfieldoutputpage_page_info.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_dynamicfieldoutputpage_page_info.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_ed25519publickey.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_ed25519publickey.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_ed25519publickey.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_ed25519publickey.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_ed25519publickey_from_bytes.argtypes = ( + _UniffiRustBuffer, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_ed25519publickey_from_bytes.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_ed25519publickey_from_str.argtypes = ( + _UniffiRustBuffer, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_ed25519publickey_from_str.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_ed25519publickey_generate.argtypes = ( + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_ed25519publickey_generate.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_ed25519publickey_to_bytes.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_ed25519publickey_to_bytes.restype = _UniffiRustBuffer +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_effectsauxiliarydatadigest.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_effectsauxiliarydatadigest.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_effectsauxiliarydatadigest.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_effectsauxiliarydatadigest.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_endofepochtransactionkind.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_endofepochtransactionkind.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_endofepochtransactionkind.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_endofepochtransactionkind.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_endofepochtransactionkind_authenticator_state_create.argtypes = ( + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_endofepochtransactionkind_authenticator_state_create.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_endofepochtransactionkind_authenticator_state_expire.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_endofepochtransactionkind_authenticator_state_expire.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_endofepochtransactionkind_bridge_committee_init.argtypes = ( + ctypes.c_uint64, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_endofepochtransactionkind_bridge_committee_init.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_endofepochtransactionkind_bridge_state_create.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_endofepochtransactionkind_bridge_state_create.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_endofepochtransactionkind_change_epoch.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_endofepochtransactionkind_change_epoch.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_endofepochtransactionkind_change_epoch_v2.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_endofepochtransactionkind_change_epoch_v2.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_endofepochtransactionkind_store_execution_time_observations.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_endofepochtransactionkind_store_execution_time_observations.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_epoch.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_epoch.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_epoch.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_epoch.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_epochpage.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_epochpage.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_epochpage.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_epochpage.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_epochpage_data.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_epochpage_data.restype = _UniffiRustBuffer +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_epochpage_is_empty.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_epochpage_is_empty.restype = ctypes.c_int8 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_epochpage_page_info.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_epochpage_page_info.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_executiontimeobservations.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_executiontimeobservations.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_executiontimeobservations.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_executiontimeobservations.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_faucetclient.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_faucetclient.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_faucetclient.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_faucetclient.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_faucetclient_devnet.argtypes = ( + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_faucetclient_devnet.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_faucetclient_local.argtypes = ( + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_faucetclient_local.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_faucetclient_new.argtypes = ( + _UniffiRustBuffer, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_faucetclient_new.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_faucetclient_testnet.argtypes = ( + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_faucetclient_testnet.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_faucetclient_request.argtypes = ( + ctypes.c_void_p, + ctypes.c_void_p, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_faucetclient_request.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_faucetclient_request_and_wait.argtypes = ( + ctypes.c_void_p, + ctypes.c_void_p, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_faucetclient_request_and_wait.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_faucetclient_request_status.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_faucetclient_request_status.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_faucetreceipt.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_faucetreceipt.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_faucetreceipt.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_faucetreceipt.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_genesistransaction.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_genesistransaction.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_genesistransaction.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_genesistransaction.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_graphqlclient.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_graphqlclient.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_graphqlclient.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_graphqlclient.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_graphqlclient_new.argtypes = ( + _UniffiRustBuffer, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_graphqlclient_new.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_graphqlclient_new_devnet.argtypes = ( + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_graphqlclient_new_devnet.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_graphqlclient_new_localhost.argtypes = ( + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_graphqlclient_new_localhost.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_graphqlclient_new_mainnet.argtypes = ( + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_graphqlclient_new_mainnet.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_graphqlclient_new_testnet.argtypes = ( + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_graphqlclient_new_testnet.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_active_validators.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_active_validators.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_balance.argtypes = ( + ctypes.c_void_p, + ctypes.c_void_p, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_balance.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_chain_id.argtypes = ( + ctypes.c_void_p, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_chain_id.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_checkpoint.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_checkpoint.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_checkpoints.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_checkpoints.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_coin_metadata.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_coin_metadata.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_coins.argtypes = ( + ctypes.c_void_p, + ctypes.c_void_p, + _UniffiRustBuffer, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_coins.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_dry_run_tx.argtypes = ( + ctypes.c_void_p, + ctypes.c_void_p, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_dry_run_tx.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_dry_run_tx_kind.argtypes = ( + ctypes.c_void_p, + ctypes.c_void_p, + _UniffiRustBuffer, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_dry_run_tx_kind.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_dynamic_field.argtypes = ( + ctypes.c_void_p, + ctypes.c_void_p, + ctypes.c_void_p, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_dynamic_field.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_dynamic_fields.argtypes = ( + ctypes.c_void_p, + ctypes.c_void_p, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_dynamic_fields.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_dynamic_object_field.argtypes = ( + ctypes.c_void_p, + ctypes.c_void_p, + ctypes.c_void_p, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_dynamic_object_field.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_epoch.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_epoch.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_epoch_total_checkpoints.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_epoch_total_checkpoints.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_epoch_total_transaction_blocks.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_epoch_total_transaction_blocks.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_epochs.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_epochs.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_events.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_events.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_execute_tx.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, + ctypes.c_void_p, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_execute_tx.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_latest_checkpoint_sequence_number.argtypes = ( + ctypes.c_void_p, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_latest_checkpoint_sequence_number.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_max_page_size.argtypes = ( + ctypes.c_void_p, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_max_page_size.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_move_object_contents.argtypes = ( + ctypes.c_void_p, + ctypes.c_void_p, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_move_object_contents.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_move_object_contents_bcs.argtypes = ( + ctypes.c_void_p, + ctypes.c_void_p, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_move_object_contents_bcs.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_normalized_move_function.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, + _UniffiRustBuffer, + _UniffiRustBuffer, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_normalized_move_function.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_normalized_move_module.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, + _UniffiRustBuffer, + _UniffiRustBuffer, + _UniffiRustBuffer, + _UniffiRustBuffer, + _UniffiRustBuffer, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_normalized_move_module.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_object.argtypes = ( + ctypes.c_void_p, + ctypes.c_void_p, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_object.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_object_bcs.argtypes = ( + ctypes.c_void_p, + ctypes.c_void_p, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_object_bcs.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_objects.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_objects.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_package.argtypes = ( + ctypes.c_void_p, + ctypes.c_void_p, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_package.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_package_by_name.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_package_by_name.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_package_latest.argtypes = ( + ctypes.c_void_p, + ctypes.c_void_p, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_package_latest.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_package_versions.argtypes = ( + ctypes.c_void_p, + ctypes.c_void_p, + _UniffiRustBuffer, + _UniffiRustBuffer, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_package_versions.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_packages.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, + _UniffiRustBuffer, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_packages.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_protocol_config.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_protocol_config.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_reference_gas_price.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_reference_gas_price.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_service_config.argtypes = ( + ctypes.c_void_p, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_service_config.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_set_rpc_server.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_set_rpc_server.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_total_supply.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_total_supply.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_total_transaction_blocks.argtypes = ( + ctypes.c_void_p, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_total_transaction_blocks.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_total_transaction_blocks_by_digest.argtypes = ( + ctypes.c_void_p, + ctypes.c_void_p, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_total_transaction_blocks_by_digest.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_total_transaction_blocks_by_seq_num.argtypes = ( + ctypes.c_void_p, + ctypes.c_uint64, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_total_transaction_blocks_by_seq_num.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_transaction.argtypes = ( + ctypes.c_void_p, + ctypes.c_void_p, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_transaction.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_transaction_data_effects.argtypes = ( + ctypes.c_void_p, + ctypes.c_void_p, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_transaction_data_effects.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_transaction_effects.argtypes = ( + ctypes.c_void_p, + ctypes.c_void_p, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_transaction_effects.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_transactions.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_transactions.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_transactions_data_effects.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_transactions_data_effects.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_transactions_effects.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, + _UniffiRustBuffer, +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_transactions_effects.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_movefunction.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_movefunction.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_movefunction.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_movefunction.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_movemodule.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_movemodule.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_movemodule.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_movemodule.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_movepackage.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_movepackage.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_movepackage.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_movepackage.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_movepackagepage.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_movepackagepage.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_movepackagepage.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_movepackagepage.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_movepackagepage_data.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_movepackagepage_data.restype = _UniffiRustBuffer +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_movepackagepage_is_empty.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_movepackagepage_is_empty.restype = ctypes.c_int8 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_movepackagepage_page_info.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_movepackagepage_page_info.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_movestruct.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_movestruct.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_movestruct.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_movestruct.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_object.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_object.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_object.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_object.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_object_new.argtypes = ( + ctypes.c_void_p, + ctypes.c_void_p, + ctypes.c_void_p, + ctypes.c_uint64, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_object_new.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_object_as_struct.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_object_as_struct.restype = _UniffiRustBuffer +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_object_data.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_object_data.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_object_object_id.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_object_object_id.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_object_object_type.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_object_object_type.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_object_owner.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_object_owner.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_object_previous_transaction.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_object_previous_transaction.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_object_storage_rebate.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_object_storage_rebate.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_object_version.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_object_version.restype = ctypes.c_uint64 +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_objectdata.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_objectdata.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_objectdata.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_objectdata.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_objectdigest.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_objectdigest.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_objectdigest.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_objectdigest.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_objectfilter.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_objectfilter.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_objectfilter.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_objectfilter.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_objectid.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_objectid.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_objectid.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_objectid.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_objectid_from_bytes.argtypes = ( + _UniffiRustBuffer, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_objectid_from_bytes.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_objectid_from_hex.argtypes = ( + _UniffiRustBuffer, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_objectid_from_hex.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_objectid_to_address.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_objectid_to_address.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_objectid_to_bytes.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_objectid_to_bytes.restype = _UniffiRustBuffer +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_objectid_to_hex.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_objectid_to_hex.restype = _UniffiRustBuffer +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_objectpage.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_objectpage.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_objectpage.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_objectpage.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_objectpage_data.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_objectpage_data.restype = _UniffiRustBuffer +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_objectpage_is_empty.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_objectpage_is_empty.restype = ctypes.c_int8 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_objectpage_page_info.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_objectpage_page_info.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_objectref.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_objectref.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_objectref.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_objectref.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_objecttype.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_objecttype.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_objecttype.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_objecttype.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_owner.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_owner.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_owner.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_owner.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_pageinfo.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_pageinfo.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_pageinfo.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_pageinfo.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_programmabletransaction.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_programmabletransaction.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_programmabletransaction.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_programmabletransaction.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_protocolconfigs.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_protocolconfigs.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_protocolconfigs.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_protocolconfigs.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_randomnessstateupdate.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_randomnessstateupdate.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_randomnessstateupdate.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_randomnessstateupdate.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_secp256k1publickey.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_secp256k1publickey.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_secp256k1publickey.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_secp256k1publickey.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_secp256k1publickey_from_bytes.argtypes = ( + _UniffiRustBuffer, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_secp256k1publickey_from_bytes.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_secp256k1publickey_from_str.argtypes = ( + _UniffiRustBuffer, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_secp256k1publickey_from_str.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_secp256k1publickey_generate.argtypes = ( + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_secp256k1publickey_generate.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_secp256k1publickey_to_bytes.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_secp256k1publickey_to_bytes.restype = _UniffiRustBuffer +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_secp256r1publickey.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_secp256r1publickey.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_secp256r1publickey.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_secp256r1publickey.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_secp256r1publickey_from_bytes.argtypes = ( + _UniffiRustBuffer, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_secp256r1publickey_from_bytes.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_secp256r1publickey_from_str.argtypes = ( + _UniffiRustBuffer, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_secp256r1publickey_from_str.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_secp256r1publickey_generate.argtypes = ( + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_secp256r1publickey_generate.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_secp256r1publickey_to_bytes.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_secp256r1publickey_to_bytes.restype = _UniffiRustBuffer +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_serviceconfig.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_serviceconfig.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_serviceconfig.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_serviceconfig.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_signedtransaction.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_signedtransaction.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_signedtransaction.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_signedtransaction.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_signedtransaction_new.argtypes = ( + ctypes.c_void_p, + _UniffiRustBuffer, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_signedtransaction_new.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_signedtransaction_signatures.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_signedtransaction_signatures.restype = _UniffiRustBuffer +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_signedtransaction_transaction.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_signedtransaction_transaction.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_signedtransactionpage.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_signedtransactionpage.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_signedtransactionpage.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_signedtransactionpage.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_signedtransactionpage_data.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_signedtransactionpage_data.restype = _UniffiRustBuffer +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_signedtransactionpage_is_empty.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_signedtransactionpage_is_empty.restype = ctypes.c_int8 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_signedtransactionpage_page_info.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_signedtransactionpage_page_info.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transaction.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transaction.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transaction.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transaction.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_transaction_new.argtypes = ( + ctypes.c_void_p, + ctypes.c_void_p, + _UniffiRustBuffer, + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_transaction_new.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transaction_expiration.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transaction_expiration.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transaction_gas_payment.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transaction_gas_payment.restype = _UniffiRustBuffer +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transaction_kind.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transaction_kind.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transaction_sender.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transaction_sender.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactiondataeffects.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactiondataeffects.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactiondataeffects.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactiondataeffects.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_transactiondataeffects_new.argtypes = ( + ctypes.c_void_p, + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_transactiondataeffects_new.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactiondataeffects_effects.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactiondataeffects_effects.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactiondataeffects_tx.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactiondataeffects_tx.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactiondataeffectspage.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactiondataeffectspage.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactiondataeffectspage.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactiondataeffectspage.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactiondataeffectspage_data.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactiondataeffectspage_data.restype = _UniffiRustBuffer +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactiondataeffectspage_is_empty.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactiondataeffectspage_is_empty.restype = ctypes.c_int8 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactiondataeffectspage_page_info.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactiondataeffectspage_page_info.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactiondigest.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactiondigest.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactiondigest.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactiondigest.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactioneffects.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactioneffects.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactioneffects.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactioneffects.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactioneffectsdigest.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactioneffectsdigest.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactioneffectsdigest.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactioneffectsdigest.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactioneffectspage.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactioneffectspage.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactioneffectspage.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactioneffectspage.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactioneffectspage_data.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactioneffectspage_data.restype = _UniffiRustBuffer +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactioneffectspage_is_empty.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactioneffectspage_is_empty.restype = ctypes.c_int8 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactioneffectspage_page_info.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactioneffectspage_page_info.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactionevent.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactionevent.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactionevent.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactionevent.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactioneventpage.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactioneventpage.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactioneventpage.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactioneventpage.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactioneventpage_data.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactioneventpage_data.restype = _UniffiRustBuffer +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactioneventpage_is_empty.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactioneventpage_is_empty.restype = ctypes.c_int8 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactioneventpage_page_info.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactioneventpage_page_info.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactioneventsdigest.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactioneventsdigest.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactioneventsdigest.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactioneventsdigest.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactionexpiration.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactionexpiration.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactionexpiration.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactionexpiration.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactionkind.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactionkind.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactionkind.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactionkind.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_transactionkind_authenticator_state_update_v1.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_transactionkind_authenticator_state_update_v1.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_transactionkind_consensus_commit_prologue_v1.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_transactionkind_consensus_commit_prologue_v1.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_transactionkind_end_of_epoch.argtypes = ( + _UniffiRustBuffer, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_transactionkind_end_of_epoch.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_transactionkind_genesis.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_transactionkind_genesis.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_transactionkind_programmable_transaction.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_transactionkind_programmable_transaction.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_transactionkind_randomness_state_update.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_transactionkind_randomness_state_update.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_typetag.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_typetag.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_typetag.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_typetag.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_usersignature.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_usersignature.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_usersignature.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_usersignature.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_validator.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_validator.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_validator.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_validator.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_validatorpage.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_validatorpage.restype = ctypes.c_void_p +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_validatorpage.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_free_validatorpage.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorpage_data.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorpage_data.restype = _UniffiRustBuffer +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorpage_is_empty.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorpage_is_empty.restype = ctypes.c_int8 +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorpage_page_info.argtypes = ( + ctypes.c_void_p, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorpage_page_info.restype = ctypes.c_void_p +_UniffiLib.ffi_iota_sdk_ffi_rustbuffer_alloc.argtypes = ( + ctypes.c_uint64, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.ffi_iota_sdk_ffi_rustbuffer_alloc.restype = _UniffiRustBuffer +_UniffiLib.ffi_iota_sdk_ffi_rustbuffer_from_bytes.argtypes = ( + _UniffiForeignBytes, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.ffi_iota_sdk_ffi_rustbuffer_from_bytes.restype = _UniffiRustBuffer +_UniffiLib.ffi_iota_sdk_ffi_rustbuffer_free.argtypes = ( + _UniffiRustBuffer, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.ffi_iota_sdk_ffi_rustbuffer_free.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rustbuffer_reserve.argtypes = ( + _UniffiRustBuffer, + ctypes.c_uint64, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.ffi_iota_sdk_ffi_rustbuffer_reserve.restype = _UniffiRustBuffer +_UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_u8.argtypes = ( + ctypes.c_uint64, + _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_u8.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_cancel_u8.argtypes = ( + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_cancel_u8.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_free_u8.argtypes = ( + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_free_u8.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_u8.argtypes = ( + ctypes.c_uint64, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_u8.restype = ctypes.c_uint8 +_UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_i8.argtypes = ( + ctypes.c_uint64, + _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_i8.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_cancel_i8.argtypes = ( + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_cancel_i8.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_free_i8.argtypes = ( + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_free_i8.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_i8.argtypes = ( + ctypes.c_uint64, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_i8.restype = ctypes.c_int8 +_UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_u16.argtypes = ( + ctypes.c_uint64, + _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_u16.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_cancel_u16.argtypes = ( + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_cancel_u16.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_free_u16.argtypes = ( + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_free_u16.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_u16.argtypes = ( + ctypes.c_uint64, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_u16.restype = ctypes.c_uint16 +_UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_i16.argtypes = ( + ctypes.c_uint64, + _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_i16.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_cancel_i16.argtypes = ( + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_cancel_i16.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_free_i16.argtypes = ( + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_free_i16.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_i16.argtypes = ( + ctypes.c_uint64, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_i16.restype = ctypes.c_int16 +_UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_u32.argtypes = ( + ctypes.c_uint64, + _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_u32.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_cancel_u32.argtypes = ( + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_cancel_u32.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_free_u32.argtypes = ( + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_free_u32.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_u32.argtypes = ( + ctypes.c_uint64, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_u32.restype = ctypes.c_uint32 +_UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_i32.argtypes = ( + ctypes.c_uint64, + _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_i32.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_cancel_i32.argtypes = ( + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_cancel_i32.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_free_i32.argtypes = ( + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_free_i32.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_i32.argtypes = ( + ctypes.c_uint64, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_i32.restype = ctypes.c_int32 +_UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_u64.argtypes = ( + ctypes.c_uint64, + _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_u64.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_cancel_u64.argtypes = ( + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_cancel_u64.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_free_u64.argtypes = ( + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_free_u64.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_u64.argtypes = ( + ctypes.c_uint64, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_u64.restype = ctypes.c_uint64 +_UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_i64.argtypes = ( + ctypes.c_uint64, + _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_i64.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_cancel_i64.argtypes = ( + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_cancel_i64.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_free_i64.argtypes = ( + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_free_i64.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_i64.argtypes = ( + ctypes.c_uint64, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_i64.restype = ctypes.c_int64 +_UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_f32.argtypes = ( + ctypes.c_uint64, + _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_f32.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_cancel_f32.argtypes = ( + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_cancel_f32.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_free_f32.argtypes = ( + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_free_f32.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_f32.argtypes = ( + ctypes.c_uint64, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_f32.restype = ctypes.c_float +_UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_f64.argtypes = ( + ctypes.c_uint64, + _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_f64.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_cancel_f64.argtypes = ( + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_cancel_f64.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_free_f64.argtypes = ( + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_free_f64.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_f64.argtypes = ( + ctypes.c_uint64, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_f64.restype = ctypes.c_double +_UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_pointer.argtypes = ( + ctypes.c_uint64, + _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_pointer.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_cancel_pointer.argtypes = ( + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_cancel_pointer.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_free_pointer.argtypes = ( + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_free_pointer.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_pointer.argtypes = ( + ctypes.c_uint64, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_pointer.restype = ctypes.c_void_p +_UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer.argtypes = ( + ctypes.c_uint64, + _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_cancel_rust_buffer.argtypes = ( + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_cancel_rust_buffer.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer.argtypes = ( + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer.argtypes = ( + ctypes.c_uint64, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer.restype = _UniffiRustBuffer +_UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_void.argtypes = ( + ctypes.c_uint64, + _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_void.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_cancel_void.argtypes = ( + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_cancel_void.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_free_void.argtypes = ( + ctypes.c_uint64, +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_free_void.restype = None +_UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_void.argtypes = ( + ctypes.c_uint64, + ctypes.POINTER(_UniffiRustCallStatus), +) +_UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_void.restype = None +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_address_to_bytes.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_address_to_bytes.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_address_to_hex.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_address_to_hex.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_bls12381publickey_to_bytes.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_bls12381publickey_to_bytes.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_checkpointcommitment_as_ecmh_live_object_set_digest.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_checkpointcommitment_as_ecmh_live_object_set_digest.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_checkpointcommitment_is_ecmh_live_object_set.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_checkpointcommitment_is_ecmh_live_object_set.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_checkpointsummarypage_data.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_checkpointsummarypage_data.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_checkpointsummarypage_is_empty.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_checkpointsummarypage_is_empty.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_checkpointsummarypage_page_info.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_checkpointsummarypage_page_info.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_coin_balance.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_coin_balance.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_coin_coin_type.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_coin_coin_type.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_coin_id.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_coin_id.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_coinpage_data.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_coinpage_data.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_coinpage_is_empty.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_coinpage_is_empty.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_coinpage_page_info.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_coinpage_page_info.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_dynamicfieldoutputpage_data.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_dynamicfieldoutputpage_data.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_dynamicfieldoutputpage_is_empty.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_dynamicfieldoutputpage_is_empty.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_dynamicfieldoutputpage_page_info.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_dynamicfieldoutputpage_page_info.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_ed25519publickey_to_bytes.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_ed25519publickey_to_bytes.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_epochpage_data.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_epochpage_data.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_epochpage_is_empty.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_epochpage_is_empty.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_epochpage_page_info.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_epochpage_page_info.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_faucetclient_request.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_faucetclient_request.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_faucetclient_request_and_wait.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_faucetclient_request_and_wait.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_faucetclient_request_status.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_faucetclient_request_status.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_active_validators.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_active_validators.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_balance.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_balance.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_chain_id.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_chain_id.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_checkpoint.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_checkpoint.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_checkpoints.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_checkpoints.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_coin_metadata.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_coin_metadata.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_coins.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_coins.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_dry_run_tx.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_dry_run_tx.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_dry_run_tx_kind.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_dry_run_tx_kind.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_dynamic_field.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_dynamic_field.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_dynamic_fields.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_dynamic_fields.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_dynamic_object_field.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_dynamic_object_field.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_epoch.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_epoch.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_epoch_total_checkpoints.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_epoch_total_checkpoints.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_epoch_total_transaction_blocks.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_epoch_total_transaction_blocks.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_epochs.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_epochs.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_events.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_events.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_execute_tx.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_execute_tx.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_latest_checkpoint_sequence_number.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_latest_checkpoint_sequence_number.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_max_page_size.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_max_page_size.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_move_object_contents.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_move_object_contents.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_move_object_contents_bcs.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_move_object_contents_bcs.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_normalized_move_function.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_normalized_move_function.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_normalized_move_module.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_normalized_move_module.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_object.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_object.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_object_bcs.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_object_bcs.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_objects.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_objects.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_package.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_package.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_package_by_name.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_package_by_name.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_package_latest.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_package_latest.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_package_versions.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_package_versions.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_packages.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_packages.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_protocol_config.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_protocol_config.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_reference_gas_price.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_reference_gas_price.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_service_config.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_service_config.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_set_rpc_server.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_set_rpc_server.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_total_supply.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_total_supply.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_total_transaction_blocks.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_total_transaction_blocks.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_total_transaction_blocks_by_digest.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_total_transaction_blocks_by_digest.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_total_transaction_blocks_by_seq_num.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_total_transaction_blocks_by_seq_num.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_transaction.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_transaction.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_transaction_data_effects.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_transaction_data_effects.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_transaction_effects.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_transaction_effects.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_transactions.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_transactions.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_transactions_data_effects.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_transactions_data_effects.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_transactions_effects.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_graphqlclient_transactions_effects.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_movepackagepage_data.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_movepackagepage_data.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_movepackagepage_is_empty.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_movepackagepage_is_empty.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_movepackagepage_page_info.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_movepackagepage_page_info.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_object_as_struct.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_object_as_struct.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_object_data.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_object_data.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_object_object_id.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_object_object_id.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_object_object_type.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_object_object_type.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_object_owner.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_object_owner.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_object_previous_transaction.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_object_previous_transaction.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_object_storage_rebate.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_object_storage_rebate.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_object_version.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_object_version.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_objectid_to_address.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_objectid_to_address.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_objectid_to_bytes.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_objectid_to_bytes.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_objectid_to_hex.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_objectid_to_hex.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_objectpage_data.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_objectpage_data.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_objectpage_is_empty.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_objectpage_is_empty.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_objectpage_page_info.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_objectpage_page_info.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_secp256k1publickey_to_bytes.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_secp256k1publickey_to_bytes.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_secp256r1publickey_to_bytes.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_secp256r1publickey_to_bytes.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_signedtransaction_signatures.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_signedtransaction_signatures.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_signedtransaction_transaction.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_signedtransaction_transaction.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_signedtransactionpage_data.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_signedtransactionpage_data.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_signedtransactionpage_is_empty.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_signedtransactionpage_is_empty.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_signedtransactionpage_page_info.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_signedtransactionpage_page_info.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transaction_expiration.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transaction_expiration.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transaction_gas_payment.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transaction_gas_payment.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transaction_kind.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transaction_kind.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transaction_sender.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transaction_sender.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transactiondataeffects_effects.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transactiondataeffects_effects.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transactiondataeffects_tx.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transactiondataeffects_tx.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transactiondataeffectspage_data.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transactiondataeffectspage_data.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transactiondataeffectspage_is_empty.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transactiondataeffectspage_is_empty.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transactiondataeffectspage_page_info.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transactiondataeffectspage_page_info.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transactioneffectspage_data.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transactioneffectspage_data.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transactioneffectspage_is_empty.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transactioneffectspage_is_empty.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transactioneffectspage_page_info.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transactioneffectspage_page_info.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transactioneventpage_data.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transactioneventpage_data.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transactioneventpage_is_empty.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transactioneventpage_is_empty.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transactioneventpage_page_info.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_transactioneventpage_page_info.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorpage_data.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorpage_data.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorpage_is_empty.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorpage_is_empty.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorpage_page_info.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_method_validatorpage_page_info.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_address_from_bytes.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_address_from_bytes.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_address_from_hex.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_address_from_hex.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_address_generate.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_address_generate.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381publickey_from_bytes.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381publickey_from_bytes.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381publickey_from_str.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381publickey_from_str.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381publickey_generate.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_bls12381publickey_generate.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_coin_try_from_object.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_coin_try_from_object.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_ed25519publickey_from_bytes.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_ed25519publickey_from_bytes.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_ed25519publickey_from_str.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_ed25519publickey_from_str.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_ed25519publickey_generate.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_ed25519publickey_generate.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_endofepochtransactionkind_authenticator_state_create.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_endofepochtransactionkind_authenticator_state_create.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_endofepochtransactionkind_authenticator_state_expire.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_endofepochtransactionkind_authenticator_state_expire.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_endofepochtransactionkind_bridge_committee_init.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_endofepochtransactionkind_bridge_committee_init.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_endofepochtransactionkind_bridge_state_create.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_endofepochtransactionkind_bridge_state_create.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_endofepochtransactionkind_change_epoch.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_endofepochtransactionkind_change_epoch.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_endofepochtransactionkind_change_epoch_v2.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_endofepochtransactionkind_change_epoch_v2.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_endofepochtransactionkind_store_execution_time_observations.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_endofepochtransactionkind_store_execution_time_observations.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_faucetclient_devnet.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_faucetclient_devnet.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_faucetclient_local.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_faucetclient_local.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_faucetclient_new.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_faucetclient_new.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_faucetclient_testnet.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_faucetclient_testnet.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_graphqlclient_new.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_graphqlclient_new.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_graphqlclient_new_devnet.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_graphqlclient_new_devnet.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_graphqlclient_new_localhost.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_graphqlclient_new_localhost.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_graphqlclient_new_mainnet.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_graphqlclient_new_mainnet.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_graphqlclient_new_testnet.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_graphqlclient_new_testnet.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_object_new.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_object_new.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_objectid_from_bytes.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_objectid_from_bytes.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_objectid_from_hex.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_objectid_from_hex.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_secp256k1publickey_from_bytes.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_secp256k1publickey_from_bytes.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_secp256k1publickey_from_str.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_secp256k1publickey_from_str.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_secp256k1publickey_generate.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_secp256k1publickey_generate.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_secp256r1publickey_from_bytes.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_secp256r1publickey_from_bytes.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_secp256r1publickey_from_str.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_secp256r1publickey_from_str.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_secp256r1publickey_generate.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_secp256r1publickey_generate.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_signedtransaction_new.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_signedtransaction_new.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_transaction_new.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_transaction_new.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_transactiondataeffects_new.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_transactiondataeffects_new.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_transactionkind_authenticator_state_update_v1.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_transactionkind_authenticator_state_update_v1.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_transactionkind_consensus_commit_prologue_v1.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_transactionkind_consensus_commit_prologue_v1.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_transactionkind_end_of_epoch.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_transactionkind_end_of_epoch.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_transactionkind_genesis.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_transactionkind_genesis.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_transactionkind_programmable_transaction.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_transactionkind_programmable_transaction.restype = ctypes.c_uint16 +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_transactionkind_randomness_state_update.argtypes = ( +) +_UniffiLib.uniffi_iota_sdk_ffi_checksum_constructor_transactionkind_randomness_state_update.restype = ctypes.c_uint16 +_UniffiLib.ffi_iota_sdk_ffi_uniffi_contract_version.argtypes = ( +) +_UniffiLib.ffi_iota_sdk_ffi_uniffi_contract_version.restype = ctypes.c_uint32 + +_uniffi_check_contract_api_version(_UniffiLib) +# _uniffi_check_api_checksums(_UniffiLib) + +# Public interface members begin here. + + +class _UniffiConverterInt32(_UniffiConverterPrimitiveInt): + CLASS_NAME = "i32" + VALUE_MIN = -2**31 + VALUE_MAX = 2**31 + + @staticmethod + def read(buf): + return buf.read_i32() + + @staticmethod + def write(value, buf): + buf.write_i32(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(value, buf): + buf.write_u64(value) + +class _UniffiConverterInt64(_UniffiConverterPrimitiveInt): + CLASS_NAME = "i64" + VALUE_MIN = -2**63 + VALUE_MAX = 2**63 + + @staticmethod + def read(buf): + return buf.read_i64() + + @staticmethod + def write(value, buf): + buf.write_i64(value) + +class _UniffiConverterBool: + @classmethod + def check_lower(cls, value): + return not not value + + @classmethod + def lower(cls, value): + return 1 if value else 0 + + @staticmethod + def lift(value): + return value != 0 + + @classmethod + def read(cls, buf): + return cls.lift(buf.read_u8()) + + @classmethod + def write(cls, value, buf): + buf.write_u8(value) + +class _UniffiConverterString: + @staticmethod + def check_lower(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): + 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): + with _UniffiRustBuffer.alloc_with_builder() as builder: + builder.write(value.encode("utf-8")) + return builder.finalize() + +class _UniffiConverterBytes(_UniffiConverterRustBuffer): + @staticmethod + def read(buf): + size = buf.read_i32() + if size < 0: + raise InternalError("Unexpected negative byte string length") + return buf.read(size) + + @staticmethod + def check_lower(value): + try: + memoryview(value) + except TypeError: + raise TypeError("a bytes-like object is required, not {!r}".format(type(value).__name__)) + + @staticmethod + def write(value, buf): + buf.write_i32(len(value)) + buf.write(value) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +class CheckpointSummary: + """ + A header for a Checkpoint on the IOTA blockchain. + + On the IOTA network, checkpoints define the history of the blockchain. They + are quite similar to the concept of blocks used by other blockchains like + Bitcoin or Ethereum. The IOTA blockchain, however, forms checkpoints after + transaction execution has already happened to provide a certified history of + the chain, instead of being formed before execution. + + Checkpoints commit to a variety of state including but not limited to: + - The hash of the previous checkpoint. + - The set of transaction digests, their corresponding effects digests, as + well as the set of user signatures which authorized its execution. + - The object's produced by a transaction. + - The set of live objects that make up the current state of the chain. + - On epoch transitions, the next validator committee. + + `CheckpointSummary`s themselves don't directly include all of the above + information but they are the top-level type by which all the above are + committed to transitively via cryptographic hashes included in the summary. + `CheckpointSummary`s are signed and certified by a quorum of the validator + committee in a given epoch in order to allow verification of the chain's + state. + + # BCS + + The BCS serialized form for this type is defined by the following ABNF: + + ```text + checkpoint-summary = u64 ; epoch + u64 ; sequence_number + u64 ; network_total_transactions + digest ; content_digest + (option digest) ; previous_digest + gas-cost-summary ; epoch_rolling_gas_cost_summary + u64 ; timestamp_ms + (vector checkpoint-commitment) ; checkpoint_commitments + (option end-of-epoch-data) ; end_of_epoch_data + bytes ; version_specific_data + ``` + """ + + epoch: "int" + """ + Epoch that this checkpoint belongs to. + """ + + sequence_number: "int" + """ + The height of this checkpoint. + """ + + network_total_transactions: "int" + """ + Total number of transactions committed since genesis, including those in + this checkpoint. + """ + + content_digest: "CheckpointContentsDigest" + """ + The hash of the `CheckpointContents` for this checkpoint. + """ + + previous_digest: "typing.Optional[CheckpointDigest]" + """ + The hash of the previous `CheckpointSummary`. + + This will be only be `None` for the first, or genesis checkpoint. + """ + + epoch_rolling_gas_cost_summary: "GasCostSummary" + """ + The running total gas costs of all transactions included in the current + epoch so far until this checkpoint. + """ + + timestamp_ms: "int" + """ + Timestamp of the checkpoint - number of milliseconds from the Unix epoch + Checkpoint timestamps are monotonic, but not strongly monotonic - + subsequent checkpoints can have same timestamp if they originate + from the same underlining consensus commit + """ + + checkpoint_commitments: "typing.List[CheckpointCommitment]" + """ + Commitments to checkpoint-specific state. + """ + + end_of_epoch_data: "typing.Optional[EndOfEpochData]" + """ + Extra data only present in the final checkpoint of an epoch. + """ + + version_specific_data: "bytes" + """ + CheckpointSummary is not an evolvable structure - it must be readable by + any version of the code. Therefore, in order to allow extensions to + be added to CheckpointSummary, we allow opaque data to be added to + checkpoints which can be deserialized based on the current + protocol version. + """ + + def __init__(self, *, epoch: "int", sequence_number: "int", network_total_transactions: "int", content_digest: "CheckpointContentsDigest", previous_digest: "typing.Optional[CheckpointDigest]", epoch_rolling_gas_cost_summary: "GasCostSummary", timestamp_ms: "int", checkpoint_commitments: "typing.List[CheckpointCommitment]", end_of_epoch_data: "typing.Optional[EndOfEpochData]", version_specific_data: "bytes"): + self.epoch = epoch + self.sequence_number = sequence_number + self.network_total_transactions = network_total_transactions + self.content_digest = content_digest + self.previous_digest = previous_digest + self.epoch_rolling_gas_cost_summary = epoch_rolling_gas_cost_summary + self.timestamp_ms = timestamp_ms + self.checkpoint_commitments = checkpoint_commitments + self.end_of_epoch_data = end_of_epoch_data + self.version_specific_data = version_specific_data + + def __str__(self): + return "CheckpointSummary(epoch={}, sequence_number={}, network_total_transactions={}, content_digest={}, previous_digest={}, epoch_rolling_gas_cost_summary={}, timestamp_ms={}, checkpoint_commitments={}, end_of_epoch_data={}, version_specific_data={})".format(self.epoch, self.sequence_number, self.network_total_transactions, self.content_digest, self.previous_digest, self.epoch_rolling_gas_cost_summary, self.timestamp_ms, self.checkpoint_commitments, self.end_of_epoch_data, self.version_specific_data) + + def __eq__(self, other): + if self.epoch != other.epoch: + return False + if self.sequence_number != other.sequence_number: + return False + if self.network_total_transactions != other.network_total_transactions: + return False + if self.content_digest != other.content_digest: + return False + if self.previous_digest != other.previous_digest: + return False + if self.epoch_rolling_gas_cost_summary != other.epoch_rolling_gas_cost_summary: + return False + if self.timestamp_ms != other.timestamp_ms: + return False + if self.checkpoint_commitments != other.checkpoint_commitments: + return False + if self.end_of_epoch_data != other.end_of_epoch_data: + return False + if self.version_specific_data != other.version_specific_data: + return False + return True + +class _UniffiConverterTypeCheckpointSummary(_UniffiConverterRustBuffer): + @staticmethod + def read(buf): + return CheckpointSummary( + epoch=_UniffiConverterUInt64.read(buf), + sequence_number=_UniffiConverterUInt64.read(buf), + network_total_transactions=_UniffiConverterUInt64.read(buf), + content_digest=_UniffiConverterTypeCheckpointContentsDigest.read(buf), + previous_digest=_UniffiConverterOptionalTypeCheckpointDigest.read(buf), + epoch_rolling_gas_cost_summary=_UniffiConverterTypeGasCostSummary.read(buf), + timestamp_ms=_UniffiConverterUInt64.read(buf), + checkpoint_commitments=_UniffiConverterSequenceTypeCheckpointCommitment.read(buf), + end_of_epoch_data=_UniffiConverterOptionalTypeEndOfEpochData.read(buf), + version_specific_data=_UniffiConverterBytes.read(buf), + ) + + @staticmethod + def check_lower(value): + _UniffiConverterUInt64.check_lower(value.epoch) + _UniffiConverterUInt64.check_lower(value.sequence_number) + _UniffiConverterUInt64.check_lower(value.network_total_transactions) + _UniffiConverterTypeCheckpointContentsDigest.check_lower(value.content_digest) + _UniffiConverterOptionalTypeCheckpointDigest.check_lower(value.previous_digest) + _UniffiConverterTypeGasCostSummary.check_lower(value.epoch_rolling_gas_cost_summary) + _UniffiConverterUInt64.check_lower(value.timestamp_ms) + _UniffiConverterSequenceTypeCheckpointCommitment.check_lower(value.checkpoint_commitments) + _UniffiConverterOptionalTypeEndOfEpochData.check_lower(value.end_of_epoch_data) + _UniffiConverterBytes.check_lower(value.version_specific_data) + + @staticmethod + def write(value, buf): + _UniffiConverterUInt64.write(value.epoch, buf) + _UniffiConverterUInt64.write(value.sequence_number, buf) + _UniffiConverterUInt64.write(value.network_total_transactions, buf) + _UniffiConverterTypeCheckpointContentsDigest.write(value.content_digest, buf) + _UniffiConverterOptionalTypeCheckpointDigest.write(value.previous_digest, buf) + _UniffiConverterTypeGasCostSummary.write(value.epoch_rolling_gas_cost_summary, buf) + _UniffiConverterUInt64.write(value.timestamp_ms, buf) + _UniffiConverterSequenceTypeCheckpointCommitment.write(value.checkpoint_commitments, buf) + _UniffiConverterOptionalTypeEndOfEpochData.write(value.end_of_epoch_data, buf) + _UniffiConverterBytes.write(value.version_specific_data, buf) + + +class EndOfEpochData: + next_epoch_committee: "typing.List[ValidatorCommitteeMember]" + next_epoch_protocol_version: "int" + epoch_commitments: "typing.List[CheckpointCommitment]" + epoch_supply_change: "int" + def __init__(self, *, next_epoch_committee: "typing.List[ValidatorCommitteeMember]", next_epoch_protocol_version: "int", epoch_commitments: "typing.List[CheckpointCommitment]", epoch_supply_change: "int"): + self.next_epoch_committee = next_epoch_committee + self.next_epoch_protocol_version = next_epoch_protocol_version + self.epoch_commitments = epoch_commitments + self.epoch_supply_change = epoch_supply_change + + def __str__(self): + return "EndOfEpochData(next_epoch_committee={}, next_epoch_protocol_version={}, epoch_commitments={}, epoch_supply_change={})".format(self.next_epoch_committee, self.next_epoch_protocol_version, self.epoch_commitments, self.epoch_supply_change) + + def __eq__(self, other): + if self.next_epoch_committee != other.next_epoch_committee: + return False + if self.next_epoch_protocol_version != other.next_epoch_protocol_version: + return False + if self.epoch_commitments != other.epoch_commitments: + return False + if self.epoch_supply_change != other.epoch_supply_change: + return False + return True + +class _UniffiConverterTypeEndOfEpochData(_UniffiConverterRustBuffer): + @staticmethod + def read(buf): + return EndOfEpochData( + next_epoch_committee=_UniffiConverterSequenceTypeValidatorCommitteeMember.read(buf), + next_epoch_protocol_version=_UniffiConverterUInt64.read(buf), + epoch_commitments=_UniffiConverterSequenceTypeCheckpointCommitment.read(buf), + epoch_supply_change=_UniffiConverterInt64.read(buf), + ) + + @staticmethod + def check_lower(value): + _UniffiConverterSequenceTypeValidatorCommitteeMember.check_lower(value.next_epoch_committee) + _UniffiConverterUInt64.check_lower(value.next_epoch_protocol_version) + _UniffiConverterSequenceTypeCheckpointCommitment.check_lower(value.epoch_commitments) + _UniffiConverterInt64.check_lower(value.epoch_supply_change) + + @staticmethod + def write(value, buf): + _UniffiConverterSequenceTypeValidatorCommitteeMember.write(value.next_epoch_committee, buf) + _UniffiConverterUInt64.write(value.next_epoch_protocol_version, buf) + _UniffiConverterSequenceTypeCheckpointCommitment.write(value.epoch_commitments, buf) + _UniffiConverterInt64.write(value.epoch_supply_change, buf) + + +class EventFilter: + emitting_module: "typing.Optional[str]" + event_type: "typing.Optional[str]" + sender: "typing.Optional[Address]" + transaction_digest: "typing.Optional[str]" + def __init__(self, *, emitting_module: "typing.Optional[str]" = _DEFAULT, event_type: "typing.Optional[str]" = _DEFAULT, sender: "typing.Optional[Address]" = _DEFAULT, transaction_digest: "typing.Optional[str]" = _DEFAULT): + if emitting_module is _DEFAULT: + self.emitting_module = None + else: + self.emitting_module = emitting_module + if event_type is _DEFAULT: + self.event_type = None + else: + self.event_type = event_type + if sender is _DEFAULT: + self.sender = None + else: + self.sender = sender + if transaction_digest is _DEFAULT: + self.transaction_digest = None + else: + self.transaction_digest = transaction_digest + + def __str__(self): + return "EventFilter(emitting_module={}, event_type={}, sender={}, transaction_digest={})".format(self.emitting_module, self.event_type, self.sender, self.transaction_digest) + + def __eq__(self, other): + if self.emitting_module != other.emitting_module: + return False + if self.event_type != other.event_type: + return False + if self.sender != other.sender: + return False + if self.transaction_digest != other.transaction_digest: + return False + return True + +class _UniffiConverterTypeEventFilter(_UniffiConverterRustBuffer): + @staticmethod + def read(buf): + return EventFilter( + emitting_module=_UniffiConverterOptionalString.read(buf), + event_type=_UniffiConverterOptionalString.read(buf), + sender=_UniffiConverterOptionalTypeAddress.read(buf), + transaction_digest=_UniffiConverterOptionalString.read(buf), + ) + + @staticmethod + def check_lower(value): + _UniffiConverterOptionalString.check_lower(value.emitting_module) + _UniffiConverterOptionalString.check_lower(value.event_type) + _UniffiConverterOptionalTypeAddress.check_lower(value.sender) + _UniffiConverterOptionalString.check_lower(value.transaction_digest) + + @staticmethod + def write(value, buf): + _UniffiConverterOptionalString.write(value.emitting_module, buf) + _UniffiConverterOptionalString.write(value.event_type, buf) + _UniffiConverterOptionalTypeAddress.write(value.sender, buf) + _UniffiConverterOptionalString.write(value.transaction_digest, buf) + + +class GasCostSummary: + computation_cost: "int" + computation_cost_burned: "int" + storage_cost: "int" + storage_rebate: "int" + non_refundable_storage_fee: "int" + def __init__(self, *, computation_cost: "int", computation_cost_burned: "int", storage_cost: "int", storage_rebate: "int", non_refundable_storage_fee: "int"): + self.computation_cost = computation_cost + self.computation_cost_burned = computation_cost_burned + self.storage_cost = storage_cost + self.storage_rebate = storage_rebate + self.non_refundable_storage_fee = non_refundable_storage_fee + + def __str__(self): + return "GasCostSummary(computation_cost={}, computation_cost_burned={}, storage_cost={}, storage_rebate={}, non_refundable_storage_fee={})".format(self.computation_cost, self.computation_cost_burned, self.storage_cost, self.storage_rebate, self.non_refundable_storage_fee) + + def __eq__(self, other): + if self.computation_cost != other.computation_cost: + return False + if self.computation_cost_burned != other.computation_cost_burned: + return False + if self.storage_cost != other.storage_cost: + return False + if self.storage_rebate != other.storage_rebate: + return False + if self.non_refundable_storage_fee != other.non_refundable_storage_fee: + return False + return True + +class _UniffiConverterTypeGasCostSummary(_UniffiConverterRustBuffer): + @staticmethod + def read(buf): + return GasCostSummary( + computation_cost=_UniffiConverterUInt64.read(buf), + computation_cost_burned=_UniffiConverterUInt64.read(buf), + storage_cost=_UniffiConverterUInt64.read(buf), + storage_rebate=_UniffiConverterUInt64.read(buf), + non_refundable_storage_fee=_UniffiConverterUInt64.read(buf), + ) + + @staticmethod + def check_lower(value): + _UniffiConverterUInt64.check_lower(value.computation_cost) + _UniffiConverterUInt64.check_lower(value.computation_cost_burned) + _UniffiConverterUInt64.check_lower(value.storage_cost) + _UniffiConverterUInt64.check_lower(value.storage_rebate) + _UniffiConverterUInt64.check_lower(value.non_refundable_storage_fee) + + @staticmethod + def write(value, buf): + _UniffiConverterUInt64.write(value.computation_cost, buf) + _UniffiConverterUInt64.write(value.computation_cost_burned, buf) + _UniffiConverterUInt64.write(value.storage_cost, buf) + _UniffiConverterUInt64.write(value.storage_rebate, buf) + _UniffiConverterUInt64.write(value.non_refundable_storage_fee, buf) + + +class GasPayment: + """ + Payment information for executing a transaction + + # BCS + + The BCS serialized form for this type is defined by the following ABNF: + + ```text + gas-payment = (vector object-ref) ; gas coin objects + address ; owner + u64 ; price + u64 ; budget + ``` + """ + + objects: "typing.List[ObjectReference]" + owner: "Address" + price: "int" + budget: "int" + def __init__(self, *, objects: "typing.List[ObjectReference]", owner: "Address", price: "int", budget: "int"): + self.objects = objects + self.owner = owner + self.price = price + self.budget = budget + + def __str__(self): + return "GasPayment(objects={}, owner={}, price={}, budget={})".format(self.objects, self.owner, self.price, self.budget) + + def __eq__(self, other): + if self.objects != other.objects: + return False + if self.owner != other.owner: + return False + if self.price != other.price: + return False + if self.budget != other.budget: + return False + return True + +class _UniffiConverterTypeGasPayment(_UniffiConverterRustBuffer): + @staticmethod + def read(buf): + return GasPayment( + objects=_UniffiConverterSequenceTypeObjectReference.read(buf), + owner=_UniffiConverterTypeAddress.read(buf), + price=_UniffiConverterUInt64.read(buf), + budget=_UniffiConverterUInt64.read(buf), + ) + + @staticmethod + def check_lower(value): + _UniffiConverterSequenceTypeObjectReference.check_lower(value.objects) + _UniffiConverterTypeAddress.check_lower(value.owner) + _UniffiConverterUInt64.check_lower(value.price) + _UniffiConverterUInt64.check_lower(value.budget) + + @staticmethod + def write(value, buf): + _UniffiConverterSequenceTypeObjectReference.write(value.objects, buf) + _UniffiConverterTypeAddress.write(value.owner, buf) + _UniffiConverterUInt64.write(value.price, buf) + _UniffiConverterUInt64.write(value.budget, buf) + + +class ObjectReference: + """ + Reference to an object + + Contains sufficient information to uniquely identify a specific object. + + # BCS + + The BCS serialized form for this type is defined by the following ABNF: + + ```text + object-ref = object-id u64 digest + ``` + """ + + object_id: "ObjectId" + version: "int" + digest: "ObjectDigest" + def __init__(self, *, object_id: "ObjectId", version: "int", digest: "ObjectDigest"): + self.object_id = object_id + self.version = version + self.digest = digest + + def __str__(self): + return "ObjectReference(object_id={}, version={}, digest={})".format(self.object_id, self.version, self.digest) + + def __eq__(self, other): + if self.object_id != other.object_id: + return False + if self.version != other.version: + return False + if self.digest != other.digest: + return False + return True + +class _UniffiConverterTypeObjectReference(_UniffiConverterRustBuffer): + @staticmethod + def read(buf): + return ObjectReference( + object_id=_UniffiConverterTypeObjectId.read(buf), + version=_UniffiConverterUInt64.read(buf), + digest=_UniffiConverterTypeObjectDigest.read(buf), + ) + + @staticmethod + def check_lower(value): + _UniffiConverterTypeObjectId.check_lower(value.object_id) + _UniffiConverterUInt64.check_lower(value.version) + _UniffiConverterTypeObjectDigest.check_lower(value.digest) + + @staticmethod + def write(value, buf): + _UniffiConverterTypeObjectId.write(value.object_id, buf) + _UniffiConverterUInt64.write(value.version, buf) + _UniffiConverterTypeObjectDigest.write(value.digest, buf) + + +class PaginationFilter: + """ + Pagination options for querying the GraphQL server. It defaults to forward + pagination with the GraphQL server's max page size. + """ + + direction: "Direction" + """ + The direction of pagination. + """ + + cursor: "typing.Optional[str]" + """ + An opaque cursor used for pagination. + """ + + limit: "typing.Optional[int]" + """ + The maximum number of items to return. If this is ommitted, it will + lazily query the service configuration for the max page size. + """ + + def __init__(self, *, direction: "Direction", cursor: "typing.Optional[str]" = _DEFAULT, limit: "typing.Optional[int]" = _DEFAULT): + self.direction = direction + if cursor is _DEFAULT: + self.cursor = None + else: + self.cursor = cursor + if limit is _DEFAULT: + self.limit = None + else: + self.limit = limit + + def __str__(self): + return "PaginationFilter(direction={}, cursor={}, limit={})".format(self.direction, self.cursor, self.limit) + + def __eq__(self, other): + if self.direction != other.direction: + return False + if self.cursor != other.cursor: + return False + if self.limit != other.limit: + return False + return True + +class _UniffiConverterTypePaginationFilter(_UniffiConverterRustBuffer): + @staticmethod + def read(buf): + return PaginationFilter( + direction=_UniffiConverterTypeDirection.read(buf), + cursor=_UniffiConverterOptionalString.read(buf), + limit=_UniffiConverterOptionalInt32.read(buf), + ) + + @staticmethod + def check_lower(value): + _UniffiConverterTypeDirection.check_lower(value.direction) + _UniffiConverterOptionalString.check_lower(value.cursor) + _UniffiConverterOptionalInt32.check_lower(value.limit) + + @staticmethod + def write(value, buf): + _UniffiConverterTypeDirection.write(value.direction, buf) + _UniffiConverterOptionalString.write(value.cursor, buf) + _UniffiConverterOptionalInt32.write(value.limit, buf) + + +class TransactionMetadata: + gas_budget: "typing.Optional[int]" + gas_objects: "typing.Optional[typing.List[ObjectRef]]" + gas_price: "typing.Optional[int]" + gas_sponsor: "typing.Optional[Address]" + sender: "typing.Optional[Address]" + def __init__(self, *, gas_budget: "typing.Optional[int]" = _DEFAULT, gas_objects: "typing.Optional[typing.List[ObjectRef]]" = _DEFAULT, gas_price: "typing.Optional[int]" = _DEFAULT, gas_sponsor: "typing.Optional[Address]" = _DEFAULT, sender: "typing.Optional[Address]" = _DEFAULT): + if gas_budget is _DEFAULT: + self.gas_budget = None + else: + self.gas_budget = gas_budget + if gas_objects is _DEFAULT: + self.gas_objects = None + else: + self.gas_objects = gas_objects + if gas_price is _DEFAULT: + self.gas_price = None + else: + self.gas_price = gas_price + if gas_sponsor is _DEFAULT: + self.gas_sponsor = None + else: + self.gas_sponsor = gas_sponsor + if sender is _DEFAULT: + self.sender = None + else: + self.sender = sender + + def __str__(self): + return "TransactionMetadata(gas_budget={}, gas_objects={}, gas_price={}, gas_sponsor={}, sender={})".format(self.gas_budget, self.gas_objects, self.gas_price, self.gas_sponsor, self.sender) + + def __eq__(self, other): + if self.gas_budget != other.gas_budget: + return False + if self.gas_objects != other.gas_objects: + return False + if self.gas_price != other.gas_price: + return False + if self.gas_sponsor != other.gas_sponsor: + return False + if self.sender != other.sender: + return False + return True + +class _UniffiConverterTypeTransactionMetadata(_UniffiConverterRustBuffer): + @staticmethod + def read(buf): + return TransactionMetadata( + gas_budget=_UniffiConverterOptionalUInt64.read(buf), + gas_objects=_UniffiConverterOptionalSequenceTypeObjectRef.read(buf), + gas_price=_UniffiConverterOptionalUInt64.read(buf), + gas_sponsor=_UniffiConverterOptionalTypeAddress.read(buf), + sender=_UniffiConverterOptionalTypeAddress.read(buf), + ) + + @staticmethod + def check_lower(value): + _UniffiConverterOptionalUInt64.check_lower(value.gas_budget) + _UniffiConverterOptionalSequenceTypeObjectRef.check_lower(value.gas_objects) + _UniffiConverterOptionalUInt64.check_lower(value.gas_price) + _UniffiConverterOptionalTypeAddress.check_lower(value.gas_sponsor) + _UniffiConverterOptionalTypeAddress.check_lower(value.sender) + + @staticmethod + def write(value, buf): + _UniffiConverterOptionalUInt64.write(value.gas_budget, buf) + _UniffiConverterOptionalSequenceTypeObjectRef.write(value.gas_objects, buf) + _UniffiConverterOptionalUInt64.write(value.gas_price, buf) + _UniffiConverterOptionalTypeAddress.write(value.gas_sponsor, buf) + _UniffiConverterOptionalTypeAddress.write(value.sender, buf) + + +class TransactionsFilter: + function: "typing.Optional[str]" + kind: "typing.Optional[TransactionBlockKindInput]" + after_checkpoint: "typing.Optional[int]" + at_checkpoint: "typing.Optional[int]" + before_checkpoint: "typing.Optional[int]" + affected_address: "typing.Optional[Address]" + sent_address: "typing.Optional[Address]" + input_object: "typing.Optional[ObjectId]" + changed_object: "typing.Optional[ObjectId]" + transaction_ids: "typing.Optional[typing.List[str]]" + def __init__(self, *, function: "typing.Optional[str]" = _DEFAULT, kind: "typing.Optional[TransactionBlockKindInput]" = _DEFAULT, after_checkpoint: "typing.Optional[int]" = _DEFAULT, at_checkpoint: "typing.Optional[int]" = _DEFAULT, before_checkpoint: "typing.Optional[int]" = _DEFAULT, affected_address: "typing.Optional[Address]" = _DEFAULT, sent_address: "typing.Optional[Address]" = _DEFAULT, input_object: "typing.Optional[ObjectId]" = _DEFAULT, changed_object: "typing.Optional[ObjectId]" = _DEFAULT, transaction_ids: "typing.Optional[typing.List[str]]" = _DEFAULT): + if function is _DEFAULT: + self.function = None + else: + self.function = function + if kind is _DEFAULT: + self.kind = None + else: + self.kind = kind + if after_checkpoint is _DEFAULT: + self.after_checkpoint = None + else: + self.after_checkpoint = after_checkpoint + if at_checkpoint is _DEFAULT: + self.at_checkpoint = None + else: + self.at_checkpoint = at_checkpoint + if before_checkpoint is _DEFAULT: + self.before_checkpoint = None + else: + self.before_checkpoint = before_checkpoint + if affected_address is _DEFAULT: + self.affected_address = None + else: + self.affected_address = affected_address + if sent_address is _DEFAULT: + self.sent_address = None + else: + self.sent_address = sent_address + if input_object is _DEFAULT: + self.input_object = None + else: + self.input_object = input_object + if changed_object is _DEFAULT: + self.changed_object = None + else: + self.changed_object = changed_object + if transaction_ids is _DEFAULT: + self.transaction_ids = None + else: + self.transaction_ids = transaction_ids + + def __str__(self): + return "TransactionsFilter(function={}, kind={}, after_checkpoint={}, at_checkpoint={}, before_checkpoint={}, affected_address={}, sent_address={}, input_object={}, changed_object={}, transaction_ids={})".format(self.function, self.kind, self.after_checkpoint, self.at_checkpoint, self.before_checkpoint, self.affected_address, self.sent_address, self.input_object, self.changed_object, self.transaction_ids) + + def __eq__(self, other): + if self.function != other.function: + return False + if self.kind != other.kind: + return False + if self.after_checkpoint != other.after_checkpoint: + return False + if self.at_checkpoint != other.at_checkpoint: + return False + if self.before_checkpoint != other.before_checkpoint: + return False + if self.affected_address != other.affected_address: + return False + if self.sent_address != other.sent_address: + return False + if self.input_object != other.input_object: + return False + if self.changed_object != other.changed_object: + return False + if self.transaction_ids != other.transaction_ids: + return False + return True + +class _UniffiConverterTypeTransactionsFilter(_UniffiConverterRustBuffer): + @staticmethod + def read(buf): + return TransactionsFilter( + function=_UniffiConverterOptionalString.read(buf), + kind=_UniffiConverterOptionalTypeTransactionBlockKindInput.read(buf), + after_checkpoint=_UniffiConverterOptionalUInt64.read(buf), + at_checkpoint=_UniffiConverterOptionalUInt64.read(buf), + before_checkpoint=_UniffiConverterOptionalUInt64.read(buf), + affected_address=_UniffiConverterOptionalTypeAddress.read(buf), + sent_address=_UniffiConverterOptionalTypeAddress.read(buf), + input_object=_UniffiConverterOptionalTypeObjectId.read(buf), + changed_object=_UniffiConverterOptionalTypeObjectId.read(buf), + transaction_ids=_UniffiConverterOptionalSequenceString.read(buf), + ) + + @staticmethod + def check_lower(value): + _UniffiConverterOptionalString.check_lower(value.function) + _UniffiConverterOptionalTypeTransactionBlockKindInput.check_lower(value.kind) + _UniffiConverterOptionalUInt64.check_lower(value.after_checkpoint) + _UniffiConverterOptionalUInt64.check_lower(value.at_checkpoint) + _UniffiConverterOptionalUInt64.check_lower(value.before_checkpoint) + _UniffiConverterOptionalTypeAddress.check_lower(value.affected_address) + _UniffiConverterOptionalTypeAddress.check_lower(value.sent_address) + _UniffiConverterOptionalTypeObjectId.check_lower(value.input_object) + _UniffiConverterOptionalTypeObjectId.check_lower(value.changed_object) + _UniffiConverterOptionalSequenceString.check_lower(value.transaction_ids) + + @staticmethod + def write(value, buf): + _UniffiConverterOptionalString.write(value.function, buf) + _UniffiConverterOptionalTypeTransactionBlockKindInput.write(value.kind, buf) + _UniffiConverterOptionalUInt64.write(value.after_checkpoint, buf) + _UniffiConverterOptionalUInt64.write(value.at_checkpoint, buf) + _UniffiConverterOptionalUInt64.write(value.before_checkpoint, buf) + _UniffiConverterOptionalTypeAddress.write(value.affected_address, buf) + _UniffiConverterOptionalTypeAddress.write(value.sent_address, buf) + _UniffiConverterOptionalTypeObjectId.write(value.input_object, buf) + _UniffiConverterOptionalTypeObjectId.write(value.changed_object, buf) + _UniffiConverterOptionalSequenceString.write(value.transaction_ids, buf) + + +class ValidatorCommitteeMember: + """ + A member of a Validator Committee + + # BCS + + The BCS serialized form for this type is defined by the following ABNF: + + ```text + validator-committee-member = bls-public-key + u64 ; stake + ``` + """ + + public_key: "Bls12381PublicKey" + stake: "int" + def __init__(self, *, public_key: "Bls12381PublicKey", stake: "int"): + self.public_key = public_key + self.stake = stake + + def __str__(self): + return "ValidatorCommitteeMember(public_key={}, stake={})".format(self.public_key, self.stake) + + def __eq__(self, other): + if self.public_key != other.public_key: + return False + if self.stake != other.stake: + return False + return True + +class _UniffiConverterTypeValidatorCommitteeMember(_UniffiConverterRustBuffer): + @staticmethod + def read(buf): + return ValidatorCommitteeMember( + public_key=_UniffiConverterTypeBls12381PublicKey.read(buf), + stake=_UniffiConverterUInt64.read(buf), + ) + + @staticmethod + def check_lower(value): + _UniffiConverterTypeBls12381PublicKey.check_lower(value.public_key) + _UniffiConverterUInt64.check_lower(value.stake) + + @staticmethod + def write(value, buf): + _UniffiConverterTypeBls12381PublicKey.write(value.public_key, buf) + _UniffiConverterUInt64.write(value.stake, buf) + + +# BindingsSdkError +# 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 BindingsSdkError(Exception): + pass + +_UniffiTempBindingsSdkError = BindingsSdkError + +class BindingsSdkError: # type: ignore + class Generic(_UniffiTempBindingsSdkError): + + def __repr__(self): + return "BindingsSdkError.Generic({})".format(repr(str(self))) + _UniffiTempBindingsSdkError.Generic = Generic # type: ignore + +BindingsSdkError = _UniffiTempBindingsSdkError # type: ignore +del _UniffiTempBindingsSdkError + + +class _UniffiConverterTypeBindingsSdkError(_UniffiConverterRustBuffer): + @staticmethod + def read(buf): + variant = buf.read_i32() + if variant == 1: + return BindingsSdkError.Generic( + _UniffiConverterString.read(buf), + ) + raise InternalError("Raw enum value doesn't match any cases") + + @staticmethod + def check_lower(value): + if isinstance(value, BindingsSdkError.Generic): + return + + @staticmethod + def write(value, buf): + if isinstance(value, BindingsSdkError.Generic): + buf.write_i32(1) + + + + + +class Direction(enum.Enum): + """ + Pagination direction. + """ + + FORWARD = 0 + + BACKWARD = 1 + + + +class _UniffiConverterTypeDirection(_UniffiConverterRustBuffer): + @staticmethod + def read(buf): + variant = buf.read_i32() + if variant == 1: + return Direction.FORWARD + if variant == 2: + return Direction.BACKWARD + raise InternalError("Raw enum value doesn't match any cases") + + @staticmethod + def check_lower(value): + if value == Direction.FORWARD: + return + if value == Direction.BACKWARD: + return + raise ValueError(value) + + @staticmethod + def write(value, buf): + if value == Direction.FORWARD: + buf.write_i32(1) + if value == Direction.BACKWARD: + buf.write_i32(2) + + + + + + + +class TransactionBlockKindInput(enum.Enum): + SYSTEM_TX = 0 + + PROGRAMMABLE_TX = 1 + + + +class _UniffiConverterTypeTransactionBlockKindInput(_UniffiConverterRustBuffer): + @staticmethod + def read(buf): + variant = buf.read_i32() + if variant == 1: + return TransactionBlockKindInput.SYSTEM_TX + if variant == 2: + return TransactionBlockKindInput.PROGRAMMABLE_TX + raise InternalError("Raw enum value doesn't match any cases") + + @staticmethod + def check_lower(value): + if value == TransactionBlockKindInput.SYSTEM_TX: + return + if value == TransactionBlockKindInput.PROGRAMMABLE_TX: + return + raise ValueError(value) + + @staticmethod + def write(value, buf): + if value == TransactionBlockKindInput.SYSTEM_TX: + buf.write_i32(1) + if value == TransactionBlockKindInput.PROGRAMMABLE_TX: + buf.write_i32(2) + + + + + +class _UniffiConverterOptionalInt32(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterInt32.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterInt32.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterInt32.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterOptionalUInt64(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterUInt64.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterUInt64.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterUInt64.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterOptionalBool(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterBool.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterBool.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterBool.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterOptionalString(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterString.check_lower(value) + + @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 _UniffiConverterOptionalBytes(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterBytes.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterBytes.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterBytes.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterOptionalTypeAddress(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterTypeAddress.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterTypeAddress.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterTypeAddress.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterOptionalTypeBatchSendStatus(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterTypeBatchSendStatus.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterTypeBatchSendStatus.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterTypeBatchSendStatus.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterOptionalTypeCheckpointDigest(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterTypeCheckpointDigest.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterTypeCheckpointDigest.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterTypeCheckpointDigest.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterOptionalTypeCoinMetadata(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterTypeCoinMetadata.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterTypeCoinMetadata.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterTypeCoinMetadata.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterOptionalTypeDynamicFieldOutput(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterTypeDynamicFieldOutput.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterTypeDynamicFieldOutput.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterTypeDynamicFieldOutput.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterOptionalTypeEpoch(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterTypeEpoch.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterTypeEpoch.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterTypeEpoch.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterOptionalTypeFaucetReceipt(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterTypeFaucetReceipt.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterTypeFaucetReceipt.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterTypeFaucetReceipt.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterOptionalTypeMoveFunction(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterTypeMoveFunction.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterTypeMoveFunction.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterTypeMoveFunction.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterOptionalTypeMoveModule(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterTypeMoveModule.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterTypeMoveModule.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterTypeMoveModule.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterOptionalTypeMovePackage(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterTypeMovePackage.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterTypeMovePackage.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterTypeMovePackage.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterOptionalTypeMoveStruct(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterTypeMoveStruct.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterTypeMoveStruct.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterTypeMoveStruct.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterOptionalTypeObject(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterTypeObject.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterTypeObject.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterTypeObject.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterOptionalTypeObjectFilter(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterTypeObjectFilter.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterTypeObjectFilter.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterTypeObjectFilter.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterOptionalTypeObjectId(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterTypeObjectId.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterTypeObjectId.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterTypeObjectId.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterOptionalTypeProtocolConfigs(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterTypeProtocolConfigs.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterTypeProtocolConfigs.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterTypeProtocolConfigs.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterOptionalTypeSignedTransaction(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterTypeSignedTransaction.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterTypeSignedTransaction.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterTypeSignedTransaction.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterOptionalTypeTransactionDataEffects(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterTypeTransactionDataEffects.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterTypeTransactionDataEffects.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterTypeTransactionDataEffects.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterOptionalTypeTransactionEffects(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterTypeTransactionEffects.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterTypeTransactionEffects.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterTypeTransactionEffects.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterOptionalTypeCheckpointSummary(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterTypeCheckpointSummary.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterTypeCheckpointSummary.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterTypeCheckpointSummary.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterOptionalTypeEndOfEpochData(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterTypeEndOfEpochData.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterTypeEndOfEpochData.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterTypeEndOfEpochData.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterOptionalTypeEventFilter(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterTypeEventFilter.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterTypeEventFilter.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterTypeEventFilter.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterOptionalTypeTransactionsFilter(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterTypeTransactionsFilter.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterTypeTransactionsFilter.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterTypeTransactionsFilter.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterOptionalTypeTransactionBlockKindInput(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterTypeTransactionBlockKindInput.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterTypeTransactionBlockKindInput.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterTypeTransactionBlockKindInput.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterOptionalSequenceString(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterSequenceString.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterSequenceString.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterSequenceString.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterOptionalSequenceTypeObjectRef(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterSequenceTypeObjectRef.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterSequenceTypeObjectRef.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterSequenceTypeObjectRef.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterOptionalTypeValue(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + if value is not None: + _UniffiConverterTypeValue.check_lower(value) + + @classmethod + def write(cls, value, buf): + if value is None: + buf.write_u8(0) + return + + buf.write_u8(1) + _UniffiConverterTypeValue.write(value, buf) + + @classmethod + def read(cls, buf): + flag = buf.read_u8() + if flag == 0: + return None + elif flag == 1: + return _UniffiConverterTypeValue.read(buf) + else: + raise InternalError("Unexpected flag byte for optional type") + + + +class _UniffiConverterSequenceString(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + for item in value: + _UniffiConverterString.check_lower(item) + + @classmethod + def write(cls, value, buf): + items = len(value) + buf.write_i32(items) + for item in value: + _UniffiConverterString.write(item, buf) + + @classmethod + def read(cls, buf): + count = buf.read_i32() + if count < 0: + raise InternalError("Unexpected negative sequence length") + + return [ + _UniffiConverterString.read(buf) for i in range(count) + ] + + + +class _UniffiConverterSequenceTypeCheckpointCommitment(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + for item in value: + _UniffiConverterTypeCheckpointCommitment.check_lower(item) + + @classmethod + def write(cls, value, buf): + items = len(value) + buf.write_i32(items) + for item in value: + _UniffiConverterTypeCheckpointCommitment.write(item, buf) + + @classmethod + def read(cls, buf): + count = buf.read_i32() + if count < 0: + raise InternalError("Unexpected negative sequence length") + + return [ + _UniffiConverterTypeCheckpointCommitment.read(buf) for i in range(count) + ] + + + +class _UniffiConverterSequenceTypeCoin(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + for item in value: + _UniffiConverterTypeCoin.check_lower(item) + + @classmethod + def write(cls, value, buf): + items = len(value) + buf.write_i32(items) + for item in value: + _UniffiConverterTypeCoin.write(item, buf) + + @classmethod + def read(cls, buf): + count = buf.read_i32() + if count < 0: + raise InternalError("Unexpected negative sequence length") + + return [ + _UniffiConverterTypeCoin.read(buf) for i in range(count) + ] + + + +class _UniffiConverterSequenceTypeDynamicFieldOutput(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + for item in value: + _UniffiConverterTypeDynamicFieldOutput.check_lower(item) + + @classmethod + def write(cls, value, buf): + items = len(value) + buf.write_i32(items) + for item in value: + _UniffiConverterTypeDynamicFieldOutput.write(item, buf) + + @classmethod + def read(cls, buf): + count = buf.read_i32() + if count < 0: + raise InternalError("Unexpected negative sequence length") + + return [ + _UniffiConverterTypeDynamicFieldOutput.read(buf) for i in range(count) + ] + + + +class _UniffiConverterSequenceTypeEndOfEpochTransactionKind(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + for item in value: + _UniffiConverterTypeEndOfEpochTransactionKind.check_lower(item) + + @classmethod + def write(cls, value, buf): + items = len(value) + buf.write_i32(items) + for item in value: + _UniffiConverterTypeEndOfEpochTransactionKind.write(item, buf) + + @classmethod + def read(cls, buf): + count = buf.read_i32() + if count < 0: + raise InternalError("Unexpected negative sequence length") + + return [ + _UniffiConverterTypeEndOfEpochTransactionKind.read(buf) for i in range(count) + ] + + + +class _UniffiConverterSequenceTypeEpoch(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + for item in value: + _UniffiConverterTypeEpoch.check_lower(item) + + @classmethod + def write(cls, value, buf): + items = len(value) + buf.write_i32(items) + for item in value: + _UniffiConverterTypeEpoch.write(item, buf) + + @classmethod + def read(cls, buf): + count = buf.read_i32() + if count < 0: + raise InternalError("Unexpected negative sequence length") + + return [ + _UniffiConverterTypeEpoch.read(buf) for i in range(count) + ] + + + +class _UniffiConverterSequenceTypeMovePackage(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + for item in value: + _UniffiConverterTypeMovePackage.check_lower(item) + + @classmethod + def write(cls, value, buf): + items = len(value) + buf.write_i32(items) + for item in value: + _UniffiConverterTypeMovePackage.write(item, buf) + + @classmethod + def read(cls, buf): + count = buf.read_i32() + if count < 0: + raise InternalError("Unexpected negative sequence length") + + return [ + _UniffiConverterTypeMovePackage.read(buf) for i in range(count) + ] + + + +class _UniffiConverterSequenceTypeObject(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + for item in value: + _UniffiConverterTypeObject.check_lower(item) + + @classmethod + def write(cls, value, buf): + items = len(value) + buf.write_i32(items) + for item in value: + _UniffiConverterTypeObject.write(item, buf) + + @classmethod + def read(cls, buf): + count = buf.read_i32() + if count < 0: + raise InternalError("Unexpected negative sequence length") + + return [ + _UniffiConverterTypeObject.read(buf) for i in range(count) + ] + + + +class _UniffiConverterSequenceTypeObjectRef(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + for item in value: + _UniffiConverterTypeObjectRef.check_lower(item) + + @classmethod + def write(cls, value, buf): + items = len(value) + buf.write_i32(items) + for item in value: + _UniffiConverterTypeObjectRef.write(item, buf) + + @classmethod + def read(cls, buf): + count = buf.read_i32() + if count < 0: + raise InternalError("Unexpected negative sequence length") + + return [ + _UniffiConverterTypeObjectRef.read(buf) for i in range(count) + ] + + + +class _UniffiConverterSequenceTypeSignedTransaction(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + for item in value: + _UniffiConverterTypeSignedTransaction.check_lower(item) + + @classmethod + def write(cls, value, buf): + items = len(value) + buf.write_i32(items) + for item in value: + _UniffiConverterTypeSignedTransaction.write(item, buf) + + @classmethod + def read(cls, buf): + count = buf.read_i32() + if count < 0: + raise InternalError("Unexpected negative sequence length") + + return [ + _UniffiConverterTypeSignedTransaction.read(buf) for i in range(count) + ] + + + +class _UniffiConverterSequenceTypeTransactionDataEffects(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + for item in value: + _UniffiConverterTypeTransactionDataEffects.check_lower(item) + + @classmethod + def write(cls, value, buf): + items = len(value) + buf.write_i32(items) + for item in value: + _UniffiConverterTypeTransactionDataEffects.write(item, buf) + + @classmethod + def read(cls, buf): + count = buf.read_i32() + if count < 0: + raise InternalError("Unexpected negative sequence length") + + return [ + _UniffiConverterTypeTransactionDataEffects.read(buf) for i in range(count) + ] + + + +class _UniffiConverterSequenceTypeTransactionEffects(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + for item in value: + _UniffiConverterTypeTransactionEffects.check_lower(item) + + @classmethod + def write(cls, value, buf): + items = len(value) + buf.write_i32(items) + for item in value: + _UniffiConverterTypeTransactionEffects.write(item, buf) + + @classmethod + def read(cls, buf): + count = buf.read_i32() + if count < 0: + raise InternalError("Unexpected negative sequence length") + + return [ + _UniffiConverterTypeTransactionEffects.read(buf) for i in range(count) + ] + + + +class _UniffiConverterSequenceTypeTransactionEvent(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + for item in value: + _UniffiConverterTypeTransactionEvent.check_lower(item) + + @classmethod + def write(cls, value, buf): + items = len(value) + buf.write_i32(items) + for item in value: + _UniffiConverterTypeTransactionEvent.write(item, buf) + + @classmethod + def read(cls, buf): + count = buf.read_i32() + if count < 0: + raise InternalError("Unexpected negative sequence length") + + return [ + _UniffiConverterTypeTransactionEvent.read(buf) for i in range(count) + ] + + + +class _UniffiConverterSequenceTypeUserSignature(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + for item in value: + _UniffiConverterTypeUserSignature.check_lower(item) + + @classmethod + def write(cls, value, buf): + items = len(value) + buf.write_i32(items) + for item in value: + _UniffiConverterTypeUserSignature.write(item, buf) + + @classmethod + def read(cls, buf): + count = buf.read_i32() + if count < 0: + raise InternalError("Unexpected negative sequence length") + + return [ + _UniffiConverterTypeUserSignature.read(buf) for i in range(count) + ] + + + +class _UniffiConverterSequenceTypeValidator(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + for item in value: + _UniffiConverterTypeValidator.check_lower(item) + + @classmethod + def write(cls, value, buf): + items = len(value) + buf.write_i32(items) + for item in value: + _UniffiConverterTypeValidator.write(item, buf) + + @classmethod + def read(cls, buf): + count = buf.read_i32() + if count < 0: + raise InternalError("Unexpected negative sequence length") + + return [ + _UniffiConverterTypeValidator.read(buf) for i in range(count) + ] + + + +class _UniffiConverterSequenceTypeCheckpointSummary(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + for item in value: + _UniffiConverterTypeCheckpointSummary.check_lower(item) + + @classmethod + def write(cls, value, buf): + items = len(value) + buf.write_i32(items) + for item in value: + _UniffiConverterTypeCheckpointSummary.write(item, buf) + + @classmethod + def read(cls, buf): + count = buf.read_i32() + if count < 0: + raise InternalError("Unexpected negative sequence length") + + return [ + _UniffiConverterTypeCheckpointSummary.read(buf) for i in range(count) + ] + + + +class _UniffiConverterSequenceTypeObjectReference(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + for item in value: + _UniffiConverterTypeObjectReference.check_lower(item) + + @classmethod + def write(cls, value, buf): + items = len(value) + buf.write_i32(items) + for item in value: + _UniffiConverterTypeObjectReference.write(item, buf) + + @classmethod + def read(cls, buf): + count = buf.read_i32() + if count < 0: + raise InternalError("Unexpected negative sequence length") + + return [ + _UniffiConverterTypeObjectReference.read(buf) for i in range(count) + ] + + + +class _UniffiConverterSequenceTypeValidatorCommitteeMember(_UniffiConverterRustBuffer): + @classmethod + def check_lower(cls, value): + for item in value: + _UniffiConverterTypeValidatorCommitteeMember.check_lower(item) + + @classmethod + def write(cls, value, buf): + items = len(value) + buf.write_i32(items) + for item in value: + _UniffiConverterTypeValidatorCommitteeMember.write(item, buf) + + @classmethod + def read(cls, buf): + count = buf.read_i32() + if count < 0: + raise InternalError("Unexpected negative sequence length") + + return [ + _UniffiConverterTypeValidatorCommitteeMember.read(buf) for i in range(count) + ] + + +class _UniffiConverterTypeValue: + @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 check_lower(value): + return _UniffiConverterString.check_lower(value) + + @staticmethod + def lower(value): + return _UniffiConverterString.lower(value) + +# objects. +class AddressProtocol(typing.Protocol): + """ + Unique identifier for an Account on the IOTA blockchain. + + An `Address` is a 32-byte pseudonymous identifier used to uniquely identify + an account and asset-ownership on the IOTA blockchain. Often, human-readable + addresses are encoded in hexadecimal with a `0x` prefix. For example, this + is a valid IOTA address: + `0x02a212de6a9dfa3a69e22387acfbafbb1a9e591bd9d636e7895dcfc8de05f331`. + + ``` + use iota_sdk_types::Address; + + let hex = "0x02a212de6a9dfa3a69e22387acfbafbb1a9e591bd9d636e7895dcfc8de05f331"; + let address = Address::from_hex(hex).unwrap(); + println!("Address: {}", address); + assert_eq!(hex, address.to_string()); + ``` + + # Deriving an Address + + Addresses are cryptographically derived from a number of user account + authenticators, the simplest of which is an + [`Ed25519PublicKey`](iota_types::Ed25519PublicKey). + + Deriving an address consists of the Blake2b256 hash of the sequence of bytes + of its corresponding authenticator, prefixed with a domain-separator (except + ed25519, for compatability reasons). For each other authenticator, this + domain-separator is the single byte-value of its + [`SignatureScheme`](iota_types::SignatureScheme) flag. E.g. `hash(signature + schema flag || authenticator bytes)`. + + Each authenticator has a method for deriving its `Address` as well as + documentation for the specifics of how the derivation is done. See + [`Ed25519PublicKey::derive_address`] for an example. + + [`Ed25519PublicKey::derive_address`]: iota_types::Ed25519PublicKey::derive_address + + ## Relationship to ObjectIds + + [`ObjectId`]s and [`Address`]es share the same 32-byte addressable space but + are derived leveraging different domain-separator values to ensure that, + cryptographically, there won't be any overlap, e.g. there can't be a + valid `Object` who's `ObjectId` is equal to that of the `Address` of a user + account. + + [`ObjectId`]: iota_types::ObjectId + + # BCS + + An `Address`'s BCS serialized form is defined by the following: + + ```text + address = 32OCTET + ``` + """ + + def to_bytes(self, ): + raise NotImplementedError + def to_hex(self, ): + raise NotImplementedError +# Address is a Rust-only trait - it's a wrapper around a Rust implementation. +class Address(): + """ + Unique identifier for an Account on the IOTA blockchain. + + An `Address` is a 32-byte pseudonymous identifier used to uniquely identify + an account and asset-ownership on the IOTA blockchain. Often, human-readable + addresses are encoded in hexadecimal with a `0x` prefix. For example, this + is a valid IOTA address: + `0x02a212de6a9dfa3a69e22387acfbafbb1a9e591bd9d636e7895dcfc8de05f331`. + + ``` + use iota_sdk_types::Address; + + let hex = "0x02a212de6a9dfa3a69e22387acfbafbb1a9e591bd9d636e7895dcfc8de05f331"; + let address = Address::from_hex(hex).unwrap(); + println!("Address: {}", address); + assert_eq!(hex, address.to_string()); + ``` + + # Deriving an Address + + Addresses are cryptographically derived from a number of user account + authenticators, the simplest of which is an + [`Ed25519PublicKey`](iota_types::Ed25519PublicKey). + + Deriving an address consists of the Blake2b256 hash of the sequence of bytes + of its corresponding authenticator, prefixed with a domain-separator (except + ed25519, for compatability reasons). For each other authenticator, this + domain-separator is the single byte-value of its + [`SignatureScheme`](iota_types::SignatureScheme) flag. E.g. `hash(signature + schema flag || authenticator bytes)`. + + Each authenticator has a method for deriving its `Address` as well as + documentation for the specifics of how the derivation is done. See + [`Ed25519PublicKey::derive_address`] for an example. + + [`Ed25519PublicKey::derive_address`]: iota_types::Ed25519PublicKey::derive_address + + ## Relationship to ObjectIds + + [`ObjectId`]s and [`Address`]es share the same 32-byte addressable space but + are derived leveraging different domain-separator values to ensure that, + cryptographically, there won't be any overlap, e.g. there can't be a + valid `Object` who's `ObjectId` is equal to that of the `Address` of a user + account. + + [`ObjectId`]: iota_types::ObjectId + + # BCS + + An `Address`'s BCS serialized form is defined by the following: + + ```text + address = 32OCTET + ``` + """ + + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_address, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_address, self._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 from_bytes(cls, bytes: "bytes"): + _UniffiConverterBytes.check_lower(bytes) + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call_with_error(_UniffiConverterTypeBindingsSdkError,_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_address_from_bytes, + _UniffiConverterBytes.lower(bytes)) + return cls._make_instance_(pointer) + + @classmethod + def from_hex(cls, hex: "str"): + _UniffiConverterString.check_lower(hex) + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call_with_error(_UniffiConverterTypeBindingsSdkError,_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_address_from_hex, + _UniffiConverterString.lower(hex)) + return cls._make_instance_(pointer) + + @classmethod + def generate(cls, ): + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_address_generate,) + return cls._make_instance_(pointer) + + + + def to_bytes(self, ) -> "bytes": + return _UniffiConverterBytes.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_address_to_bytes,self._uniffi_clone_pointer(),) + ) + + + + + + def to_hex(self, ) -> "str": + return _UniffiConverterString.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_address_to_hex,self._uniffi_clone_pointer(),) + ) + + + + + + +class _UniffiConverterTypeAddress: + + @staticmethod + def lift(value: int): + return Address._make_instance_(value) + + @staticmethod + def check_lower(value: Address): + if not isinstance(value, Address): + raise TypeError("Expected Address instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: AddressProtocol): + if not isinstance(value, Address): + raise TypeError("Expected Address instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: AddressProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class AuthenticatorStateExpireProtocol(typing.Protocol): + pass +# AuthenticatorStateExpire is a Rust-only trait - it's a wrapper around a Rust implementation. +class AuthenticatorStateExpire(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_authenticatorstateexpire, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_authenticatorstateexpire, self._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 _UniffiConverterTypeAuthenticatorStateExpire: + + @staticmethod + def lift(value: int): + return AuthenticatorStateExpire._make_instance_(value) + + @staticmethod + def check_lower(value: AuthenticatorStateExpire): + if not isinstance(value, AuthenticatorStateExpire): + raise TypeError("Expected AuthenticatorStateExpire instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: AuthenticatorStateExpireProtocol): + if not isinstance(value, AuthenticatorStateExpire): + raise TypeError("Expected AuthenticatorStateExpire instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: AuthenticatorStateExpireProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class AuthenticatorStateUpdateV1Protocol(typing.Protocol): + pass +# AuthenticatorStateUpdateV1 is a Rust-only trait - it's a wrapper around a Rust implementation. +class AuthenticatorStateUpdateV1(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_authenticatorstateupdatev1, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_authenticatorstateupdatev1, self._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 _UniffiConverterTypeAuthenticatorStateUpdateV1: + + @staticmethod + def lift(value: int): + return AuthenticatorStateUpdateV1._make_instance_(value) + + @staticmethod + def check_lower(value: AuthenticatorStateUpdateV1): + if not isinstance(value, AuthenticatorStateUpdateV1): + raise TypeError("Expected AuthenticatorStateUpdateV1 instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: AuthenticatorStateUpdateV1Protocol): + if not isinstance(value, AuthenticatorStateUpdateV1): + raise TypeError("Expected AuthenticatorStateUpdateV1 instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: AuthenticatorStateUpdateV1Protocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class BatchSendStatusProtocol(typing.Protocol): + pass +# BatchSendStatus is a Rust-only trait - it's a wrapper around a Rust implementation. +class BatchSendStatus(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_batchsendstatus, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_batchsendstatus, self._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 _UniffiConverterTypeBatchSendStatus: + + @staticmethod + def lift(value: int): + return BatchSendStatus._make_instance_(value) + + @staticmethod + def check_lower(value: BatchSendStatus): + if not isinstance(value, BatchSendStatus): + raise TypeError("Expected BatchSendStatus instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: BatchSendStatusProtocol): + if not isinstance(value, BatchSendStatus): + raise TypeError("Expected BatchSendStatus instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: BatchSendStatusProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class Bls12381PublicKeyProtocol(typing.Protocol): + """ + A bls12381 min-sig public key. + + # BCS + + The BCS serialized form for this type is defined by the following ABNF: + + ```text + bls-public-key = %x60 96OCTECT + ``` + + Due to historical reasons, even though a min-sig `Bls12381PublicKey` has a + fixed-length of 96, IOTA's binary representation of a min-sig + `Bls12381PublicKey` is prefixed with its length meaning its serialized + binary form (in bcs) is 97 bytes long vs a more compact 96 bytes. + """ + + def to_bytes(self, ): + raise NotImplementedError +# Bls12381PublicKey is a Rust-only trait - it's a wrapper around a Rust implementation. +class Bls12381PublicKey(): + """ + A bls12381 min-sig public key. + + # BCS + + The BCS serialized form for this type is defined by the following ABNF: + + ```text + bls-public-key = %x60 96OCTECT + ``` + + Due to historical reasons, even though a min-sig `Bls12381PublicKey` has a + fixed-length of 96, IOTA's binary representation of a min-sig + `Bls12381PublicKey` is prefixed with its length meaning its serialized + binary form (in bcs) is 97 bytes long vs a more compact 96 bytes. + """ + + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_bls12381publickey, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_bls12381publickey, self._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 from_bytes(cls, bytes: "bytes"): + _UniffiConverterBytes.check_lower(bytes) + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call_with_error(_UniffiConverterTypeBindingsSdkError,_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_bls12381publickey_from_bytes, + _UniffiConverterBytes.lower(bytes)) + return cls._make_instance_(pointer) + + @classmethod + def from_str(cls, s: "str"): + _UniffiConverterString.check_lower(s) + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call_with_error(_UniffiConverterTypeBindingsSdkError,_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_bls12381publickey_from_str, + _UniffiConverterString.lower(s)) + return cls._make_instance_(pointer) + + @classmethod + def generate(cls, ): + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_bls12381publickey_generate,) + return cls._make_instance_(pointer) + + + + def to_bytes(self, ) -> "bytes": + return _UniffiConverterBytes.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_bls12381publickey_to_bytes,self._uniffi_clone_pointer(),) + ) + + + + + + +class _UniffiConverterTypeBls12381PublicKey: + + @staticmethod + def lift(value: int): + return Bls12381PublicKey._make_instance_(value) + + @staticmethod + def check_lower(value: Bls12381PublicKey): + if not isinstance(value, Bls12381PublicKey): + raise TypeError("Expected Bls12381PublicKey instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: Bls12381PublicKeyProtocol): + if not isinstance(value, Bls12381PublicKey): + raise TypeError("Expected Bls12381PublicKey instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: Bls12381PublicKeyProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class ChangeEpochProtocol(typing.Protocol): + pass +# ChangeEpoch is a Rust-only trait - it's a wrapper around a Rust implementation. +class ChangeEpoch(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_changeepoch, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_changeepoch, self._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 _UniffiConverterTypeChangeEpoch: + + @staticmethod + def lift(value: int): + return ChangeEpoch._make_instance_(value) + + @staticmethod + def check_lower(value: ChangeEpoch): + if not isinstance(value, ChangeEpoch): + raise TypeError("Expected ChangeEpoch instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: ChangeEpochProtocol): + if not isinstance(value, ChangeEpoch): + raise TypeError("Expected ChangeEpoch instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: ChangeEpochProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class ChangeEpochV2Protocol(typing.Protocol): + pass +# ChangeEpochV2 is a Rust-only trait - it's a wrapper around a Rust implementation. +class ChangeEpochV2(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_changeepochv2, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_changeepochv2, self._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 _UniffiConverterTypeChangeEpochV2: + + @staticmethod + def lift(value: int): + return ChangeEpochV2._make_instance_(value) + + @staticmethod + def check_lower(value: ChangeEpochV2): + if not isinstance(value, ChangeEpochV2): + raise TypeError("Expected ChangeEpochV2 instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: ChangeEpochV2Protocol): + if not isinstance(value, ChangeEpochV2): + raise TypeError("Expected ChangeEpochV2 instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: ChangeEpochV2Protocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class CheckpointCommitmentProtocol(typing.Protocol): + def as_ecmh_live_object_set_digest(self, ): + raise NotImplementedError + def is_ecmh_live_object_set(self, ): + raise NotImplementedError +# CheckpointCommitment is a Rust-only trait - it's a wrapper around a Rust implementation. +class CheckpointCommitment(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_checkpointcommitment, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_checkpointcommitment, self._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 as_ecmh_live_object_set_digest(self, ) -> "Digest": + return _UniffiConverterTypeDigest.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_checkpointcommitment_as_ecmh_live_object_set_digest,self._uniffi_clone_pointer(),) + ) + + + + + + def is_ecmh_live_object_set(self, ) -> "bool": + return _UniffiConverterBool.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_checkpointcommitment_is_ecmh_live_object_set,self._uniffi_clone_pointer(),) + ) + + + + + + +class _UniffiConverterTypeCheckpointCommitment: + + @staticmethod + def lift(value: int): + return CheckpointCommitment._make_instance_(value) + + @staticmethod + def check_lower(value: CheckpointCommitment): + if not isinstance(value, CheckpointCommitment): + raise TypeError("Expected CheckpointCommitment instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: CheckpointCommitmentProtocol): + if not isinstance(value, CheckpointCommitment): + raise TypeError("Expected CheckpointCommitment instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: CheckpointCommitmentProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class CheckpointContentsDigestProtocol(typing.Protocol): + pass +# CheckpointContentsDigest is a Rust-only trait - it's a wrapper around a Rust implementation. +class CheckpointContentsDigest(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_checkpointcontentsdigest, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_checkpointcontentsdigest, self._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 _UniffiConverterTypeCheckpointContentsDigest: + + @staticmethod + def lift(value: int): + return CheckpointContentsDigest._make_instance_(value) + + @staticmethod + def check_lower(value: CheckpointContentsDigest): + if not isinstance(value, CheckpointContentsDigest): + raise TypeError("Expected CheckpointContentsDigest instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: CheckpointContentsDigestProtocol): + if not isinstance(value, CheckpointContentsDigest): + raise TypeError("Expected CheckpointContentsDigest instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: CheckpointContentsDigestProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class CheckpointDigestProtocol(typing.Protocol): + pass +# CheckpointDigest is a Rust-only trait - it's a wrapper around a Rust implementation. +class CheckpointDigest(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_checkpointdigest, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_checkpointdigest, self._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 _UniffiConverterTypeCheckpointDigest: + + @staticmethod + def lift(value: int): + return CheckpointDigest._make_instance_(value) + + @staticmethod + def check_lower(value: CheckpointDigest): + if not isinstance(value, CheckpointDigest): + raise TypeError("Expected CheckpointDigest instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: CheckpointDigestProtocol): + if not isinstance(value, CheckpointDigest): + raise TypeError("Expected CheckpointDigest instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: CheckpointDigestProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class CheckpointSummaryPageProtocol(typing.Protocol): + def data(self, ): + raise NotImplementedError + def is_empty(self, ): + raise NotImplementedError + def page_info(self, ): + raise NotImplementedError +# CheckpointSummaryPage is a Rust-only trait - it's a wrapper around a Rust implementation. +class CheckpointSummaryPage(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_checkpointsummarypage, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_checkpointsummarypage, self._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 data(self, ) -> "typing.List[CheckpointSummary]": + return _UniffiConverterSequenceTypeCheckpointSummary.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_checkpointsummarypage_data,self._uniffi_clone_pointer(),) + ) + + + + + + def is_empty(self, ) -> "bool": + return _UniffiConverterBool.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_checkpointsummarypage_is_empty,self._uniffi_clone_pointer(),) + ) + + + + + + def page_info(self, ) -> "PageInfo": + return _UniffiConverterTypePageInfo.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_checkpointsummarypage_page_info,self._uniffi_clone_pointer(),) + ) + + + + + + +class _UniffiConverterTypeCheckpointSummaryPage: + + @staticmethod + def lift(value: int): + return CheckpointSummaryPage._make_instance_(value) + + @staticmethod + def check_lower(value: CheckpointSummaryPage): + if not isinstance(value, CheckpointSummaryPage): + raise TypeError("Expected CheckpointSummaryPage instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: CheckpointSummaryPageProtocol): + if not isinstance(value, CheckpointSummaryPage): + raise TypeError("Expected CheckpointSummaryPage instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: CheckpointSummaryPageProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class CoinProtocol(typing.Protocol): + def balance(self, ): + raise NotImplementedError + def coin_type(self, ): + raise NotImplementedError + def id(self, ): + raise NotImplementedError +# Coin is a Rust-only trait - it's a wrapper around a Rust implementation. +class Coin(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_coin, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_coin, self._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 try_from_object(cls, object: "Object"): + _UniffiConverterTypeObject.check_lower(object) + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call_with_error(_UniffiConverterTypeBindingsSdkError,_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_coin_try_from_object, + _UniffiConverterTypeObject.lower(object)) + return cls._make_instance_(pointer) + + + + def balance(self, ) -> "int": + return _UniffiConverterUInt64.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_coin_balance,self._uniffi_clone_pointer(),) + ) + + + + + + def coin_type(self, ) -> "TypeTag": + return _UniffiConverterTypeTypeTag.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_coin_coin_type,self._uniffi_clone_pointer(),) + ) + + + + + + def id(self, ) -> "ObjectId": + return _UniffiConverterTypeObjectId.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_coin_id,self._uniffi_clone_pointer(),) + ) + + + + + + +class _UniffiConverterTypeCoin: + + @staticmethod + def lift(value: int): + return Coin._make_instance_(value) + + @staticmethod + def check_lower(value: Coin): + if not isinstance(value, Coin): + raise TypeError("Expected Coin instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: CoinProtocol): + if not isinstance(value, Coin): + raise TypeError("Expected Coin instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: CoinProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class CoinMetadataProtocol(typing.Protocol): + pass +# CoinMetadata is a Rust-only trait - it's a wrapper around a Rust implementation. +class CoinMetadata(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_coinmetadata, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_coinmetadata, self._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 _UniffiConverterTypeCoinMetadata: + + @staticmethod + def lift(value: int): + return CoinMetadata._make_instance_(value) + + @staticmethod + def check_lower(value: CoinMetadata): + if not isinstance(value, CoinMetadata): + raise TypeError("Expected CoinMetadata instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: CoinMetadataProtocol): + if not isinstance(value, CoinMetadata): + raise TypeError("Expected CoinMetadata instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: CoinMetadataProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class CoinPageProtocol(typing.Protocol): + def data(self, ): + raise NotImplementedError + def is_empty(self, ): + raise NotImplementedError + def page_info(self, ): + raise NotImplementedError +# CoinPage is a Rust-only trait - it's a wrapper around a Rust implementation. +class CoinPage(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_coinpage, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_coinpage, self._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 data(self, ) -> "typing.List[Coin]": + return _UniffiConverterSequenceTypeCoin.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_coinpage_data,self._uniffi_clone_pointer(),) + ) + + + + + + def is_empty(self, ) -> "bool": + return _UniffiConverterBool.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_coinpage_is_empty,self._uniffi_clone_pointer(),) + ) + + + + + + def page_info(self, ) -> "PageInfo": + return _UniffiConverterTypePageInfo.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_coinpage_page_info,self._uniffi_clone_pointer(),) + ) + + + + + + +class _UniffiConverterTypeCoinPage: + + @staticmethod + def lift(value: int): + return CoinPage._make_instance_(value) + + @staticmethod + def check_lower(value: CoinPage): + if not isinstance(value, CoinPage): + raise TypeError("Expected CoinPage instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: CoinPageProtocol): + if not isinstance(value, CoinPage): + raise TypeError("Expected CoinPage instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: CoinPageProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class ConsensusCommitDigestProtocol(typing.Protocol): + pass +# ConsensusCommitDigest is a Rust-only trait - it's a wrapper around a Rust implementation. +class ConsensusCommitDigest(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_consensuscommitdigest, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_consensuscommitdigest, self._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 _UniffiConverterTypeConsensusCommitDigest: + + @staticmethod + def lift(value: int): + return ConsensusCommitDigest._make_instance_(value) + + @staticmethod + def check_lower(value: ConsensusCommitDigest): + if not isinstance(value, ConsensusCommitDigest): + raise TypeError("Expected ConsensusCommitDigest instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: ConsensusCommitDigestProtocol): + if not isinstance(value, ConsensusCommitDigest): + raise TypeError("Expected ConsensusCommitDigest instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: ConsensusCommitDigestProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class ConsensusCommitPrologueV1Protocol(typing.Protocol): + pass +# ConsensusCommitPrologueV1 is a Rust-only trait - it's a wrapper around a Rust implementation. +class ConsensusCommitPrologueV1(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_consensuscommitprologuev1, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_consensuscommitprologuev1, self._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 _UniffiConverterTypeConsensusCommitPrologueV1: + + @staticmethod + def lift(value: int): + return ConsensusCommitPrologueV1._make_instance_(value) + + @staticmethod + def check_lower(value: ConsensusCommitPrologueV1): + if not isinstance(value, ConsensusCommitPrologueV1): + raise TypeError("Expected ConsensusCommitPrologueV1 instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: ConsensusCommitPrologueV1Protocol): + if not isinstance(value, ConsensusCommitPrologueV1): + raise TypeError("Expected ConsensusCommitPrologueV1 instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: ConsensusCommitPrologueV1Protocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class DigestProtocol(typing.Protocol): + """ + A 32-byte Blake2b256 hash output. + + # BCS + + A `Digest`'s BCS serialized form is defined by the following: + + ```text + digest = %x20 32OCTET + ``` + + Due to historical reasons, even though a `Digest` has a fixed-length of 32, + IOTA's binary representation of a `Digest` is prefixed with its length + meaning its serialized binary form (in bcs) is 33 bytes long vs a more + compact 32 bytes. + """ + + pass +# Digest is a Rust-only trait - it's a wrapper around a Rust implementation. +class Digest(): + """ + A 32-byte Blake2b256 hash output. + + # BCS + + A `Digest`'s BCS serialized form is defined by the following: + + ```text + digest = %x20 32OCTET + ``` + + Due to historical reasons, even though a `Digest` has a fixed-length of 32, + IOTA's binary representation of a `Digest` is prefixed with its length + meaning its serialized binary form (in bcs) is 33 bytes long vs a more + compact 32 bytes. + """ + + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_digest, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_digest, self._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 _UniffiConverterTypeDigest: + + @staticmethod + def lift(value: int): + return Digest._make_instance_(value) + + @staticmethod + def check_lower(value: Digest): + if not isinstance(value, Digest): + raise TypeError("Expected Digest instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: DigestProtocol): + if not isinstance(value, Digest): + raise TypeError("Expected Digest instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: DigestProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class DryRunResultProtocol(typing.Protocol): + pass +# DryRunResult is a Rust-only trait - it's a wrapper around a Rust implementation. +class DryRunResult(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_dryrunresult, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_dryrunresult, self._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 _UniffiConverterTypeDryRunResult: + + @staticmethod + def lift(value: int): + return DryRunResult._make_instance_(value) + + @staticmethod + def check_lower(value: DryRunResult): + if not isinstance(value, DryRunResult): + raise TypeError("Expected DryRunResult instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: DryRunResultProtocol): + if not isinstance(value, DryRunResult): + raise TypeError("Expected DryRunResult instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: DryRunResultProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class DynamicFieldOutputProtocol(typing.Protocol): + pass +# DynamicFieldOutput is a Rust-only trait - it's a wrapper around a Rust implementation. +class DynamicFieldOutput(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_dynamicfieldoutput, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_dynamicfieldoutput, self._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 _UniffiConverterTypeDynamicFieldOutput: + + @staticmethod + def lift(value: int): + return DynamicFieldOutput._make_instance_(value) + + @staticmethod + def check_lower(value: DynamicFieldOutput): + if not isinstance(value, DynamicFieldOutput): + raise TypeError("Expected DynamicFieldOutput instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: DynamicFieldOutputProtocol): + if not isinstance(value, DynamicFieldOutput): + raise TypeError("Expected DynamicFieldOutput instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: DynamicFieldOutputProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class DynamicFieldOutputPageProtocol(typing.Protocol): + def data(self, ): + raise NotImplementedError + def is_empty(self, ): + raise NotImplementedError + def page_info(self, ): + raise NotImplementedError +# DynamicFieldOutputPage is a Rust-only trait - it's a wrapper around a Rust implementation. +class DynamicFieldOutputPage(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_dynamicfieldoutputpage, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_dynamicfieldoutputpage, self._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 data(self, ) -> "typing.List[DynamicFieldOutput]": + return _UniffiConverterSequenceTypeDynamicFieldOutput.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_dynamicfieldoutputpage_data,self._uniffi_clone_pointer(),) + ) + + + + + + def is_empty(self, ) -> "bool": + return _UniffiConverterBool.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_dynamicfieldoutputpage_is_empty,self._uniffi_clone_pointer(),) + ) + + + + + + def page_info(self, ) -> "PageInfo": + return _UniffiConverterTypePageInfo.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_dynamicfieldoutputpage_page_info,self._uniffi_clone_pointer(),) + ) + + + + + + +class _UniffiConverterTypeDynamicFieldOutputPage: + + @staticmethod + def lift(value: int): + return DynamicFieldOutputPage._make_instance_(value) + + @staticmethod + def check_lower(value: DynamicFieldOutputPage): + if not isinstance(value, DynamicFieldOutputPage): + raise TypeError("Expected DynamicFieldOutputPage instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: DynamicFieldOutputPageProtocol): + if not isinstance(value, DynamicFieldOutputPage): + raise TypeError("Expected DynamicFieldOutputPage instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: DynamicFieldOutputPageProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class Ed25519PublicKeyProtocol(typing.Protocol): + """ + An ed25519 public key. + + # BCS + + The BCS serialized form for this type is defined by the following ABNF: + + ```text + ed25519-public-key = 32OCTECT + ``` + """ + + def to_bytes(self, ): + raise NotImplementedError +# Ed25519PublicKey is a Rust-only trait - it's a wrapper around a Rust implementation. +class Ed25519PublicKey(): + """ + An ed25519 public key. + + # BCS + + The BCS serialized form for this type is defined by the following ABNF: + + ```text + ed25519-public-key = 32OCTECT + ``` + """ + + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_ed25519publickey, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_ed25519publickey, self._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 from_bytes(cls, bytes: "bytes"): + _UniffiConverterBytes.check_lower(bytes) + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call_with_error(_UniffiConverterTypeBindingsSdkError,_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_ed25519publickey_from_bytes, + _UniffiConverterBytes.lower(bytes)) + return cls._make_instance_(pointer) + + @classmethod + def from_str(cls, s: "str"): + _UniffiConverterString.check_lower(s) + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call_with_error(_UniffiConverterTypeBindingsSdkError,_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_ed25519publickey_from_str, + _UniffiConverterString.lower(s)) + return cls._make_instance_(pointer) + + @classmethod + def generate(cls, ): + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_ed25519publickey_generate,) + return cls._make_instance_(pointer) + + + + def to_bytes(self, ) -> "bytes": + return _UniffiConverterBytes.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_ed25519publickey_to_bytes,self._uniffi_clone_pointer(),) + ) + + + + + + +class _UniffiConverterTypeEd25519PublicKey: + + @staticmethod + def lift(value: int): + return Ed25519PublicKey._make_instance_(value) + + @staticmethod + def check_lower(value: Ed25519PublicKey): + if not isinstance(value, Ed25519PublicKey): + raise TypeError("Expected Ed25519PublicKey instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: Ed25519PublicKeyProtocol): + if not isinstance(value, Ed25519PublicKey): + raise TypeError("Expected Ed25519PublicKey instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: Ed25519PublicKeyProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class EffectsAuxiliaryDataDigestProtocol(typing.Protocol): + pass +# EffectsAuxiliaryDataDigest is a Rust-only trait - it's a wrapper around a Rust implementation. +class EffectsAuxiliaryDataDigest(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_effectsauxiliarydatadigest, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_effectsauxiliarydatadigest, self._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 _UniffiConverterTypeEffectsAuxiliaryDataDigest: + + @staticmethod + def lift(value: int): + return EffectsAuxiliaryDataDigest._make_instance_(value) + + @staticmethod + def check_lower(value: EffectsAuxiliaryDataDigest): + if not isinstance(value, EffectsAuxiliaryDataDigest): + raise TypeError("Expected EffectsAuxiliaryDataDigest instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: EffectsAuxiliaryDataDigestProtocol): + if not isinstance(value, EffectsAuxiliaryDataDigest): + raise TypeError("Expected EffectsAuxiliaryDataDigest instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: EffectsAuxiliaryDataDigestProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class EndOfEpochTransactionKindProtocol(typing.Protocol): + """ + Operation run at the end of an epoch + + # BCS + + The BCS serialized form for this type is defined by the following ABNF: + + ```text + end-of-epoch-transaction-kind = eoe-change-epoch + =/ eoe-authenticator-state-create + =/ eoe-authenticator-state-expire + =/ eoe-randomness-state-create + =/ eoe-deny-list-state-create + =/ eoe-bridge-state-create + =/ eoe-bridge-committee-init + =/ eoe-store-execution-time-observations + + eoe-change-epoch = %x00 change-epoch + eoe-authenticator-state-create = %x01 + eoe-authenticator-state-expire = %x02 authenticator-state-expire + eoe-randomness-state-create = %x03 + eoe-deny-list-state-create = %x04 + eoe-bridge-state-create = %x05 digest + eoe-bridge-committee-init = %x06 u64 + eoe-store-execution-time-observations = %x07 stored-execution-time-observations + ``` + """ + + pass +# EndOfEpochTransactionKind is a Rust-only trait - it's a wrapper around a Rust implementation. +class EndOfEpochTransactionKind(): + """ + Operation run at the end of an epoch + + # BCS + + The BCS serialized form for this type is defined by the following ABNF: + + ```text + end-of-epoch-transaction-kind = eoe-change-epoch + =/ eoe-authenticator-state-create + =/ eoe-authenticator-state-expire + =/ eoe-randomness-state-create + =/ eoe-deny-list-state-create + =/ eoe-bridge-state-create + =/ eoe-bridge-committee-init + =/ eoe-store-execution-time-observations + + eoe-change-epoch = %x00 change-epoch + eoe-authenticator-state-create = %x01 + eoe-authenticator-state-expire = %x02 authenticator-state-expire + eoe-randomness-state-create = %x03 + eoe-deny-list-state-create = %x04 + eoe-bridge-state-create = %x05 digest + eoe-bridge-committee-init = %x06 u64 + eoe-store-execution-time-observations = %x07 stored-execution-time-observations + ``` + """ + + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_endofepochtransactionkind, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_endofepochtransactionkind, self._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 authenticator_state_create(cls, ): + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_endofepochtransactionkind_authenticator_state_create,) + return cls._make_instance_(pointer) + + @classmethod + def authenticator_state_expire(cls, tx: "AuthenticatorStateExpire"): + _UniffiConverterTypeAuthenticatorStateExpire.check_lower(tx) + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_endofepochtransactionkind_authenticator_state_expire, + _UniffiConverterTypeAuthenticatorStateExpire.lower(tx)) + return cls._make_instance_(pointer) + + @classmethod + def bridge_committee_init(cls, bridge_object_version: "int"): + _UniffiConverterUInt64.check_lower(bridge_object_version) + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_endofepochtransactionkind_bridge_committee_init, + _UniffiConverterUInt64.lower(bridge_object_version)) + return cls._make_instance_(pointer) + + @classmethod + def bridge_state_create(cls, chain_id: "CheckpointDigest"): + _UniffiConverterTypeCheckpointDigest.check_lower(chain_id) + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_endofepochtransactionkind_bridge_state_create, + _UniffiConverterTypeCheckpointDigest.lower(chain_id)) + return cls._make_instance_(pointer) + + @classmethod + def change_epoch(cls, tx: "ChangeEpoch"): + _UniffiConverterTypeChangeEpoch.check_lower(tx) + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_endofepochtransactionkind_change_epoch, + _UniffiConverterTypeChangeEpoch.lower(tx)) + return cls._make_instance_(pointer) + + @classmethod + def change_epoch_v2(cls, tx: "ChangeEpochV2"): + _UniffiConverterTypeChangeEpochV2.check_lower(tx) + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_endofepochtransactionkind_change_epoch_v2, + _UniffiConverterTypeChangeEpochV2.lower(tx)) + return cls._make_instance_(pointer) + + @classmethod + def store_execution_time_observations(cls, obs: "ExecutionTimeObservations"): + _UniffiConverterTypeExecutionTimeObservations.check_lower(obs) + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_endofepochtransactionkind_store_execution_time_observations, + _UniffiConverterTypeExecutionTimeObservations.lower(obs)) + return cls._make_instance_(pointer) + + + + +class _UniffiConverterTypeEndOfEpochTransactionKind: + + @staticmethod + def lift(value: int): + return EndOfEpochTransactionKind._make_instance_(value) + + @staticmethod + def check_lower(value: EndOfEpochTransactionKind): + if not isinstance(value, EndOfEpochTransactionKind): + raise TypeError("Expected EndOfEpochTransactionKind instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: EndOfEpochTransactionKindProtocol): + if not isinstance(value, EndOfEpochTransactionKind): + raise TypeError("Expected EndOfEpochTransactionKind instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: EndOfEpochTransactionKindProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class EpochProtocol(typing.Protocol): + pass +# Epoch is a Rust-only trait - it's a wrapper around a Rust implementation. +class Epoch(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_epoch, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_epoch, self._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 _UniffiConverterTypeEpoch: + + @staticmethod + def lift(value: int): + return Epoch._make_instance_(value) + + @staticmethod + def check_lower(value: Epoch): + if not isinstance(value, Epoch): + raise TypeError("Expected Epoch instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: EpochProtocol): + if not isinstance(value, Epoch): + raise TypeError("Expected Epoch instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: EpochProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class EpochPageProtocol(typing.Protocol): + def data(self, ): + raise NotImplementedError + def is_empty(self, ): + raise NotImplementedError + def page_info(self, ): + raise NotImplementedError +# EpochPage is a Rust-only trait - it's a wrapper around a Rust implementation. +class EpochPage(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_epochpage, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_epochpage, self._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 data(self, ) -> "typing.List[Epoch]": + return _UniffiConverterSequenceTypeEpoch.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_epochpage_data,self._uniffi_clone_pointer(),) + ) + + + + + + def is_empty(self, ) -> "bool": + return _UniffiConverterBool.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_epochpage_is_empty,self._uniffi_clone_pointer(),) + ) + + + + + + def page_info(self, ) -> "PageInfo": + return _UniffiConverterTypePageInfo.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_epochpage_page_info,self._uniffi_clone_pointer(),) + ) + + + + + + +class _UniffiConverterTypeEpochPage: + + @staticmethod + def lift(value: int): + return EpochPage._make_instance_(value) + + @staticmethod + def check_lower(value: EpochPage): + if not isinstance(value, EpochPage): + raise TypeError("Expected EpochPage instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: EpochPageProtocol): + if not isinstance(value, EpochPage): + raise TypeError("Expected EpochPage instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: EpochPageProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class ExecutionTimeObservationsProtocol(typing.Protocol): + pass +# ExecutionTimeObservations is a Rust-only trait - it's a wrapper around a Rust implementation. +class ExecutionTimeObservations(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_executiontimeobservations, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_executiontimeobservations, self._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 _UniffiConverterTypeExecutionTimeObservations: + + @staticmethod + def lift(value: int): + return ExecutionTimeObservations._make_instance_(value) + + @staticmethod + def check_lower(value: ExecutionTimeObservations): + if not isinstance(value, ExecutionTimeObservations): + raise TypeError("Expected ExecutionTimeObservations instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: ExecutionTimeObservationsProtocol): + if not isinstance(value, ExecutionTimeObservations): + raise TypeError("Expected ExecutionTimeObservations instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: ExecutionTimeObservationsProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class FaucetClientProtocol(typing.Protocol): + def request(self, address: "Address"): + """ + Request gas from the faucet. Note that this will return the UUID of the + request and not wait until the token is received. Use + `request_and_wait` to wait for the token. + """ + + raise NotImplementedError + def request_and_wait(self, address: "Address"): + """ + Request gas from the faucet and wait until the request is completed and + token is transferred. Returns `FaucetReceipt` if the request is + successful, which contains the list of tokens transferred, and the + transaction digest. + + Note that the faucet is heavily rate-limited, so calling repeatedly the + faucet would likely result in a 429 code or 502 code. + """ + + raise NotImplementedError + def request_status(self, id: "str"): + """ + Check the faucet request status. + + Possible statuses are defined in: [`BatchSendStatusType`] + """ + + raise NotImplementedError +# FaucetClient is a Rust-only trait - it's a wrapper around a Rust implementation. +class FaucetClient(): + _pointer: ctypes.c_void_p + def __init__(self, faucet_url: "str"): + """ + Construct a new `FaucetClient` with the given faucet service URL. This + [`FaucetClient`] expects that the service provides two endpoints: + /v1/gas and /v1/status. As such, do not provide the request + endpoint, just the top level service endpoint. + + - /v1/gas is used to request gas + - /v1/status/taks-uuid is used to check the status of the request + """ + + _UniffiConverterString.check_lower(faucet_url) + + self._pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_faucetclient_new, + _UniffiConverterString.lower(faucet_url)) + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_faucetclient, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_faucetclient, self._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 devnet(cls, ): + """ + Set to devnet faucet. + """ + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_faucetclient_devnet,) + return cls._make_instance_(pointer) + + @classmethod + def local(cls, ): + """ + Set to local faucet. + """ + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_faucetclient_local,) + return cls._make_instance_(pointer) + + @classmethod + def testnet(cls, ): + """ + Set to testnet faucet. + """ + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_faucetclient_testnet,) + return cls._make_instance_(pointer) + + + async def request(self, address: "Address") -> "typing.Optional[str]": + """ + Request gas from the faucet. Note that this will return the UUID of the + request and not wait until the token is received. Use + `request_and_wait` to wait for the token. + """ + + _UniffiConverterTypeAddress.check_lower(address) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_faucetclient_request( + self._uniffi_clone_pointer(), + _UniffiConverterTypeAddress.lower(address) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalString.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def request_and_wait(self, address: "Address") -> "typing.Optional[FaucetReceipt]": + """ + Request gas from the faucet and wait until the request is completed and + token is transferred. Returns `FaucetReceipt` if the request is + successful, which contains the list of tokens transferred, and the + transaction digest. + + Note that the faucet is heavily rate-limited, so calling repeatedly the + faucet would likely result in a 429 code or 502 code. + """ + + _UniffiConverterTypeAddress.check_lower(address) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_faucetclient_request_and_wait( + self._uniffi_clone_pointer(), + _UniffiConverterTypeAddress.lower(address) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalTypeFaucetReceipt.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def request_status(self, id: "str") -> "typing.Optional[BatchSendStatus]": + """ + Check the faucet request status. + + Possible statuses are defined in: [`BatchSendStatusType`] + """ + + _UniffiConverterString.check_lower(id) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_faucetclient_request_status( + self._uniffi_clone_pointer(), + _UniffiConverterString.lower(id) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalTypeBatchSendStatus.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + + +class _UniffiConverterTypeFaucetClient: + + @staticmethod + def lift(value: int): + return FaucetClient._make_instance_(value) + + @staticmethod + def check_lower(value: FaucetClient): + if not isinstance(value, FaucetClient): + raise TypeError("Expected FaucetClient instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: FaucetClientProtocol): + if not isinstance(value, FaucetClient): + raise TypeError("Expected FaucetClient instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: FaucetClientProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class FaucetReceiptProtocol(typing.Protocol): + pass +# FaucetReceipt is a Rust-only trait - it's a wrapper around a Rust implementation. +class FaucetReceipt(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_faucetreceipt, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_faucetreceipt, self._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 _UniffiConverterTypeFaucetReceipt: + + @staticmethod + def lift(value: int): + return FaucetReceipt._make_instance_(value) + + @staticmethod + def check_lower(value: FaucetReceipt): + if not isinstance(value, FaucetReceipt): + raise TypeError("Expected FaucetReceipt instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: FaucetReceiptProtocol): + if not isinstance(value, FaucetReceipt): + raise TypeError("Expected FaucetReceipt instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: FaucetReceiptProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class GenesisTransactionProtocol(typing.Protocol): + pass +# GenesisTransaction is a Rust-only trait - it's a wrapper around a Rust implementation. +class GenesisTransaction(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_genesistransaction, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_genesistransaction, self._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 _UniffiConverterTypeGenesisTransaction: + + @staticmethod + def lift(value: int): + return GenesisTransaction._make_instance_(value) + + @staticmethod + def check_lower(value: GenesisTransaction): + if not isinstance(value, GenesisTransaction): + raise TypeError("Expected GenesisTransaction instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: GenesisTransactionProtocol): + if not isinstance(value, GenesisTransaction): + raise TypeError("Expected GenesisTransaction instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: GenesisTransactionProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class GraphQlClientProtocol(typing.Protocol): + def active_validators(self, pagination_filter: "PaginationFilter",epoch: "typing.Union[object, typing.Optional[int]]" = _DEFAULT): + """ + Get the list of active validators for the provided epoch, including + related metadata. If no epoch is provided, it will return the active + validators for the current epoch. + """ + + raise NotImplementedError + def balance(self, address: "Address",coin_type: "typing.Union[object, typing.Optional[str]]" = _DEFAULT): + """ + Get the balance of all the coins owned by address for the provided coin + type. Coin type will default to `0x2::coin::Coin<0x2::iota::IOTA>` + if not provided. + """ + + raise NotImplementedError + def chain_id(self, ): + """ + Get the chain identifier. + """ + + raise NotImplementedError + def checkpoint(self, digest: "typing.Union[object, typing.Optional[CheckpointDigest]]" = _DEFAULT,seq_num: "typing.Union[object, typing.Optional[int]]" = _DEFAULT): + """ + Get the [`CheckpointSummary`] for a given checkpoint digest or + checkpoint id. If none is provided, it will use the last known + checkpoint id. + """ + + raise NotImplementedError + def checkpoints(self, pagination_filter: "PaginationFilter"): + """ + Get a page of [`CheckpointSummary`] for the provided parameters. + """ + + raise NotImplementedError + def coin_metadata(self, coin_type: "str"): + """ + Get the coin metadata for the coin type. + """ + + raise NotImplementedError + def coins(self, owner: "Address",pagination_filter: "PaginationFilter",coin_type: "typing.Union[object, typing.Optional[str]]" = _DEFAULT): + """ + Get the list of coins for the specified address. + + If `coin_type` is not provided, it will default to `0x2::coin::Coin`, + which will return all coins. For IOTA coin, pass in the coin type: + `0x2::coin::Coin<0x2::iota::IOTA>`. + """ + + raise NotImplementedError + def dry_run_tx(self, tx: "Transaction",skip_checks: "typing.Union[object, typing.Optional[bool]]" = _DEFAULT): + """ + Dry run a [`Transaction`] and return the transaction effects and dry run + error (if any). + + `skipChecks` optional flag disables the usual verification checks that + prevent access to objects that are owned by addresses other than the + sender, and calling non-public, non-entry functions, and some other + checks. Defaults to false. + """ + + raise NotImplementedError + def dry_run_tx_kind(self, tx_kind: "TransactionKind",tx_meta: "TransactionMetadata",skip_checks: "typing.Union[object, typing.Optional[bool]]" = _DEFAULT): + """ + Dry run a [`TransactionKind`] and return the transaction effects and dry + run error (if any). + + `skipChecks` optional flag disables the usual verification checks that + prevent access to objects that are owned by addresses other than the + sender, and calling non-public, non-entry functions, and some other + checks. Defaults to false. + + `tx_meta` is the transaction metadata. + """ + + raise NotImplementedError + def dynamic_field(self, address: "Address",type: "TypeTag",name: "Value"): + """ + Access a dynamic field on an object using its name. Names are arbitrary + Move values whose type have copy, drop, and store, and are specified + using their type, and their BCS contents, Base64 encoded. + + The `name` argument is a json serialized type. + + This returns [`DynamicFieldOutput`] which contains the name, the value + as json, and object. + + # Example + ```rust,ignore + + let client = iota_graphql_client::Client::new_devnet(); + let address = Address::from_str("0x5").unwrap(); + let df = client.dynamic_field_with_name(address, "u64", 2u64).await.unwrap(); + + # alternatively, pass in the bcs bytes + let bcs = base64ct::Base64::decode_vec("AgAAAAAAAAA=").unwrap(); + let df = client.dynamic_field(address, "u64", BcsName(bcs)).await.unwrap(); + ``` + """ + + raise NotImplementedError + def dynamic_fields(self, address: "Address",pagination_filter: "PaginationFilter"): + """ + Get a page of dynamic fields for the provided address. Note that this + will also fetch dynamic fields on wrapped objects. + + This returns [`Page`] of [`DynamicFieldOutput`]s. + """ + + raise NotImplementedError + def dynamic_object_field(self, address: "Address",type: "TypeTag",name: "Value"): + """ + Access a dynamic object field on an object using its name. Names are + arbitrary Move values whose type have copy, drop, and store, and are + specified using their type, and their BCS contents, Base64 encoded. + + The `name` argument is a json serialized type. + + This returns [`DynamicFieldOutput`] which contains the name, the value + as json, and object. + """ + + raise NotImplementedError + def epoch(self, epoch: "typing.Union[object, typing.Optional[int]]" = _DEFAULT): + """ + Return the epoch information for the provided epoch. If no epoch is + provided, it will return the last known epoch. + """ + + raise NotImplementedError + def epoch_total_checkpoints(self, epoch: "typing.Union[object, typing.Optional[int]]" = _DEFAULT): + """ + Return the number of checkpoints in this epoch. This will return + `Ok(None)` if the epoch requested is not available in the GraphQL + service (e.g., due to pruning). + """ + + raise NotImplementedError + def epoch_total_transaction_blocks(self, epoch: "typing.Union[object, typing.Optional[int]]" = _DEFAULT): + """ + Return the number of transaction blocks in this epoch. This will return + `Ok(None)` if the epoch requested is not available in the GraphQL + service (e.g., due to pruning). + """ + + raise NotImplementedError + def epochs(self, pagination_filter: "PaginationFilter"): + """ + Return a page of epochs. + """ + + raise NotImplementedError + def events(self, pagination_filter: "PaginationFilter",filter: "typing.Union[object, typing.Optional[EventFilter]]" = _DEFAULT): + """ + Return a page of tuple (event, transaction digest) based on the + (optional) event filter. + """ + + raise NotImplementedError + def execute_tx(self, signatures: "typing.List[UserSignature]",tx: "Transaction"): + """ + Execute a transaction. + """ + + raise NotImplementedError + def latest_checkpoint_sequence_number(self, ): + """ + Return the sequence number of the latest checkpoint that has been + executed. + """ + + raise NotImplementedError + def max_page_size(self, ): + """ + Lazily fetch the max page size + """ + + raise NotImplementedError + def move_object_contents(self, object_id: "ObjectId",version: "typing.Union[object, typing.Optional[int]]" = _DEFAULT): + """ + Return the contents' JSON of an object that is a Move object. + + If the object does not exist (e.g., due to pruning), this will return + `Ok(None)`. Similarly, if this is not an object but an address, it + will return `Ok(None)`. + """ + + raise NotImplementedError + def move_object_contents_bcs(self, object_id: "ObjectId",version: "typing.Union[object, typing.Optional[int]]" = _DEFAULT): + """ + Return the BCS of an object that is a Move object. + + If the object does not exist (e.g., due to pruning), this will return + `Ok(None)`. Similarly, if this is not an object but an address, it + will return `Ok(None)`. + """ + + raise NotImplementedError + def normalized_move_function(self, package: "str",module: "str",function: "str",version: "typing.Union[object, typing.Optional[int]]" = _DEFAULT): + """ + Return the normalized Move function data for the provided package, + module, and function. + """ + + raise NotImplementedError + def normalized_move_module(self, package: "str",module: "str",pagination_filter_enums: "PaginationFilter",pagination_filter_friends: "PaginationFilter",pagination_filter_functions: "PaginationFilter",pagination_filter_structs: "PaginationFilter",version: "typing.Union[object, typing.Optional[int]]" = _DEFAULT): + """ + Return the normalized Move module data for the provided module. + """ + + raise NotImplementedError + def object(self, object_id: "ObjectId",version: "typing.Union[object, typing.Optional[int]]" = _DEFAULT): + """ + Return an object based on the provided [`Address`]. + + If the object does not exist (e.g., due to pruning), this will return + `Ok(None)`. Similarly, if this is not an object but an address, it + will return `Ok(None)`. + """ + + raise NotImplementedError + def object_bcs(self, object_id: "ObjectId"): + """ + Return the object's bcs content [`Vec`] based on the provided + [`Address`]. + """ + + raise NotImplementedError + def objects(self, pagination_filter: "PaginationFilter",filter: "typing.Union[object, typing.Optional[ObjectFilter]]" = _DEFAULT): + """ + Return a page of objects based on the provided parameters. + + Use this function together with the [`ObjectFilter::owner`] to get the + objects owned by an address. + + # Example + + ```rust,ignore + let filter = ObjectFilter { + type_: None, + owner: Some(Address::from_str("test").unwrap().into()), + object_ids: None, + }; + + let owned_objects = client.objects(None, None, Some(filter), None, None).await; + ``` + """ + + raise NotImplementedError + def package(self, address: "Address",version: "typing.Union[object, typing.Optional[int]]" = _DEFAULT): + """ + The package corresponding to the given address (at the optionally given + version). When no version is given, the package is loaded directly + from the address given. Otherwise, the address is translated before + loading to point to the package whose original ID matches + the package at address, but whose version is version. For non-system + packages, this might result in a different address than address + because different versions of a package, introduced by upgrades, + exist at distinct addresses. + + Note that this interpretation of version is different from a historical + object read (the interpretation of version for the object query). + """ + + raise NotImplementedError + def package_by_name(self, name: "str"): + """ + Fetch a package by its name (using Move Registry Service) + """ + + raise NotImplementedError + def package_latest(self, address: "Address"): + """ + Fetch the latest version of the package at address. + This corresponds to the package with the highest version that shares its + original ID with the package at address. + """ + + raise NotImplementedError + def package_versions(self, address: "Address",pagination_filter: "PaginationFilter",after_version: "typing.Union[object, typing.Optional[int]]" = _DEFAULT,before_version: "typing.Union[object, typing.Optional[int]]" = _DEFAULT): + """ + Fetch all versions of package at address (packages that share this + package's original ID), optionally bounding the versions exclusively + from below with afterVersion, or from above with beforeVersion. + """ + + raise NotImplementedError + def packages(self, pagination_filter: "PaginationFilter",after_checkpoint: "typing.Union[object, typing.Optional[int]]" = _DEFAULT,before_checkpoint: "typing.Union[object, typing.Optional[int]]" = _DEFAULT): + """ + The Move packages that exist in the network, optionally filtered to be + strictly before beforeCheckpoint and/or strictly after + afterCheckpoint. + + This query returns all versions of a given user package that appear + between the specified checkpoints, but only records the latest + versions of system packages. + """ + + raise NotImplementedError + def protocol_config(self, version: "typing.Union[object, typing.Optional[int]]" = _DEFAULT): + """ + Get the protocol configuration. + """ + + raise NotImplementedError + def reference_gas_price(self, epoch: "typing.Union[object, typing.Optional[int]]" = _DEFAULT): + """ + Get the reference gas price for the provided epoch or the last known one + if no epoch is provided. + + This will return `Ok(None)` if the epoch requested is not available in + the GraphQL service (e.g., due to pruning). + """ + + raise NotImplementedError + def service_config(self, ): + """ + Get the GraphQL service configuration, including complexity limits, read + and mutation limits, supported versions, and others. + """ + + raise NotImplementedError + def set_rpc_server(self, server: "str"): + """ + Set the server address for the GraphQL GraphQL client. It should be a + valid URL with a host and optionally a port number. + """ + + raise NotImplementedError + def total_supply(self, coin_type: "str"): + """ + Get total supply for the coin type. + """ + + raise NotImplementedError + def total_transaction_blocks(self, ): + """ + The total number of transaction blocks in the network by the end of the + last known checkpoint. + """ + + raise NotImplementedError + def total_transaction_blocks_by_digest(self, digest: "CheckpointDigest"): + """ + The total number of transaction blocks in the network by the end of the + provided checkpoint digest. + """ + + raise NotImplementedError + def total_transaction_blocks_by_seq_num(self, seq_num: "int"): + """ + The total number of transaction blocks in the network by the end of the + provided checkpoint sequence number. + """ + + raise NotImplementedError + def transaction(self, digest: "TransactionDigest"): + """ + Get a transaction by its digest. + """ + + raise NotImplementedError + def transaction_data_effects(self, digest: "TransactionDigest"): + """ + Get a transaction's data and effects by its digest. + """ + + raise NotImplementedError + def transaction_effects(self, digest: "TransactionDigest"): + """ + Get a transaction's effects by its digest. + """ + + raise NotImplementedError + def transactions(self, pagination_filter: "PaginationFilter",filter: "typing.Union[object, typing.Optional[TransactionsFilter]]" = _DEFAULT): + """ + Get a page of transactions based on the provided filters. + """ + + raise NotImplementedError + def transactions_data_effects(self, pagination_filter: "PaginationFilter",filter: "typing.Union[object, typing.Optional[TransactionsFilter]]" = _DEFAULT): + """ + Get a page of transactions' data and effects based on the provided + filters. + """ + + raise NotImplementedError + def transactions_effects(self, pagination_filter: "PaginationFilter",filter: "typing.Union[object, typing.Optional[TransactionsFilter]]" = _DEFAULT): + """ + Get a page of transactions' effects based on the provided filters. + """ + + raise NotImplementedError +# GraphQlClient is a Rust-only trait - it's a wrapper around a Rust implementation. +class GraphQlClient(): + _pointer: ctypes.c_void_p + def __init__(self, server: "str"): + """ + Create a new GraphQL client with the provided server address. + """ + + _UniffiConverterString.check_lower(server) + + self._pointer = _uniffi_rust_call_with_error(_UniffiConverterTypeBindingsSdkError,_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_graphqlclient_new, + _UniffiConverterString.lower(server)) + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_graphqlclient, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_graphqlclient, self._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_devnet(cls, ): + """ + Create a new GraphQL client connected to the `devnet` GraphQL server: + {DEVNET_HOST}. + """ + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_graphqlclient_new_devnet,) + return cls._make_instance_(pointer) + + @classmethod + def new_localhost(cls, ): + """ + Create a new GraphQL client connected to the `localhost` GraphQL server: + {DEFAULT_LOCAL_HOST}. + """ + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_graphqlclient_new_localhost,) + return cls._make_instance_(pointer) + + @classmethod + def new_mainnet(cls, ): + """ + Create a new GraphQL client connected to the `mainnet` GraphQL server: + {MAINNET_HOST}. + """ + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_graphqlclient_new_mainnet,) + return cls._make_instance_(pointer) + + @classmethod + def new_testnet(cls, ): + """ + Create a new GraphQL client connected to the `testnet` GraphQL server: + {TESTNET_HOST}. + """ + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_graphqlclient_new_testnet,) + return cls._make_instance_(pointer) + + + async def active_validators(self, pagination_filter: "PaginationFilter",epoch: "typing.Union[object, typing.Optional[int]]" = _DEFAULT) -> "ValidatorPage": + """ + Get the list of active validators for the provided epoch, including + related metadata. If no epoch is provided, it will return the active + validators for the current epoch. + """ + + _UniffiConverterTypePaginationFilter.check_lower(pagination_filter) + + if epoch is _DEFAULT: + epoch = None + _UniffiConverterOptionalUInt64.check_lower(epoch) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_active_validators( + self._uniffi_clone_pointer(), + _UniffiConverterTypePaginationFilter.lower(pagination_filter), + _UniffiConverterOptionalUInt64.lower(epoch) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_pointer, + # lift function + _UniffiConverterTypeValidatorPage.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def balance(self, address: "Address",coin_type: "typing.Union[object, typing.Optional[str]]" = _DEFAULT) -> "typing.Optional[int]": + """ + Get the balance of all the coins owned by address for the provided coin + type. Coin type will default to `0x2::coin::Coin<0x2::iota::IOTA>` + if not provided. + """ + + _UniffiConverterTypeAddress.check_lower(address) + + if coin_type is _DEFAULT: + coin_type = None + _UniffiConverterOptionalString.check_lower(coin_type) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_balance( + self._uniffi_clone_pointer(), + _UniffiConverterTypeAddress.lower(address), + _UniffiConverterOptionalString.lower(coin_type) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalUInt64.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def chain_id(self, ) -> "str": + """ + Get the chain identifier. + """ + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_chain_id( + self._uniffi_clone_pointer(), + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterString.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def checkpoint(self, digest: "typing.Union[object, typing.Optional[CheckpointDigest]]" = _DEFAULT,seq_num: "typing.Union[object, typing.Optional[int]]" = _DEFAULT) -> "typing.Optional[CheckpointSummary]": + """ + Get the [`CheckpointSummary`] for a given checkpoint digest or + checkpoint id. If none is provided, it will use the last known + checkpoint id. + """ + + if digest is _DEFAULT: + digest = None + _UniffiConverterOptionalTypeCheckpointDigest.check_lower(digest) + + if seq_num is _DEFAULT: + seq_num = None + _UniffiConverterOptionalUInt64.check_lower(seq_num) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_checkpoint( + self._uniffi_clone_pointer(), + _UniffiConverterOptionalTypeCheckpointDigest.lower(digest), + _UniffiConverterOptionalUInt64.lower(seq_num) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalTypeCheckpointSummary.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def checkpoints(self, pagination_filter: "PaginationFilter") -> "CheckpointSummaryPage": + """ + Get a page of [`CheckpointSummary`] for the provided parameters. + """ + + _UniffiConverterTypePaginationFilter.check_lower(pagination_filter) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_checkpoints( + self._uniffi_clone_pointer(), + _UniffiConverterTypePaginationFilter.lower(pagination_filter) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_pointer, + # lift function + _UniffiConverterTypeCheckpointSummaryPage.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def coin_metadata(self, coin_type: "str") -> "typing.Optional[CoinMetadata]": + """ + Get the coin metadata for the coin type. + """ + + _UniffiConverterString.check_lower(coin_type) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_coin_metadata( + self._uniffi_clone_pointer(), + _UniffiConverterString.lower(coin_type) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalTypeCoinMetadata.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def coins(self, owner: "Address",pagination_filter: "PaginationFilter",coin_type: "typing.Union[object, typing.Optional[str]]" = _DEFAULT) -> "CoinPage": + """ + Get the list of coins for the specified address. + + If `coin_type` is not provided, it will default to `0x2::coin::Coin`, + which will return all coins. For IOTA coin, pass in the coin type: + `0x2::coin::Coin<0x2::iota::IOTA>`. + """ + + _UniffiConverterTypeAddress.check_lower(owner) + + _UniffiConverterTypePaginationFilter.check_lower(pagination_filter) + + if coin_type is _DEFAULT: + coin_type = None + _UniffiConverterOptionalString.check_lower(coin_type) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_coins( + self._uniffi_clone_pointer(), + _UniffiConverterTypeAddress.lower(owner), + _UniffiConverterTypePaginationFilter.lower(pagination_filter), + _UniffiConverterOptionalString.lower(coin_type) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_pointer, + # lift function + _UniffiConverterTypeCoinPage.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def dry_run_tx(self, tx: "Transaction",skip_checks: "typing.Union[object, typing.Optional[bool]]" = _DEFAULT) -> "DryRunResult": + """ + Dry run a [`Transaction`] and return the transaction effects and dry run + error (if any). + + `skipChecks` optional flag disables the usual verification checks that + prevent access to objects that are owned by addresses other than the + sender, and calling non-public, non-entry functions, and some other + checks. Defaults to false. + """ + + _UniffiConverterTypeTransaction.check_lower(tx) + + if skip_checks is _DEFAULT: + skip_checks = None + _UniffiConverterOptionalBool.check_lower(skip_checks) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_dry_run_tx( + self._uniffi_clone_pointer(), + _UniffiConverterTypeTransaction.lower(tx), + _UniffiConverterOptionalBool.lower(skip_checks) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_pointer, + # lift function + _UniffiConverterTypeDryRunResult.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def dry_run_tx_kind(self, tx_kind: "TransactionKind",tx_meta: "TransactionMetadata",skip_checks: "typing.Union[object, typing.Optional[bool]]" = _DEFAULT) -> "DryRunResult": + """ + Dry run a [`TransactionKind`] and return the transaction effects and dry + run error (if any). + + `skipChecks` optional flag disables the usual verification checks that + prevent access to objects that are owned by addresses other than the + sender, and calling non-public, non-entry functions, and some other + checks. Defaults to false. + + `tx_meta` is the transaction metadata. + """ + + _UniffiConverterTypeTransactionKind.check_lower(tx_kind) + + _UniffiConverterTypeTransactionMetadata.check_lower(tx_meta) + + if skip_checks is _DEFAULT: + skip_checks = None + _UniffiConverterOptionalBool.check_lower(skip_checks) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_dry_run_tx_kind( + self._uniffi_clone_pointer(), + _UniffiConverterTypeTransactionKind.lower(tx_kind), + _UniffiConverterTypeTransactionMetadata.lower(tx_meta), + _UniffiConverterOptionalBool.lower(skip_checks) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_pointer, + # lift function + _UniffiConverterTypeDryRunResult.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def dynamic_field(self, address: "Address",type: "TypeTag",name: "Value") -> "typing.Optional[DynamicFieldOutput]": + """ + Access a dynamic field on an object using its name. Names are arbitrary + Move values whose type have copy, drop, and store, and are specified + using their type, and their BCS contents, Base64 encoded. + + The `name` argument is a json serialized type. + + This returns [`DynamicFieldOutput`] which contains the name, the value + as json, and object. + + # Example + ```rust,ignore + + let client = iota_graphql_client::Client::new_devnet(); + let address = Address::from_str("0x5").unwrap(); + let df = client.dynamic_field_with_name(address, "u64", 2u64).await.unwrap(); + + # alternatively, pass in the bcs bytes + let bcs = base64ct::Base64::decode_vec("AgAAAAAAAAA=").unwrap(); + let df = client.dynamic_field(address, "u64", BcsName(bcs)).await.unwrap(); + ``` + """ + + _UniffiConverterTypeAddress.check_lower(address) + + _UniffiConverterTypeTypeTag.check_lower(type) + + _UniffiConverterTypeValue.check_lower(name) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_dynamic_field( + self._uniffi_clone_pointer(), + _UniffiConverterTypeAddress.lower(address), + _UniffiConverterTypeTypeTag.lower(type), + _UniffiConverterTypeValue.lower(name) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalTypeDynamicFieldOutput.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def dynamic_fields(self, address: "Address",pagination_filter: "PaginationFilter") -> "DynamicFieldOutputPage": + """ + Get a page of dynamic fields for the provided address. Note that this + will also fetch dynamic fields on wrapped objects. + + This returns [`Page`] of [`DynamicFieldOutput`]s. + """ + + _UniffiConverterTypeAddress.check_lower(address) + + _UniffiConverterTypePaginationFilter.check_lower(pagination_filter) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_dynamic_fields( + self._uniffi_clone_pointer(), + _UniffiConverterTypeAddress.lower(address), + _UniffiConverterTypePaginationFilter.lower(pagination_filter) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_pointer, + # lift function + _UniffiConverterTypeDynamicFieldOutputPage.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def dynamic_object_field(self, address: "Address",type: "TypeTag",name: "Value") -> "typing.Optional[DynamicFieldOutput]": + """ + Access a dynamic object field on an object using its name. Names are + arbitrary Move values whose type have copy, drop, and store, and are + specified using their type, and their BCS contents, Base64 encoded. + + The `name` argument is a json serialized type. + + This returns [`DynamicFieldOutput`] which contains the name, the value + as json, and object. + """ + + _UniffiConverterTypeAddress.check_lower(address) + + _UniffiConverterTypeTypeTag.check_lower(type) + + _UniffiConverterTypeValue.check_lower(name) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_dynamic_object_field( + self._uniffi_clone_pointer(), + _UniffiConverterTypeAddress.lower(address), + _UniffiConverterTypeTypeTag.lower(type), + _UniffiConverterTypeValue.lower(name) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalTypeDynamicFieldOutput.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def epoch(self, epoch: "typing.Union[object, typing.Optional[int]]" = _DEFAULT) -> "typing.Optional[Epoch]": + """ + Return the epoch information for the provided epoch. If no epoch is + provided, it will return the last known epoch. + """ + + if epoch is _DEFAULT: + epoch = None + _UniffiConverterOptionalUInt64.check_lower(epoch) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_epoch( + self._uniffi_clone_pointer(), + _UniffiConverterOptionalUInt64.lower(epoch) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalTypeEpoch.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def epoch_total_checkpoints(self, epoch: "typing.Union[object, typing.Optional[int]]" = _DEFAULT) -> "typing.Optional[int]": + """ + Return the number of checkpoints in this epoch. This will return + `Ok(None)` if the epoch requested is not available in the GraphQL + service (e.g., due to pruning). + """ + + if epoch is _DEFAULT: + epoch = None + _UniffiConverterOptionalUInt64.check_lower(epoch) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_epoch_total_checkpoints( + self._uniffi_clone_pointer(), + _UniffiConverterOptionalUInt64.lower(epoch) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalUInt64.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def epoch_total_transaction_blocks(self, epoch: "typing.Union[object, typing.Optional[int]]" = _DEFAULT) -> "typing.Optional[int]": + """ + Return the number of transaction blocks in this epoch. This will return + `Ok(None)` if the epoch requested is not available in the GraphQL + service (e.g., due to pruning). + """ + + if epoch is _DEFAULT: + epoch = None + _UniffiConverterOptionalUInt64.check_lower(epoch) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_epoch_total_transaction_blocks( + self._uniffi_clone_pointer(), + _UniffiConverterOptionalUInt64.lower(epoch) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalUInt64.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def epochs(self, pagination_filter: "PaginationFilter") -> "EpochPage": + """ + Return a page of epochs. + """ + + _UniffiConverterTypePaginationFilter.check_lower(pagination_filter) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_epochs( + self._uniffi_clone_pointer(), + _UniffiConverterTypePaginationFilter.lower(pagination_filter) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_pointer, + # lift function + _UniffiConverterTypeEpochPage.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def events(self, pagination_filter: "PaginationFilter",filter: "typing.Union[object, typing.Optional[EventFilter]]" = _DEFAULT) -> "TransactionEventPage": + """ + Return a page of tuple (event, transaction digest) based on the + (optional) event filter. + """ + + _UniffiConverterTypePaginationFilter.check_lower(pagination_filter) + + if filter is _DEFAULT: + filter = None + _UniffiConverterOptionalTypeEventFilter.check_lower(filter) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_events( + self._uniffi_clone_pointer(), + _UniffiConverterTypePaginationFilter.lower(pagination_filter), + _UniffiConverterOptionalTypeEventFilter.lower(filter) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_pointer, + # lift function + _UniffiConverterTypeTransactionEventPage.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def execute_tx(self, signatures: "typing.List[UserSignature]",tx: "Transaction") -> "typing.Optional[TransactionEffects]": + """ + Execute a transaction. + """ + + _UniffiConverterSequenceTypeUserSignature.check_lower(signatures) + + _UniffiConverterTypeTransaction.check_lower(tx) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_execute_tx( + self._uniffi_clone_pointer(), + _UniffiConverterSequenceTypeUserSignature.lower(signatures), + _UniffiConverterTypeTransaction.lower(tx) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalTypeTransactionEffects.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def latest_checkpoint_sequence_number(self, ) -> "typing.Optional[int]": + """ + Return the sequence number of the latest checkpoint that has been + executed. + """ + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_latest_checkpoint_sequence_number( + self._uniffi_clone_pointer(), + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalUInt64.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def max_page_size(self, ) -> "int": + """ + Lazily fetch the max page size + """ + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_max_page_size( + self._uniffi_clone_pointer(), + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_i32, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_i32, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_i32, + # lift function + _UniffiConverterInt32.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def move_object_contents(self, object_id: "ObjectId",version: "typing.Union[object, typing.Optional[int]]" = _DEFAULT) -> "typing.Optional[Value]": + """ + Return the contents' JSON of an object that is a Move object. + + If the object does not exist (e.g., due to pruning), this will return + `Ok(None)`. Similarly, if this is not an object but an address, it + will return `Ok(None)`. + """ + + _UniffiConverterTypeObjectId.check_lower(object_id) + + if version is _DEFAULT: + version = None + _UniffiConverterOptionalUInt64.check_lower(version) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_move_object_contents( + self._uniffi_clone_pointer(), + _UniffiConverterTypeObjectId.lower(object_id), + _UniffiConverterOptionalUInt64.lower(version) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalTypeValue.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def move_object_contents_bcs(self, object_id: "ObjectId",version: "typing.Union[object, typing.Optional[int]]" = _DEFAULT) -> "typing.Optional[bytes]": + """ + Return the BCS of an object that is a Move object. + + If the object does not exist (e.g., due to pruning), this will return + `Ok(None)`. Similarly, if this is not an object but an address, it + will return `Ok(None)`. + """ + + _UniffiConverterTypeObjectId.check_lower(object_id) + + if version is _DEFAULT: + version = None + _UniffiConverterOptionalUInt64.check_lower(version) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_move_object_contents_bcs( + self._uniffi_clone_pointer(), + _UniffiConverterTypeObjectId.lower(object_id), + _UniffiConverterOptionalUInt64.lower(version) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalBytes.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def normalized_move_function(self, package: "str",module: "str",function: "str",version: "typing.Union[object, typing.Optional[int]]" = _DEFAULT) -> "typing.Optional[MoveFunction]": + """ + Return the normalized Move function data for the provided package, + module, and function. + """ + + _UniffiConverterString.check_lower(package) + + _UniffiConverterString.check_lower(module) + + _UniffiConverterString.check_lower(function) + + if version is _DEFAULT: + version = None + _UniffiConverterOptionalUInt64.check_lower(version) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_normalized_move_function( + self._uniffi_clone_pointer(), + _UniffiConverterString.lower(package), + _UniffiConverterString.lower(module), + _UniffiConverterString.lower(function), + _UniffiConverterOptionalUInt64.lower(version) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalTypeMoveFunction.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def normalized_move_module(self, package: "str",module: "str",pagination_filter_enums: "PaginationFilter",pagination_filter_friends: "PaginationFilter",pagination_filter_functions: "PaginationFilter",pagination_filter_structs: "PaginationFilter",version: "typing.Union[object, typing.Optional[int]]" = _DEFAULT) -> "typing.Optional[MoveModule]": + """ + Return the normalized Move module data for the provided module. + """ + + _UniffiConverterString.check_lower(package) + + _UniffiConverterString.check_lower(module) + + _UniffiConverterTypePaginationFilter.check_lower(pagination_filter_enums) + + _UniffiConverterTypePaginationFilter.check_lower(pagination_filter_friends) + + _UniffiConverterTypePaginationFilter.check_lower(pagination_filter_functions) + + _UniffiConverterTypePaginationFilter.check_lower(pagination_filter_structs) + + if version is _DEFAULT: + version = None + _UniffiConverterOptionalUInt64.check_lower(version) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_normalized_move_module( + self._uniffi_clone_pointer(), + _UniffiConverterString.lower(package), + _UniffiConverterString.lower(module), + _UniffiConverterTypePaginationFilter.lower(pagination_filter_enums), + _UniffiConverterTypePaginationFilter.lower(pagination_filter_friends), + _UniffiConverterTypePaginationFilter.lower(pagination_filter_functions), + _UniffiConverterTypePaginationFilter.lower(pagination_filter_structs), + _UniffiConverterOptionalUInt64.lower(version) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalTypeMoveModule.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def object(self, object_id: "ObjectId",version: "typing.Union[object, typing.Optional[int]]" = _DEFAULT) -> "typing.Optional[Object]": + """ + Return an object based on the provided [`Address`]. + + If the object does not exist (e.g., due to pruning), this will return + `Ok(None)`. Similarly, if this is not an object but an address, it + will return `Ok(None)`. + """ + + _UniffiConverterTypeObjectId.check_lower(object_id) + + if version is _DEFAULT: + version = None + _UniffiConverterOptionalUInt64.check_lower(version) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_object( + self._uniffi_clone_pointer(), + _UniffiConverterTypeObjectId.lower(object_id), + _UniffiConverterOptionalUInt64.lower(version) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalTypeObject.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def object_bcs(self, object_id: "ObjectId") -> "typing.Optional[bytes]": + """ + Return the object's bcs content [`Vec`] based on the provided + [`Address`]. + """ + + _UniffiConverterTypeObjectId.check_lower(object_id) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_object_bcs( + self._uniffi_clone_pointer(), + _UniffiConverterTypeObjectId.lower(object_id) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalBytes.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def objects(self, pagination_filter: "PaginationFilter",filter: "typing.Union[object, typing.Optional[ObjectFilter]]" = _DEFAULT) -> "ObjectPage": + """ + Return a page of objects based on the provided parameters. + + Use this function together with the [`ObjectFilter::owner`] to get the + objects owned by an address. + + # Example + + ```rust,ignore + let filter = ObjectFilter { + type_: None, + owner: Some(Address::from_str("test").unwrap().into()), + object_ids: None, + }; + + let owned_objects = client.objects(None, None, Some(filter), None, None).await; + ``` + """ + + _UniffiConverterTypePaginationFilter.check_lower(pagination_filter) + + if filter is _DEFAULT: + filter = None + _UniffiConverterOptionalTypeObjectFilter.check_lower(filter) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_objects( + self._uniffi_clone_pointer(), + _UniffiConverterTypePaginationFilter.lower(pagination_filter), + _UniffiConverterOptionalTypeObjectFilter.lower(filter) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_pointer, + # lift function + _UniffiConverterTypeObjectPage.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def package(self, address: "Address",version: "typing.Union[object, typing.Optional[int]]" = _DEFAULT) -> "typing.Optional[MovePackage]": + """ + The package corresponding to the given address (at the optionally given + version). When no version is given, the package is loaded directly + from the address given. Otherwise, the address is translated before + loading to point to the package whose original ID matches + the package at address, but whose version is version. For non-system + packages, this might result in a different address than address + because different versions of a package, introduced by upgrades, + exist at distinct addresses. + + Note that this interpretation of version is different from a historical + object read (the interpretation of version for the object query). + """ + + _UniffiConverterTypeAddress.check_lower(address) + + if version is _DEFAULT: + version = None + _UniffiConverterOptionalUInt64.check_lower(version) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_package( + self._uniffi_clone_pointer(), + _UniffiConverterTypeAddress.lower(address), + _UniffiConverterOptionalUInt64.lower(version) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalTypeMovePackage.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def package_by_name(self, name: "str") -> "typing.Optional[MovePackage]": + """ + Fetch a package by its name (using Move Registry Service) + """ + + _UniffiConverterString.check_lower(name) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_package_by_name( + self._uniffi_clone_pointer(), + _UniffiConverterString.lower(name) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalTypeMovePackage.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def package_latest(self, address: "Address") -> "typing.Optional[MovePackage]": + """ + Fetch the latest version of the package at address. + This corresponds to the package with the highest version that shares its + original ID with the package at address. + """ + + _UniffiConverterTypeAddress.check_lower(address) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_package_latest( + self._uniffi_clone_pointer(), + _UniffiConverterTypeAddress.lower(address) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalTypeMovePackage.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def package_versions(self, address: "Address",pagination_filter: "PaginationFilter",after_version: "typing.Union[object, typing.Optional[int]]" = _DEFAULT,before_version: "typing.Union[object, typing.Optional[int]]" = _DEFAULT) -> "MovePackagePage": + """ + Fetch all versions of package at address (packages that share this + package's original ID), optionally bounding the versions exclusively + from below with afterVersion, or from above with beforeVersion. + """ + + _UniffiConverterTypeAddress.check_lower(address) + + _UniffiConverterTypePaginationFilter.check_lower(pagination_filter) + + if after_version is _DEFAULT: + after_version = None + _UniffiConverterOptionalUInt64.check_lower(after_version) + + if before_version is _DEFAULT: + before_version = None + _UniffiConverterOptionalUInt64.check_lower(before_version) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_package_versions( + self._uniffi_clone_pointer(), + _UniffiConverterTypeAddress.lower(address), + _UniffiConverterTypePaginationFilter.lower(pagination_filter), + _UniffiConverterOptionalUInt64.lower(after_version), + _UniffiConverterOptionalUInt64.lower(before_version) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_pointer, + # lift function + _UniffiConverterTypeMovePackagePage.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def packages(self, pagination_filter: "PaginationFilter",after_checkpoint: "typing.Union[object, typing.Optional[int]]" = _DEFAULT,before_checkpoint: "typing.Union[object, typing.Optional[int]]" = _DEFAULT) -> "MovePackagePage": + """ + The Move packages that exist in the network, optionally filtered to be + strictly before beforeCheckpoint and/or strictly after + afterCheckpoint. + + This query returns all versions of a given user package that appear + between the specified checkpoints, but only records the latest + versions of system packages. + """ + + _UniffiConverterTypePaginationFilter.check_lower(pagination_filter) + + if after_checkpoint is _DEFAULT: + after_checkpoint = None + _UniffiConverterOptionalUInt64.check_lower(after_checkpoint) + + if before_checkpoint is _DEFAULT: + before_checkpoint = None + _UniffiConverterOptionalUInt64.check_lower(before_checkpoint) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_packages( + self._uniffi_clone_pointer(), + _UniffiConverterTypePaginationFilter.lower(pagination_filter), + _UniffiConverterOptionalUInt64.lower(after_checkpoint), + _UniffiConverterOptionalUInt64.lower(before_checkpoint) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_pointer, + # lift function + _UniffiConverterTypeMovePackagePage.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def protocol_config(self, version: "typing.Union[object, typing.Optional[int]]" = _DEFAULT) -> "typing.Optional[ProtocolConfigs]": + """ + Get the protocol configuration. + """ + + if version is _DEFAULT: + version = None + _UniffiConverterOptionalUInt64.check_lower(version) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_protocol_config( + self._uniffi_clone_pointer(), + _UniffiConverterOptionalUInt64.lower(version) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalTypeProtocolConfigs.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def reference_gas_price(self, epoch: "typing.Union[object, typing.Optional[int]]" = _DEFAULT) -> "typing.Optional[int]": + """ + Get the reference gas price for the provided epoch or the last known one + if no epoch is provided. + + This will return `Ok(None)` if the epoch requested is not available in + the GraphQL service (e.g., due to pruning). + """ + + if epoch is _DEFAULT: + epoch = None + _UniffiConverterOptionalUInt64.check_lower(epoch) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_reference_gas_price( + self._uniffi_clone_pointer(), + _UniffiConverterOptionalUInt64.lower(epoch) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalUInt64.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def service_config(self, ) -> "ServiceConfig": + """ + Get the GraphQL service configuration, including complexity limits, read + and mutation limits, supported versions, and others. + """ + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_service_config( + self._uniffi_clone_pointer(), + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_pointer, + # lift function + _UniffiConverterTypeServiceConfig.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def set_rpc_server(self, server: "str") -> None: + + """ + Set the server address for the GraphQL GraphQL client. It should be a + valid URL with a host and optionally a port number. + """ + + _UniffiConverterString.check_lower(server) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_set_rpc_server( + self._uniffi_clone_pointer(), + _UniffiConverterString.lower(server) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_void, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_void, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_void, + # lift function + lambda val: None, + + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def total_supply(self, coin_type: "str") -> "typing.Optional[int]": + """ + Get total supply for the coin type. + """ + + _UniffiConverterString.check_lower(coin_type) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_total_supply( + self._uniffi_clone_pointer(), + _UniffiConverterString.lower(coin_type) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalUInt64.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def total_transaction_blocks(self, ) -> "typing.Optional[int]": + """ + The total number of transaction blocks in the network by the end of the + last known checkpoint. + """ + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_total_transaction_blocks( + self._uniffi_clone_pointer(), + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalUInt64.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def total_transaction_blocks_by_digest(self, digest: "CheckpointDigest") -> "typing.Optional[int]": + """ + The total number of transaction blocks in the network by the end of the + provided checkpoint digest. + """ + + _UniffiConverterTypeCheckpointDigest.check_lower(digest) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_total_transaction_blocks_by_digest( + self._uniffi_clone_pointer(), + _UniffiConverterTypeCheckpointDigest.lower(digest) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalUInt64.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def total_transaction_blocks_by_seq_num(self, seq_num: "int") -> "typing.Optional[int]": + """ + The total number of transaction blocks in the network by the end of the + provided checkpoint sequence number. + """ + + _UniffiConverterUInt64.check_lower(seq_num) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_total_transaction_blocks_by_seq_num( + self._uniffi_clone_pointer(), + _UniffiConverterUInt64.lower(seq_num) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalUInt64.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def transaction(self, digest: "TransactionDigest") -> "typing.Optional[SignedTransaction]": + """ + Get a transaction by its digest. + """ + + _UniffiConverterTypeTransactionDigest.check_lower(digest) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_transaction( + self._uniffi_clone_pointer(), + _UniffiConverterTypeTransactionDigest.lower(digest) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalTypeSignedTransaction.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def transaction_data_effects(self, digest: "TransactionDigest") -> "typing.Optional[TransactionDataEffects]": + """ + Get a transaction's data and effects by its digest. + """ + + _UniffiConverterTypeTransactionDigest.check_lower(digest) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_transaction_data_effects( + self._uniffi_clone_pointer(), + _UniffiConverterTypeTransactionDigest.lower(digest) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalTypeTransactionDataEffects.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def transaction_effects(self, digest: "TransactionDigest") -> "typing.Optional[TransactionEffects]": + """ + Get a transaction's effects by its digest. + """ + + _UniffiConverterTypeTransactionDigest.check_lower(digest) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_transaction_effects( + self._uniffi_clone_pointer(), + _UniffiConverterTypeTransactionDigest.lower(digest) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_rust_buffer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_rust_buffer, + # lift function + _UniffiConverterOptionalTypeTransactionEffects.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def transactions(self, pagination_filter: "PaginationFilter",filter: "typing.Union[object, typing.Optional[TransactionsFilter]]" = _DEFAULT) -> "SignedTransactionPage": + """ + Get a page of transactions based on the provided filters. + """ + + _UniffiConverterTypePaginationFilter.check_lower(pagination_filter) + + if filter is _DEFAULT: + filter = None + _UniffiConverterOptionalTypeTransactionsFilter.check_lower(filter) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_transactions( + self._uniffi_clone_pointer(), + _UniffiConverterTypePaginationFilter.lower(pagination_filter), + _UniffiConverterOptionalTypeTransactionsFilter.lower(filter) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_pointer, + # lift function + _UniffiConverterTypeSignedTransactionPage.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def transactions_data_effects(self, pagination_filter: "PaginationFilter",filter: "typing.Union[object, typing.Optional[TransactionsFilter]]" = _DEFAULT) -> "TransactionDataEffectsPage": + """ + Get a page of transactions' data and effects based on the provided + filters. + """ + + _UniffiConverterTypePaginationFilter.check_lower(pagination_filter) + + if filter is _DEFAULT: + filter = None + _UniffiConverterOptionalTypeTransactionsFilter.check_lower(filter) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_transactions_data_effects( + self._uniffi_clone_pointer(), + _UniffiConverterTypePaginationFilter.lower(pagination_filter), + _UniffiConverterOptionalTypeTransactionsFilter.lower(filter) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_pointer, + # lift function + _UniffiConverterTypeTransactionDataEffectsPage.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + async def transactions_effects(self, pagination_filter: "PaginationFilter",filter: "typing.Union[object, typing.Optional[TransactionsFilter]]" = _DEFAULT) -> "TransactionEffectsPage": + """ + Get a page of transactions' effects based on the provided filters. + """ + + _UniffiConverterTypePaginationFilter.check_lower(pagination_filter) + + if filter is _DEFAULT: + filter = None + _UniffiConverterOptionalTypeTransactionsFilter.check_lower(filter) + + return await _uniffi_rust_call_async( + _UniffiLib.uniffi_iota_sdk_ffi_fn_method_graphqlclient_transactions_effects( + self._uniffi_clone_pointer(), + _UniffiConverterTypePaginationFilter.lower(pagination_filter), + _UniffiConverterOptionalTypeTransactionsFilter.lower(filter) + ), + _UniffiLib.ffi_iota_sdk_ffi_rust_future_poll_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_complete_pointer, + _UniffiLib.ffi_iota_sdk_ffi_rust_future_free_pointer, + # lift function + _UniffiConverterTypeTransactionEffectsPage.lift, + + # Error FFI converter +_UniffiConverterTypeBindingsSdkError, + + ) + + + + + +class _UniffiConverterTypeGraphQlClient: + + @staticmethod + def lift(value: int): + return GraphQlClient._make_instance_(value) + + @staticmethod + def check_lower(value: GraphQlClient): + if not isinstance(value, GraphQlClient): + raise TypeError("Expected GraphQlClient instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: GraphQlClientProtocol): + if not isinstance(value, GraphQlClient): + raise TypeError("Expected GraphQlClient instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: GraphQlClientProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class MoveFunctionProtocol(typing.Protocol): + pass +# MoveFunction is a Rust-only trait - it's a wrapper around a Rust implementation. +class MoveFunction(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_movefunction, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_movefunction, self._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 _UniffiConverterTypeMoveFunction: + + @staticmethod + def lift(value: int): + return MoveFunction._make_instance_(value) + + @staticmethod + def check_lower(value: MoveFunction): + if not isinstance(value, MoveFunction): + raise TypeError("Expected MoveFunction instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: MoveFunctionProtocol): + if not isinstance(value, MoveFunction): + raise TypeError("Expected MoveFunction instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: MoveFunctionProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class MoveModuleProtocol(typing.Protocol): + pass +# MoveModule is a Rust-only trait - it's a wrapper around a Rust implementation. +class MoveModule(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_movemodule, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_movemodule, self._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 _UniffiConverterTypeMoveModule: + + @staticmethod + def lift(value: int): + return MoveModule._make_instance_(value) + + @staticmethod + def check_lower(value: MoveModule): + if not isinstance(value, MoveModule): + raise TypeError("Expected MoveModule instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: MoveModuleProtocol): + if not isinstance(value, MoveModule): + raise TypeError("Expected MoveModule instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: MoveModuleProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class MovePackageProtocol(typing.Protocol): + pass +# MovePackage is a Rust-only trait - it's a wrapper around a Rust implementation. +class MovePackage(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_movepackage, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_movepackage, self._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 _UniffiConverterTypeMovePackage: + + @staticmethod + def lift(value: int): + return MovePackage._make_instance_(value) + + @staticmethod + def check_lower(value: MovePackage): + if not isinstance(value, MovePackage): + raise TypeError("Expected MovePackage instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: MovePackageProtocol): + if not isinstance(value, MovePackage): + raise TypeError("Expected MovePackage instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: MovePackageProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class MovePackagePageProtocol(typing.Protocol): + def data(self, ): + raise NotImplementedError + def is_empty(self, ): + raise NotImplementedError + def page_info(self, ): + raise NotImplementedError +# MovePackagePage is a Rust-only trait - it's a wrapper around a Rust implementation. +class MovePackagePage(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_movepackagepage, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_movepackagepage, self._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 data(self, ) -> "typing.List[MovePackage]": + return _UniffiConverterSequenceTypeMovePackage.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_movepackagepage_data,self._uniffi_clone_pointer(),) + ) + + + + + + def is_empty(self, ) -> "bool": + return _UniffiConverterBool.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_movepackagepage_is_empty,self._uniffi_clone_pointer(),) + ) + + + + + + def page_info(self, ) -> "PageInfo": + return _UniffiConverterTypePageInfo.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_movepackagepage_page_info,self._uniffi_clone_pointer(),) + ) + + + + + + +class _UniffiConverterTypeMovePackagePage: + + @staticmethod + def lift(value: int): + return MovePackagePage._make_instance_(value) + + @staticmethod + def check_lower(value: MovePackagePage): + if not isinstance(value, MovePackagePage): + raise TypeError("Expected MovePackagePage instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: MovePackagePageProtocol): + if not isinstance(value, MovePackagePage): + raise TypeError("Expected MovePackagePage instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: MovePackagePageProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class MoveStructProtocol(typing.Protocol): + pass +# MoveStruct is a Rust-only trait - it's a wrapper around a Rust implementation. +class MoveStruct(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_movestruct, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_movestruct, self._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 _UniffiConverterTypeMoveStruct: + + @staticmethod + def lift(value: int): + return MoveStruct._make_instance_(value) + + @staticmethod + def check_lower(value: MoveStruct): + if not isinstance(value, MoveStruct): + raise TypeError("Expected MoveStruct instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: MoveStructProtocol): + if not isinstance(value, MoveStruct): + raise TypeError("Expected MoveStruct instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: MoveStructProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class ObjectProtocol(typing.Protocol): + """ + An object on the IOTA blockchain + + # BCS + + The BCS serialized form for this type is defined by the following ABNF: + + ```text + object = object-data owner digest u64 + ``` + """ + + def as_struct(self, ): + """ + Try to interpret this object as a move struct + """ + + raise NotImplementedError + def data(self, ): + """ + Return this object's data + """ + + raise NotImplementedError + def object_id(self, ): + """ + Return this object's id + """ + + raise NotImplementedError + def object_type(self, ): + """ + Return this object's type + """ + + raise NotImplementedError + def owner(self, ): + """ + Return this object's owner + """ + + raise NotImplementedError + def previous_transaction(self, ): + """ + Return the digest of the transaction that last modified this object + """ + + raise NotImplementedError + def storage_rebate(self, ): + """ + Return the storage rebate locked in this object + + Storage rebates are credited to the gas coin used in a transaction that + deletes this object. + """ + + raise NotImplementedError + def version(self, ): + """ + Return this object's version + """ + + raise NotImplementedError +# Object is a Rust-only trait - it's a wrapper around a Rust implementation. +class Object(): + """ + An object on the IOTA blockchain + + # BCS + + The BCS serialized form for this type is defined by the following ABNF: + + ```text + object = object-data owner digest u64 + ``` + """ + + _pointer: ctypes.c_void_p + def __init__(self, data: "ObjectData",owner: "Owner",previous_transaction: "TransactionDigest",storage_rebate: "int"): + _UniffiConverterTypeObjectData.check_lower(data) + + _UniffiConverterTypeOwner.check_lower(owner) + + _UniffiConverterTypeTransactionDigest.check_lower(previous_transaction) + + _UniffiConverterUInt64.check_lower(storage_rebate) + + self._pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_object_new, + _UniffiConverterTypeObjectData.lower(data), + _UniffiConverterTypeOwner.lower(owner), + _UniffiConverterTypeTransactionDigest.lower(previous_transaction), + _UniffiConverterUInt64.lower(storage_rebate)) + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_object, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_object, self._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 as_struct(self, ) -> "typing.Optional[MoveStruct]": + """ + Try to interpret this object as a move struct + """ + + return _UniffiConverterOptionalTypeMoveStruct.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_object_as_struct,self._uniffi_clone_pointer(),) + ) + + + + + + def data(self, ) -> "ObjectData": + """ + Return this object's data + """ + + return _UniffiConverterTypeObjectData.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_object_data,self._uniffi_clone_pointer(),) + ) + + + + + + def object_id(self, ) -> "ObjectId": + """ + Return this object's id + """ + + return _UniffiConverterTypeObjectId.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_object_object_id,self._uniffi_clone_pointer(),) + ) + + + + + + def object_type(self, ) -> "ObjectType": + """ + Return this object's type + """ + + return _UniffiConverterTypeObjectType.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_object_object_type,self._uniffi_clone_pointer(),) + ) + + + + + + def owner(self, ) -> "Owner": + """ + Return this object's owner + """ + + return _UniffiConverterTypeOwner.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_object_owner,self._uniffi_clone_pointer(),) + ) + + + + + + def previous_transaction(self, ) -> "TransactionDigest": + """ + Return the digest of the transaction that last modified this object + """ + + return _UniffiConverterTypeTransactionDigest.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_object_previous_transaction,self._uniffi_clone_pointer(),) + ) + + + + + + def storage_rebate(self, ) -> "int": + """ + Return the storage rebate locked in this object + + Storage rebates are credited to the gas coin used in a transaction that + deletes this object. + """ + + return _UniffiConverterUInt64.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_object_storage_rebate,self._uniffi_clone_pointer(),) + ) + + + + + + def version(self, ) -> "int": + """ + Return this object's version + """ + + return _UniffiConverterUInt64.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_object_version,self._uniffi_clone_pointer(),) + ) + + + + + + +class _UniffiConverterTypeObject: + + @staticmethod + def lift(value: int): + return Object._make_instance_(value) + + @staticmethod + def check_lower(value: Object): + if not isinstance(value, Object): + raise TypeError("Expected Object instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: ObjectProtocol): + if not isinstance(value, Object): + raise TypeError("Expected Object instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: ObjectProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class ObjectDataProtocol(typing.Protocol): + pass +# ObjectData is a Rust-only trait - it's a wrapper around a Rust implementation. +class ObjectData(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_objectdata, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_objectdata, self._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 _UniffiConverterTypeObjectData: + + @staticmethod + def lift(value: int): + return ObjectData._make_instance_(value) + + @staticmethod + def check_lower(value: ObjectData): + if not isinstance(value, ObjectData): + raise TypeError("Expected ObjectData instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: ObjectDataProtocol): + if not isinstance(value, ObjectData): + raise TypeError("Expected ObjectData instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: ObjectDataProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class ObjectDigestProtocol(typing.Protocol): + pass +# ObjectDigest is a Rust-only trait - it's a wrapper around a Rust implementation. +class ObjectDigest(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_objectdigest, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_objectdigest, self._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 _UniffiConverterTypeObjectDigest: + + @staticmethod + def lift(value: int): + return ObjectDigest._make_instance_(value) + + @staticmethod + def check_lower(value: ObjectDigest): + if not isinstance(value, ObjectDigest): + raise TypeError("Expected ObjectDigest instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: ObjectDigestProtocol): + if not isinstance(value, ObjectDigest): + raise TypeError("Expected ObjectDigest instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: ObjectDigestProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class ObjectFilterProtocol(typing.Protocol): + pass +# ObjectFilter is a Rust-only trait - it's a wrapper around a Rust implementation. +class ObjectFilter(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_objectfilter, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_objectfilter, self._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 _UniffiConverterTypeObjectFilter: + + @staticmethod + def lift(value: int): + return ObjectFilter._make_instance_(value) + + @staticmethod + def check_lower(value: ObjectFilter): + if not isinstance(value, ObjectFilter): + raise TypeError("Expected ObjectFilter instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: ObjectFilterProtocol): + if not isinstance(value, ObjectFilter): + raise TypeError("Expected ObjectFilter instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: ObjectFilterProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class ObjectIdProtocol(typing.Protocol): + """ + An `ObjectId` is a 32-byte identifier used to uniquely identify an object on + the IOTA blockchain. + + ## Relationship to Address + + [`Address`]es and [`ObjectId`]s share the same 32-byte addressable space but + are derived leveraging different domain-separator values to ensure, + cryptographically, that there won't be any overlap, e.g. there can't be a + valid `Object` whose `ObjectId` is equal to that of the `Address` of a user + account. + + # BCS + + An `ObjectId`'s BCS serialized form is defined by the following: + + ```text + object-id = 32*OCTET + ``` + """ + + def to_address(self, ): + raise NotImplementedError + def to_bytes(self, ): + raise NotImplementedError + def to_hex(self, ): + raise NotImplementedError +# ObjectId is a Rust-only trait - it's a wrapper around a Rust implementation. +class ObjectId(): + """ + An `ObjectId` is a 32-byte identifier used to uniquely identify an object on + the IOTA blockchain. + + ## Relationship to Address + + [`Address`]es and [`ObjectId`]s share the same 32-byte addressable space but + are derived leveraging different domain-separator values to ensure, + cryptographically, that there won't be any overlap, e.g. there can't be a + valid `Object` whose `ObjectId` is equal to that of the `Address` of a user + account. + + # BCS + + An `ObjectId`'s BCS serialized form is defined by the following: + + ```text + object-id = 32*OCTET + ``` + """ + + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_objectid, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_objectid, self._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 from_bytes(cls, bytes: "bytes"): + _UniffiConverterBytes.check_lower(bytes) + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call_with_error(_UniffiConverterTypeBindingsSdkError,_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_objectid_from_bytes, + _UniffiConverterBytes.lower(bytes)) + return cls._make_instance_(pointer) + + @classmethod + def from_hex(cls, hex: "str"): + _UniffiConverterString.check_lower(hex) + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call_with_error(_UniffiConverterTypeBindingsSdkError,_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_objectid_from_hex, + _UniffiConverterString.lower(hex)) + return cls._make_instance_(pointer) + + + + def to_address(self, ) -> "Address": + return _UniffiConverterTypeAddress.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_objectid_to_address,self._uniffi_clone_pointer(),) + ) + + + + + + def to_bytes(self, ) -> "bytes": + return _UniffiConverterBytes.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_objectid_to_bytes,self._uniffi_clone_pointer(),) + ) + + + + + + def to_hex(self, ) -> "str": + return _UniffiConverterString.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_objectid_to_hex,self._uniffi_clone_pointer(),) + ) + + + + + + +class _UniffiConverterTypeObjectId: + + @staticmethod + def lift(value: int): + return ObjectId._make_instance_(value) + + @staticmethod + def check_lower(value: ObjectId): + if not isinstance(value, ObjectId): + raise TypeError("Expected ObjectId instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: ObjectIdProtocol): + if not isinstance(value, ObjectId): + raise TypeError("Expected ObjectId instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: ObjectIdProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class ObjectPageProtocol(typing.Protocol): + def data(self, ): + raise NotImplementedError + def is_empty(self, ): + raise NotImplementedError + def page_info(self, ): + raise NotImplementedError +# ObjectPage is a Rust-only trait - it's a wrapper around a Rust implementation. +class ObjectPage(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_objectpage, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_objectpage, self._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 data(self, ) -> "typing.List[Object]": + return _UniffiConverterSequenceTypeObject.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_objectpage_data,self._uniffi_clone_pointer(),) + ) + + + + + + def is_empty(self, ) -> "bool": + return _UniffiConverterBool.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_objectpage_is_empty,self._uniffi_clone_pointer(),) + ) + + + + + + def page_info(self, ) -> "PageInfo": + return _UniffiConverterTypePageInfo.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_objectpage_page_info,self._uniffi_clone_pointer(),) + ) + + + + + + +class _UniffiConverterTypeObjectPage: + + @staticmethod + def lift(value: int): + return ObjectPage._make_instance_(value) + + @staticmethod + def check_lower(value: ObjectPage): + if not isinstance(value, ObjectPage): + raise TypeError("Expected ObjectPage instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: ObjectPageProtocol): + if not isinstance(value, ObjectPage): + raise TypeError("Expected ObjectPage instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: ObjectPageProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class ObjectRefProtocol(typing.Protocol): + pass +# ObjectRef is a Rust-only trait - it's a wrapper around a Rust implementation. +class ObjectRef(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_objectref, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_objectref, self._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 _UniffiConverterTypeObjectRef: + + @staticmethod + def lift(value: int): + return ObjectRef._make_instance_(value) + + @staticmethod + def check_lower(value: ObjectRef): + if not isinstance(value, ObjectRef): + raise TypeError("Expected ObjectRef instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: ObjectRefProtocol): + if not isinstance(value, ObjectRef): + raise TypeError("Expected ObjectRef instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: ObjectRefProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class ObjectTypeProtocol(typing.Protocol): + pass +# ObjectType is a Rust-only trait - it's a wrapper around a Rust implementation. +class ObjectType(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_objecttype, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_objecttype, self._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 _UniffiConverterTypeObjectType: + + @staticmethod + def lift(value: int): + return ObjectType._make_instance_(value) + + @staticmethod + def check_lower(value: ObjectType): + if not isinstance(value, ObjectType): + raise TypeError("Expected ObjectType instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: ObjectTypeProtocol): + if not isinstance(value, ObjectType): + raise TypeError("Expected ObjectType instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: ObjectTypeProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class OwnerProtocol(typing.Protocol): + pass +# Owner is a Rust-only trait - it's a wrapper around a Rust implementation. +class Owner(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_owner, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_owner, self._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 _UniffiConverterTypeOwner: + + @staticmethod + def lift(value: int): + return Owner._make_instance_(value) + + @staticmethod + def check_lower(value: Owner): + if not isinstance(value, Owner): + raise TypeError("Expected Owner instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: OwnerProtocol): + if not isinstance(value, Owner): + raise TypeError("Expected Owner instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: OwnerProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class PageInfoProtocol(typing.Protocol): + pass +# PageInfo is a Rust-only trait - it's a wrapper around a Rust implementation. +class PageInfo(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_pageinfo, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_pageinfo, self._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 _UniffiConverterTypePageInfo: + + @staticmethod + def lift(value: int): + return PageInfo._make_instance_(value) + + @staticmethod + def check_lower(value: PageInfo): + if not isinstance(value, PageInfo): + raise TypeError("Expected PageInfo instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: PageInfoProtocol): + if not isinstance(value, PageInfo): + raise TypeError("Expected PageInfo instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: PageInfoProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class ProgrammableTransactionProtocol(typing.Protocol): + pass +# ProgrammableTransaction is a Rust-only trait - it's a wrapper around a Rust implementation. +class ProgrammableTransaction(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_programmabletransaction, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_programmabletransaction, self._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 _UniffiConverterTypeProgrammableTransaction: + + @staticmethod + def lift(value: int): + return ProgrammableTransaction._make_instance_(value) + + @staticmethod + def check_lower(value: ProgrammableTransaction): + if not isinstance(value, ProgrammableTransaction): + raise TypeError("Expected ProgrammableTransaction instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: ProgrammableTransactionProtocol): + if not isinstance(value, ProgrammableTransaction): + raise TypeError("Expected ProgrammableTransaction instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: ProgrammableTransactionProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class ProtocolConfigsProtocol(typing.Protocol): + pass +# ProtocolConfigs is a Rust-only trait - it's a wrapper around a Rust implementation. +class ProtocolConfigs(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_protocolconfigs, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_protocolconfigs, self._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 _UniffiConverterTypeProtocolConfigs: + + @staticmethod + def lift(value: int): + return ProtocolConfigs._make_instance_(value) + + @staticmethod + def check_lower(value: ProtocolConfigs): + if not isinstance(value, ProtocolConfigs): + raise TypeError("Expected ProtocolConfigs instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: ProtocolConfigsProtocol): + if not isinstance(value, ProtocolConfigs): + raise TypeError("Expected ProtocolConfigs instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: ProtocolConfigsProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class RandomnessStateUpdateProtocol(typing.Protocol): + pass +# RandomnessStateUpdate is a Rust-only trait - it's a wrapper around a Rust implementation. +class RandomnessStateUpdate(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_randomnessstateupdate, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_randomnessstateupdate, self._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 _UniffiConverterTypeRandomnessStateUpdate: + + @staticmethod + def lift(value: int): + return RandomnessStateUpdate._make_instance_(value) + + @staticmethod + def check_lower(value: RandomnessStateUpdate): + if not isinstance(value, RandomnessStateUpdate): + raise TypeError("Expected RandomnessStateUpdate instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: RandomnessStateUpdateProtocol): + if not isinstance(value, RandomnessStateUpdate): + raise TypeError("Expected RandomnessStateUpdate instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: RandomnessStateUpdateProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class Secp256k1PublicKeyProtocol(typing.Protocol): + """ + A secp256k1 signature. + + # BCS + + The BCS serialized form for this type is defined by the following ABNF: + + ```text + secp256k1-signature = 64OCTECT + ``` + """ + + def to_bytes(self, ): + raise NotImplementedError +# Secp256k1PublicKey is a Rust-only trait - it's a wrapper around a Rust implementation. +class Secp256k1PublicKey(): + """ + A secp256k1 signature. + + # BCS + + The BCS serialized form for this type is defined by the following ABNF: + + ```text + secp256k1-signature = 64OCTECT + ``` + """ + + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_secp256k1publickey, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_secp256k1publickey, self._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 from_bytes(cls, bytes: "bytes"): + _UniffiConverterBytes.check_lower(bytes) + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call_with_error(_UniffiConverterTypeBindingsSdkError,_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_secp256k1publickey_from_bytes, + _UniffiConverterBytes.lower(bytes)) + return cls._make_instance_(pointer) + + @classmethod + def from_str(cls, s: "str"): + _UniffiConverterString.check_lower(s) + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call_with_error(_UniffiConverterTypeBindingsSdkError,_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_secp256k1publickey_from_str, + _UniffiConverterString.lower(s)) + return cls._make_instance_(pointer) + + @classmethod + def generate(cls, ): + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_secp256k1publickey_generate,) + return cls._make_instance_(pointer) + + + + def to_bytes(self, ) -> "bytes": + return _UniffiConverterBytes.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_secp256k1publickey_to_bytes,self._uniffi_clone_pointer(),) + ) + + + + + + +class _UniffiConverterTypeSecp256k1PublicKey: + + @staticmethod + def lift(value: int): + return Secp256k1PublicKey._make_instance_(value) + + @staticmethod + def check_lower(value: Secp256k1PublicKey): + if not isinstance(value, Secp256k1PublicKey): + raise TypeError("Expected Secp256k1PublicKey instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: Secp256k1PublicKeyProtocol): + if not isinstance(value, Secp256k1PublicKey): + raise TypeError("Expected Secp256k1PublicKey instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: Secp256k1PublicKeyProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class Secp256r1PublicKeyProtocol(typing.Protocol): + """ + A secp256r1 signature. + + # BCS + + The BCS serialized form for this type is defined by the following ABNF: + + ```text + secp256r1-signature = 64OCTECT + ``` + """ + + def to_bytes(self, ): + raise NotImplementedError +# Secp256r1PublicKey is a Rust-only trait - it's a wrapper around a Rust implementation. +class Secp256r1PublicKey(): + """ + A secp256r1 signature. + + # BCS + + The BCS serialized form for this type is defined by the following ABNF: + + ```text + secp256r1-signature = 64OCTECT + ``` + """ + + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_secp256r1publickey, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_secp256r1publickey, self._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 from_bytes(cls, bytes: "bytes"): + _UniffiConverterBytes.check_lower(bytes) + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call_with_error(_UniffiConverterTypeBindingsSdkError,_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_secp256r1publickey_from_bytes, + _UniffiConverterBytes.lower(bytes)) + return cls._make_instance_(pointer) + + @classmethod + def from_str(cls, s: "str"): + _UniffiConverterString.check_lower(s) + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call_with_error(_UniffiConverterTypeBindingsSdkError,_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_secp256r1publickey_from_str, + _UniffiConverterString.lower(s)) + return cls._make_instance_(pointer) + + @classmethod + def generate(cls, ): + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_secp256r1publickey_generate,) + return cls._make_instance_(pointer) + + + + def to_bytes(self, ) -> "bytes": + return _UniffiConverterBytes.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_secp256r1publickey_to_bytes,self._uniffi_clone_pointer(),) + ) + + + + + + +class _UniffiConverterTypeSecp256r1PublicKey: + + @staticmethod + def lift(value: int): + return Secp256r1PublicKey._make_instance_(value) + + @staticmethod + def check_lower(value: Secp256r1PublicKey): + if not isinstance(value, Secp256r1PublicKey): + raise TypeError("Expected Secp256r1PublicKey instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: Secp256r1PublicKeyProtocol): + if not isinstance(value, Secp256r1PublicKey): + raise TypeError("Expected Secp256r1PublicKey instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: Secp256r1PublicKeyProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class ServiceConfigProtocol(typing.Protocol): + pass +# ServiceConfig is a Rust-only trait - it's a wrapper around a Rust implementation. +class ServiceConfig(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_serviceconfig, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_serviceconfig, self._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 _UniffiConverterTypeServiceConfig: + + @staticmethod + def lift(value: int): + return ServiceConfig._make_instance_(value) + + @staticmethod + def check_lower(value: ServiceConfig): + if not isinstance(value, ServiceConfig): + raise TypeError("Expected ServiceConfig instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: ServiceConfigProtocol): + if not isinstance(value, ServiceConfig): + raise TypeError("Expected ServiceConfig instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: ServiceConfigProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class SignedTransactionProtocol(typing.Protocol): + def signatures(self, ): + raise NotImplementedError + def transaction(self, ): + raise NotImplementedError +# SignedTransaction is a Rust-only trait - it's a wrapper around a Rust implementation. +class SignedTransaction(): + _pointer: ctypes.c_void_p + def __init__(self, transaction: "Transaction",signatures: "typing.List[UserSignature]"): + _UniffiConverterTypeTransaction.check_lower(transaction) + + _UniffiConverterSequenceTypeUserSignature.check_lower(signatures) + + self._pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_signedtransaction_new, + _UniffiConverterTypeTransaction.lower(transaction), + _UniffiConverterSequenceTypeUserSignature.lower(signatures)) + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_signedtransaction, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_signedtransaction, self._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 signatures(self, ) -> "typing.List[UserSignature]": + return _UniffiConverterSequenceTypeUserSignature.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_signedtransaction_signatures,self._uniffi_clone_pointer(),) + ) + + + + + + def transaction(self, ) -> "Transaction": + return _UniffiConverterTypeTransaction.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_signedtransaction_transaction,self._uniffi_clone_pointer(),) + ) + + + + + + +class _UniffiConverterTypeSignedTransaction: + + @staticmethod + def lift(value: int): + return SignedTransaction._make_instance_(value) + + @staticmethod + def check_lower(value: SignedTransaction): + if not isinstance(value, SignedTransaction): + raise TypeError("Expected SignedTransaction instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: SignedTransactionProtocol): + if not isinstance(value, SignedTransaction): + raise TypeError("Expected SignedTransaction instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: SignedTransactionProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class SignedTransactionPageProtocol(typing.Protocol): + def data(self, ): + raise NotImplementedError + def is_empty(self, ): + raise NotImplementedError + def page_info(self, ): + raise NotImplementedError +# SignedTransactionPage is a Rust-only trait - it's a wrapper around a Rust implementation. +class SignedTransactionPage(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_signedtransactionpage, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_signedtransactionpage, self._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 data(self, ) -> "typing.List[SignedTransaction]": + return _UniffiConverterSequenceTypeSignedTransaction.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_signedtransactionpage_data,self._uniffi_clone_pointer(),) + ) + + + + + + def is_empty(self, ) -> "bool": + return _UniffiConverterBool.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_signedtransactionpage_is_empty,self._uniffi_clone_pointer(),) + ) + + + + + + def page_info(self, ) -> "PageInfo": + return _UniffiConverterTypePageInfo.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_signedtransactionpage_page_info,self._uniffi_clone_pointer(),) + ) + + + + + + +class _UniffiConverterTypeSignedTransactionPage: + + @staticmethod + def lift(value: int): + return SignedTransactionPage._make_instance_(value) + + @staticmethod + def check_lower(value: SignedTransactionPage): + if not isinstance(value, SignedTransactionPage): + raise TypeError("Expected SignedTransactionPage instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: SignedTransactionPageProtocol): + if not isinstance(value, SignedTransactionPage): + raise TypeError("Expected SignedTransactionPage instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: SignedTransactionPageProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class TransactionProtocol(typing.Protocol): + """ + A transaction + + # BCS + + The BCS serialized form for this type is defined by the following ABNF: + + ```text + transaction = %x00 transaction-v1 + + transaction-v1 = transaction-kind address gas-payment transaction-expiration + ``` + """ + + def expiration(self, ): + raise NotImplementedError + def gas_payment(self, ): + raise NotImplementedError + def kind(self, ): + raise NotImplementedError + def sender(self, ): + raise NotImplementedError +# Transaction is a Rust-only trait - it's a wrapper around a Rust implementation. +class Transaction(): + """ + A transaction + + # BCS + + The BCS serialized form for this type is defined by the following ABNF: + + ```text + transaction = %x00 transaction-v1 + + transaction-v1 = transaction-kind address gas-payment transaction-expiration + ``` + """ + + _pointer: ctypes.c_void_p + def __init__(self, kind: "TransactionKind",sender: "Address",gas_payment: "GasPayment",expiration: "TransactionExpiration"): + _UniffiConverterTypeTransactionKind.check_lower(kind) + + _UniffiConverterTypeAddress.check_lower(sender) + + _UniffiConverterTypeGasPayment.check_lower(gas_payment) + + _UniffiConverterTypeTransactionExpiration.check_lower(expiration) + + self._pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_transaction_new, + _UniffiConverterTypeTransactionKind.lower(kind), + _UniffiConverterTypeAddress.lower(sender), + _UniffiConverterTypeGasPayment.lower(gas_payment), + _UniffiConverterTypeTransactionExpiration.lower(expiration)) + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transaction, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transaction, self._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 expiration(self, ) -> "TransactionExpiration": + return _UniffiConverterTypeTransactionExpiration.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transaction_expiration,self._uniffi_clone_pointer(),) + ) + + + + + + def gas_payment(self, ) -> "GasPayment": + return _UniffiConverterTypeGasPayment.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transaction_gas_payment,self._uniffi_clone_pointer(),) + ) + + + + + + def kind(self, ) -> "TransactionKind": + return _UniffiConverterTypeTransactionKind.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transaction_kind,self._uniffi_clone_pointer(),) + ) + + + + + + def sender(self, ) -> "Address": + return _UniffiConverterTypeAddress.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transaction_sender,self._uniffi_clone_pointer(),) + ) + + + + + + +class _UniffiConverterTypeTransaction: + + @staticmethod + def lift(value: int): + return Transaction._make_instance_(value) + + @staticmethod + def check_lower(value: Transaction): + if not isinstance(value, Transaction): + raise TypeError("Expected Transaction instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: TransactionProtocol): + if not isinstance(value, Transaction): + raise TypeError("Expected Transaction instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: TransactionProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class TransactionDataEffectsProtocol(typing.Protocol): + def effects(self, ): + raise NotImplementedError + def tx(self, ): + raise NotImplementedError +# TransactionDataEffects is a Rust-only trait - it's a wrapper around a Rust implementation. +class TransactionDataEffects(): + _pointer: ctypes.c_void_p + def __init__(self, tx: "SignedTransaction",effects: "TransactionEffects"): + _UniffiConverterTypeSignedTransaction.check_lower(tx) + + _UniffiConverterTypeTransactionEffects.check_lower(effects) + + self._pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_transactiondataeffects_new, + _UniffiConverterTypeSignedTransaction.lower(tx), + _UniffiConverterTypeTransactionEffects.lower(effects)) + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactiondataeffects, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactiondataeffects, self._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 effects(self, ) -> "TransactionEffects": + return _UniffiConverterTypeTransactionEffects.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactiondataeffects_effects,self._uniffi_clone_pointer(),) + ) + + + + + + def tx(self, ) -> "SignedTransaction": + return _UniffiConverterTypeSignedTransaction.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactiondataeffects_tx,self._uniffi_clone_pointer(),) + ) + + + + + + +class _UniffiConverterTypeTransactionDataEffects: + + @staticmethod + def lift(value: int): + return TransactionDataEffects._make_instance_(value) + + @staticmethod + def check_lower(value: TransactionDataEffects): + if not isinstance(value, TransactionDataEffects): + raise TypeError("Expected TransactionDataEffects instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: TransactionDataEffectsProtocol): + if not isinstance(value, TransactionDataEffects): + raise TypeError("Expected TransactionDataEffects instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: TransactionDataEffectsProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class TransactionDataEffectsPageProtocol(typing.Protocol): + def data(self, ): + raise NotImplementedError + def is_empty(self, ): + raise NotImplementedError + def page_info(self, ): + raise NotImplementedError +# TransactionDataEffectsPage is a Rust-only trait - it's a wrapper around a Rust implementation. +class TransactionDataEffectsPage(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactiondataeffectspage, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactiondataeffectspage, self._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 data(self, ) -> "typing.List[TransactionDataEffects]": + return _UniffiConverterSequenceTypeTransactionDataEffects.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactiondataeffectspage_data,self._uniffi_clone_pointer(),) + ) + + + + + + def is_empty(self, ) -> "bool": + return _UniffiConverterBool.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactiondataeffectspage_is_empty,self._uniffi_clone_pointer(),) + ) + + + + + + def page_info(self, ) -> "PageInfo": + return _UniffiConverterTypePageInfo.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactiondataeffectspage_page_info,self._uniffi_clone_pointer(),) + ) + + + + + + +class _UniffiConverterTypeTransactionDataEffectsPage: + + @staticmethod + def lift(value: int): + return TransactionDataEffectsPage._make_instance_(value) + + @staticmethod + def check_lower(value: TransactionDataEffectsPage): + if not isinstance(value, TransactionDataEffectsPage): + raise TypeError("Expected TransactionDataEffectsPage instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: TransactionDataEffectsPageProtocol): + if not isinstance(value, TransactionDataEffectsPage): + raise TypeError("Expected TransactionDataEffectsPage instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: TransactionDataEffectsPageProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class TransactionDigestProtocol(typing.Protocol): + pass +# TransactionDigest is a Rust-only trait - it's a wrapper around a Rust implementation. +class TransactionDigest(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactiondigest, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactiondigest, self._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 _UniffiConverterTypeTransactionDigest: + + @staticmethod + def lift(value: int): + return TransactionDigest._make_instance_(value) + + @staticmethod + def check_lower(value: TransactionDigest): + if not isinstance(value, TransactionDigest): + raise TypeError("Expected TransactionDigest instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: TransactionDigestProtocol): + if not isinstance(value, TransactionDigest): + raise TypeError("Expected TransactionDigest instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: TransactionDigestProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class TransactionEffectsProtocol(typing.Protocol): + pass +# TransactionEffects is a Rust-only trait - it's a wrapper around a Rust implementation. +class TransactionEffects(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactioneffects, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactioneffects, self._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 _UniffiConverterTypeTransactionEffects: + + @staticmethod + def lift(value: int): + return TransactionEffects._make_instance_(value) + + @staticmethod + def check_lower(value: TransactionEffects): + if not isinstance(value, TransactionEffects): + raise TypeError("Expected TransactionEffects instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: TransactionEffectsProtocol): + if not isinstance(value, TransactionEffects): + raise TypeError("Expected TransactionEffects instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: TransactionEffectsProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class TransactionEffectsDigestProtocol(typing.Protocol): + pass +# TransactionEffectsDigest is a Rust-only trait - it's a wrapper around a Rust implementation. +class TransactionEffectsDigest(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactioneffectsdigest, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactioneffectsdigest, self._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 _UniffiConverterTypeTransactionEffectsDigest: + + @staticmethod + def lift(value: int): + return TransactionEffectsDigest._make_instance_(value) + + @staticmethod + def check_lower(value: TransactionEffectsDigest): + if not isinstance(value, TransactionEffectsDigest): + raise TypeError("Expected TransactionEffectsDigest instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: TransactionEffectsDigestProtocol): + if not isinstance(value, TransactionEffectsDigest): + raise TypeError("Expected TransactionEffectsDigest instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: TransactionEffectsDigestProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class TransactionEffectsPageProtocol(typing.Protocol): + def data(self, ): + raise NotImplementedError + def is_empty(self, ): + raise NotImplementedError + def page_info(self, ): + raise NotImplementedError +# TransactionEffectsPage is a Rust-only trait - it's a wrapper around a Rust implementation. +class TransactionEffectsPage(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactioneffectspage, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactioneffectspage, self._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 data(self, ) -> "typing.List[TransactionEffects]": + return _UniffiConverterSequenceTypeTransactionEffects.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactioneffectspage_data,self._uniffi_clone_pointer(),) + ) + + + + + + def is_empty(self, ) -> "bool": + return _UniffiConverterBool.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactioneffectspage_is_empty,self._uniffi_clone_pointer(),) + ) + + + + + + def page_info(self, ) -> "PageInfo": + return _UniffiConverterTypePageInfo.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactioneffectspage_page_info,self._uniffi_clone_pointer(),) + ) + + + + + + +class _UniffiConverterTypeTransactionEffectsPage: + + @staticmethod + def lift(value: int): + return TransactionEffectsPage._make_instance_(value) + + @staticmethod + def check_lower(value: TransactionEffectsPage): + if not isinstance(value, TransactionEffectsPage): + raise TypeError("Expected TransactionEffectsPage instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: TransactionEffectsPageProtocol): + if not isinstance(value, TransactionEffectsPage): + raise TypeError("Expected TransactionEffectsPage instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: TransactionEffectsPageProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class TransactionEventProtocol(typing.Protocol): + pass +# TransactionEvent is a Rust-only trait - it's a wrapper around a Rust implementation. +class TransactionEvent(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactionevent, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactionevent, self._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 _UniffiConverterTypeTransactionEvent: + + @staticmethod + def lift(value: int): + return TransactionEvent._make_instance_(value) + + @staticmethod + def check_lower(value: TransactionEvent): + if not isinstance(value, TransactionEvent): + raise TypeError("Expected TransactionEvent instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: TransactionEventProtocol): + if not isinstance(value, TransactionEvent): + raise TypeError("Expected TransactionEvent instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: TransactionEventProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class TransactionEventPageProtocol(typing.Protocol): + def data(self, ): + raise NotImplementedError + def is_empty(self, ): + raise NotImplementedError + def page_info(self, ): + raise NotImplementedError +# TransactionEventPage is a Rust-only trait - it's a wrapper around a Rust implementation. +class TransactionEventPage(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactioneventpage, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactioneventpage, self._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 data(self, ) -> "typing.List[TransactionEvent]": + return _UniffiConverterSequenceTypeTransactionEvent.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactioneventpage_data,self._uniffi_clone_pointer(),) + ) + + + + + + def is_empty(self, ) -> "bool": + return _UniffiConverterBool.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactioneventpage_is_empty,self._uniffi_clone_pointer(),) + ) + + + + + + def page_info(self, ) -> "PageInfo": + return _UniffiConverterTypePageInfo.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_transactioneventpage_page_info,self._uniffi_clone_pointer(),) + ) + + + + + + +class _UniffiConverterTypeTransactionEventPage: + + @staticmethod + def lift(value: int): + return TransactionEventPage._make_instance_(value) + + @staticmethod + def check_lower(value: TransactionEventPage): + if not isinstance(value, TransactionEventPage): + raise TypeError("Expected TransactionEventPage instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: TransactionEventPageProtocol): + if not isinstance(value, TransactionEventPage): + raise TypeError("Expected TransactionEventPage instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: TransactionEventPageProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class TransactionEventsDigestProtocol(typing.Protocol): + pass +# TransactionEventsDigest is a Rust-only trait - it's a wrapper around a Rust implementation. +class TransactionEventsDigest(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactioneventsdigest, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactioneventsdigest, self._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 _UniffiConverterTypeTransactionEventsDigest: + + @staticmethod + def lift(value: int): + return TransactionEventsDigest._make_instance_(value) + + @staticmethod + def check_lower(value: TransactionEventsDigest): + if not isinstance(value, TransactionEventsDigest): + raise TypeError("Expected TransactionEventsDigest instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: TransactionEventsDigestProtocol): + if not isinstance(value, TransactionEventsDigest): + raise TypeError("Expected TransactionEventsDigest instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: TransactionEventsDigestProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class TransactionExpirationProtocol(typing.Protocol): + pass +# TransactionExpiration is a Rust-only trait - it's a wrapper around a Rust implementation. +class TransactionExpiration(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactionexpiration, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactionexpiration, self._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 _UniffiConverterTypeTransactionExpiration: + + @staticmethod + def lift(value: int): + return TransactionExpiration._make_instance_(value) + + @staticmethod + def check_lower(value: TransactionExpiration): + if not isinstance(value, TransactionExpiration): + raise TypeError("Expected TransactionExpiration instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: TransactionExpirationProtocol): + if not isinstance(value, TransactionExpiration): + raise TypeError("Expected TransactionExpiration instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: TransactionExpirationProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class TransactionKindProtocol(typing.Protocol): + """ + Transaction type + + # BCS + + The BCS serialized form for this type is defined by the following ABNF: + + ```text + transaction-kind = %x00 ptb + =/ %x01 change-epoch + =/ %x02 genesis-transaction + =/ %x03 consensus-commit-prologue + =/ %x04 authenticator-state-update + =/ %x05 (vector end-of-epoch-transaction-kind) + =/ %x06 randomness-state-update + =/ %x07 consensus-commit-prologue-v2 + =/ %x08 consensus-commit-prologue-v3 + ``` + """ + + pass +# TransactionKind is a Rust-only trait - it's a wrapper around a Rust implementation. +class TransactionKind(): + """ + Transaction type + + # BCS + + The BCS serialized form for this type is defined by the following ABNF: + + ```text + transaction-kind = %x00 ptb + =/ %x01 change-epoch + =/ %x02 genesis-transaction + =/ %x03 consensus-commit-prologue + =/ %x04 authenticator-state-update + =/ %x05 (vector end-of-epoch-transaction-kind) + =/ %x06 randomness-state-update + =/ %x07 consensus-commit-prologue-v2 + =/ %x08 consensus-commit-prologue-v3 + ``` + """ + + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_transactionkind, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_transactionkind, self._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 authenticator_state_update_v1(cls, tx: "AuthenticatorStateUpdateV1"): + _UniffiConverterTypeAuthenticatorStateUpdateV1.check_lower(tx) + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_transactionkind_authenticator_state_update_v1, + _UniffiConverterTypeAuthenticatorStateUpdateV1.lower(tx)) + return cls._make_instance_(pointer) + + @classmethod + def consensus_commit_prologue_v1(cls, tx: "ConsensusCommitPrologueV1"): + _UniffiConverterTypeConsensusCommitPrologueV1.check_lower(tx) + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_transactionkind_consensus_commit_prologue_v1, + _UniffiConverterTypeConsensusCommitPrologueV1.lower(tx)) + return cls._make_instance_(pointer) + + @classmethod + def end_of_epoch(cls, tx: "typing.List[EndOfEpochTransactionKind]"): + _UniffiConverterSequenceTypeEndOfEpochTransactionKind.check_lower(tx) + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_transactionkind_end_of_epoch, + _UniffiConverterSequenceTypeEndOfEpochTransactionKind.lower(tx)) + return cls._make_instance_(pointer) + + @classmethod + def genesis(cls, tx: "GenesisTransaction"): + _UniffiConverterTypeGenesisTransaction.check_lower(tx) + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_transactionkind_genesis, + _UniffiConverterTypeGenesisTransaction.lower(tx)) + return cls._make_instance_(pointer) + + @classmethod + def programmable_transaction(cls, tx: "ProgrammableTransaction"): + _UniffiConverterTypeProgrammableTransaction.check_lower(tx) + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_transactionkind_programmable_transaction, + _UniffiConverterTypeProgrammableTransaction.lower(tx)) + return cls._make_instance_(pointer) + + @classmethod + def randomness_state_update(cls, tx: "RandomnessStateUpdate"): + _UniffiConverterTypeRandomnessStateUpdate.check_lower(tx) + + # Call the (fallible) function before creating any half-baked object instances. + pointer = _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_constructor_transactionkind_randomness_state_update, + _UniffiConverterTypeRandomnessStateUpdate.lower(tx)) + return cls._make_instance_(pointer) + + + + +class _UniffiConverterTypeTransactionKind: + + @staticmethod + def lift(value: int): + return TransactionKind._make_instance_(value) + + @staticmethod + def check_lower(value: TransactionKind): + if not isinstance(value, TransactionKind): + raise TypeError("Expected TransactionKind instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: TransactionKindProtocol): + if not isinstance(value, TransactionKind): + raise TypeError("Expected TransactionKind instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: TransactionKindProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class TypeTagProtocol(typing.Protocol): + pass +# TypeTag is a Rust-only trait - it's a wrapper around a Rust implementation. +class TypeTag(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_typetag, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_typetag, self._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 _UniffiConverterTypeTypeTag: + + @staticmethod + def lift(value: int): + return TypeTag._make_instance_(value) + + @staticmethod + def check_lower(value: TypeTag): + if not isinstance(value, TypeTag): + raise TypeError("Expected TypeTag instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: TypeTagProtocol): + if not isinstance(value, TypeTag): + raise TypeError("Expected TypeTag instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: TypeTagProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class UserSignatureProtocol(typing.Protocol): + pass +# UserSignature is a Rust-only trait - it's a wrapper around a Rust implementation. +class UserSignature(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_usersignature, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_usersignature, self._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 _UniffiConverterTypeUserSignature: + + @staticmethod + def lift(value: int): + return UserSignature._make_instance_(value) + + @staticmethod + def check_lower(value: UserSignature): + if not isinstance(value, UserSignature): + raise TypeError("Expected UserSignature instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: UserSignatureProtocol): + if not isinstance(value, UserSignature): + raise TypeError("Expected UserSignature instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: UserSignatureProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class ValidatorProtocol(typing.Protocol): + pass +# Validator is a Rust-only trait - it's a wrapper around a Rust implementation. +class Validator(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_validator, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_validator, self._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 _UniffiConverterTypeValidator: + + @staticmethod + def lift(value: int): + return Validator._make_instance_(value) + + @staticmethod + def check_lower(value: Validator): + if not isinstance(value, Validator): + raise TypeError("Expected Validator instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: ValidatorProtocol): + if not isinstance(value, Validator): + raise TypeError("Expected Validator instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: ValidatorProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +class ValidatorPageProtocol(typing.Protocol): + def data(self, ): + raise NotImplementedError + def is_empty(self, ): + raise NotImplementedError + def page_info(self, ): + raise NotImplementedError +# ValidatorPage is a Rust-only trait - it's a wrapper around a Rust implementation. +class ValidatorPage(): + _pointer: ctypes.c_void_p + + def __init__(self, *args, **kwargs): + raise ValueError("This class has no default constructor") + + def __del__(self): + # In case of partial initialization of instances. + pointer = getattr(self, "_pointer", None) + if pointer is not None: + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_free_validatorpage, pointer) + + def _uniffi_clone_pointer(self): + return _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_clone_validatorpage, self._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 data(self, ) -> "typing.List[Validator]": + return _UniffiConverterSequenceTypeValidator.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorpage_data,self._uniffi_clone_pointer(),) + ) + + + + + + def is_empty(self, ) -> "bool": + return _UniffiConverterBool.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorpage_is_empty,self._uniffi_clone_pointer(),) + ) + + + + + + def page_info(self, ) -> "PageInfo": + return _UniffiConverterTypePageInfo.lift( + _uniffi_rust_call(_UniffiLib.uniffi_iota_sdk_ffi_fn_method_validatorpage_page_info,self._uniffi_clone_pointer(),) + ) + + + + + + +class _UniffiConverterTypeValidatorPage: + + @staticmethod + def lift(value: int): + return ValidatorPage._make_instance_(value) + + @staticmethod + def check_lower(value: ValidatorPage): + if not isinstance(value, ValidatorPage): + raise TypeError("Expected ValidatorPage instance, {} found".format(type(value).__name__)) + + @staticmethod + def lower(value: ValidatorPageProtocol): + if not isinstance(value, ValidatorPage): + raise TypeError("Expected ValidatorPage instance, {} found".format(type(value).__name__)) + return value._uniffi_clone_pointer() + + @classmethod + def read(cls, buf: _UniffiRustBuffer): + ptr = buf.read_u64() + if ptr == 0: + raise InternalError("Raw pointer value was null") + return cls.lift(ptr) + + @classmethod + def write(cls, value: ValidatorPageProtocol, buf: _UniffiRustBuffer): + buf.write_u64(cls.lower(value)) +Value = str + +# Async support# RustFuturePoll values +_UNIFFI_RUST_FUTURE_POLL_READY = 0 +_UNIFFI_RUST_FUTURE_POLL_MAYBE_READY = 1 + +# Stores futures for _uniffi_continuation_callback +_UniffiContinuationHandleMap = _UniffiHandleMap() + +_UNIFFI_GLOBAL_EVENT_LOOP = None + +""" +Set the event loop to use for async functions + +This is needed if some async functions run outside of the eventloop, for example: + - A non-eventloop thread is spawned, maybe from `EventLoop.run_in_executor` or maybe from the + Rust code spawning its own thread. + - The Rust code calls an async callback method from a sync callback function, using something + like `pollster` to block on the async call. + +In this case, we need an event loop to run the Python async function, but there's no eventloop set +for the thread. Use `uniffi_set_event_loop` to force an eventloop to be used in this case. +""" +def uniffi_set_event_loop(eventloop: asyncio.BaseEventLoop): + global _UNIFFI_GLOBAL_EVENT_LOOP + _UNIFFI_GLOBAL_EVENT_LOOP = eventloop + +def _uniffi_get_event_loop(): + if _UNIFFI_GLOBAL_EVENT_LOOP is not None: + return _UNIFFI_GLOBAL_EVENT_LOOP + else: + return asyncio.get_running_loop() + +# Continuation callback for async functions +# lift the return value or error and resolve the future, causing the async function to resume. +@_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK +def _uniffi_continuation_callback(future_ptr, poll_code): + (eventloop, future) = _UniffiContinuationHandleMap.remove(future_ptr) + eventloop.call_soon_threadsafe(_uniffi_set_future_result, future, poll_code) + +def _uniffi_set_future_result(future, poll_code): + if not future.cancelled(): + future.set_result(poll_code) + +async def _uniffi_rust_call_async(rust_future, ffi_poll, ffi_complete, ffi_free, lift_func, error_ffi_converter): + try: + eventloop = _uniffi_get_event_loop() + + # Loop and poll until we see a _UNIFFI_RUST_FUTURE_POLL_READY value + while True: + future = eventloop.create_future() + ffi_poll( + rust_future, + _uniffi_continuation_callback, + _UniffiContinuationHandleMap.insert((eventloop, future)), + ) + poll_code = await future + if poll_code == _UNIFFI_RUST_FUTURE_POLL_READY: + break + + return lift_func( + _uniffi_rust_call_with_error(error_ffi_converter, ffi_complete, rust_future) + ) + finally: + ffi_free(rust_future) + +__all__ = [ + "InternalError", + "BindingsSdkError", + "Direction", + "TransactionBlockKindInput", + "CheckpointSummary", + "EndOfEpochData", + "EventFilter", + "GasCostSummary", + "GasPayment", + "ObjectReference", + "PaginationFilter", + "TransactionMetadata", + "TransactionsFilter", + "ValidatorCommitteeMember", + "Address", + "AuthenticatorStateExpire", + "AuthenticatorStateUpdateV1", + "BatchSendStatus", + "Bls12381PublicKey", + "ChangeEpoch", + "ChangeEpochV2", + "CheckpointCommitment", + "CheckpointContentsDigest", + "CheckpointDigest", + "CheckpointSummaryPage", + "Coin", + "CoinMetadata", + "CoinPage", + "ConsensusCommitDigest", + "ConsensusCommitPrologueV1", + "Digest", + "DryRunResult", + "DynamicFieldOutput", + "DynamicFieldOutputPage", + "Ed25519PublicKey", + "EffectsAuxiliaryDataDigest", + "EndOfEpochTransactionKind", + "Epoch", + "EpochPage", + "ExecutionTimeObservations", + "FaucetClient", + "FaucetReceipt", + "GenesisTransaction", + "GraphQlClient", + "MoveFunction", + "MoveModule", + "MovePackage", + "MovePackagePage", + "MoveStruct", + "Object", + "ObjectData", + "ObjectDigest", + "ObjectFilter", + "ObjectId", + "ObjectPage", + "ObjectRef", + "ObjectType", + "Owner", + "PageInfo", + "ProgrammableTransaction", + "ProtocolConfigs", + "RandomnessStateUpdate", + "Secp256k1PublicKey", + "Secp256r1PublicKey", + "ServiceConfig", + "SignedTransaction", + "SignedTransactionPage", + "Transaction", + "TransactionDataEffects", + "TransactionDataEffectsPage", + "TransactionDigest", + "TransactionEffects", + "TransactionEffectsDigest", + "TransactionEffectsPage", + "TransactionEvent", + "TransactionEventPage", + "TransactionEventsDigest", + "TransactionExpiration", + "TransactionKind", + "TypeTag", + "UserSignature", + "Validator", + "ValidatorPage", +] + diff --git a/bindings/python/lib/iota_sdk_types.py b/bindings/python/lib/iota_sdk_types.py deleted file mode 100644 index c52985749..000000000 --- a/bindings/python/lib/iota_sdk_types.py +++ /dev/null @@ -1,12936 +0,0 @@ - - -# 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. - -from __future__ import annotations -import os -import sys -import ctypes -import enum -import struct -import contextlib -import datetime -import threading -import itertools -import traceback -import typing -import platform - -# Used for default argument values -_DEFAULT = object() # type: typing.Any - - -class _UniffiRustBuffer(ctypes.Structure): - _fields_ = [ - ("capacity", ctypes.c_uint64), - ("len", ctypes.c_uint64), - ("data", ctypes.POINTER(ctypes.c_char)), - ] - - @staticmethod - def default(): - return _UniffiRustBuffer(0, 0, None) - - @staticmethod - def alloc(size): - return _uniffi_rust_call(_UniffiLib.ffi_iota_sdk_types_rustbuffer_alloc, size) - - @staticmethod - def reserve(rbuf, additional): - return _uniffi_rust_call(_UniffiLib.ffi_iota_sdk_types_rustbuffer_reserve, rbuf, additional) - - def free(self): - return _uniffi_rust_call(_UniffiLib.ffi_iota_sdk_types_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") - -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_UNEXPECTED_ERROR = 2 - - @staticmethod - def default(): - return _UniffiRustCallStatus(code=_UniffiRustCallStatus.CALL_SUCCESS, error_buf=_UniffiRustBuffer.default()) - - 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_UNEXPECTED_ERROR: - return "_UniffiRustCallStatus(CALL_UNEXPECTED_ERROR)" - else: - return "_UniffiRustCallStatus()" - -def _uniffi_rust_call(fn, *args): - # Call a rust function - return _uniffi_rust_call_with_error(None, fn, *args) - -def _uniffi_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.default() - - 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("_uniffi_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_UNEXPECTED_ERROR: - # 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)) - -def _uniffi_trait_interface_call(call_status, make_call, write_return_value): - try: - return write_return_value(make_call()) - except Exception as e: - call_status.code = _UniffiRustCallStatus.CALL_UNEXPECTED_ERROR - call_status.error_buf = _UniffiConverterString.lower(repr(e)) - -def _uniffi_trait_interface_call_with_error(call_status, make_call, write_return_value, error_type, lower_error): - try: - try: - return write_return_value(make_call()) - except error_type as e: - call_status.code = _UniffiRustCallStatus.CALL_ERROR - call_status.error_buf = lower_error(e) - except Exception as e: - call_status.code = _UniffiRustCallStatus.CALL_UNEXPECTED_ERROR - call_status.error_buf = _UniffiConverterString.lower(repr(e)) -class _UniffiHandleMap: - """ - A map where inserting, getting and removing data is synchronized with a lock. - """ - - def __init__(self): - # type Handle = int - self._map = {} # type: Dict[Handle, Any] - self._lock = threading.Lock() - self._counter = itertools.count() - - def insert(self, obj): - with self._lock: - handle = next(self._counter) - self._map[handle] = obj - return handle - - def get(self, handle): - try: - with self._lock: - return self._map[handle] - except KeyError: - raise InternalError("_UniffiHandleMap.get: Invalid handle") - - def remove(self, handle): - try: - with self._lock: - return self._map.pop(handle) - except KeyError: - raise InternalError("_UniffiHandleMap.remove: Invalid handle") - - def __len__(self): - return len(self._map) -# Types conforming to `_UniffiConverterPrimitive` pass themselves directly over the FFI. -class _UniffiConverterPrimitive: - @classmethod - def lift(cls, value): - return value - - @classmethod - def lower(cls, value): - return value - -class _UniffiConverterPrimitiveInt(_UniffiConverterPrimitive): - @classmethod - def check_lower(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)) - -class _UniffiConverterPrimitiveFloat(_UniffiConverterPrimitive): - @classmethod - def check_lower(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__)) - -# 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 - -""" -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_uint64, 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("iota_graphql_client") - 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 = 29 - # Get the scaffolding contract version by calling the into the dylib - scaffolding_contract_version = lib.ffi_iota_sdk_types_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): - pass - -# 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() -_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK = ctypes.CFUNCTYPE(None,ctypes.c_uint64,ctypes.c_int8, -) -_UNIFFI_FOREIGN_FUTURE_FREE = ctypes.CFUNCTYPE(None,ctypes.c_uint64, -) -_UNIFFI_CALLBACK_INTERFACE_FREE = ctypes.CFUNCTYPE(None,ctypes.c_uint64, -) -class _UniffiForeignFuture(ctypes.Structure): - _fields_ = [ - ("handle", ctypes.c_uint64), - ("free", _UNIFFI_FOREIGN_FUTURE_FREE), - ] -class _UniffiForeignFutureStructU8(ctypes.Structure): - _fields_ = [ - ("return_value", ctypes.c_uint8), - ("call_status", _UniffiRustCallStatus), - ] -_UNIFFI_FOREIGN_FUTURE_COMPLETE_U8 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructU8, -) -class _UniffiForeignFutureStructI8(ctypes.Structure): - _fields_ = [ - ("return_value", ctypes.c_int8), - ("call_status", _UniffiRustCallStatus), - ] -_UNIFFI_FOREIGN_FUTURE_COMPLETE_I8 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructI8, -) -class _UniffiForeignFutureStructU16(ctypes.Structure): - _fields_ = [ - ("return_value", ctypes.c_uint16), - ("call_status", _UniffiRustCallStatus), - ] -_UNIFFI_FOREIGN_FUTURE_COMPLETE_U16 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructU16, -) -class _UniffiForeignFutureStructI16(ctypes.Structure): - _fields_ = [ - ("return_value", ctypes.c_int16), - ("call_status", _UniffiRustCallStatus), - ] -_UNIFFI_FOREIGN_FUTURE_COMPLETE_I16 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructI16, -) -class _UniffiForeignFutureStructU32(ctypes.Structure): - _fields_ = [ - ("return_value", ctypes.c_uint32), - ("call_status", _UniffiRustCallStatus), - ] -_UNIFFI_FOREIGN_FUTURE_COMPLETE_U32 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructU32, -) -class _UniffiForeignFutureStructI32(ctypes.Structure): - _fields_ = [ - ("return_value", ctypes.c_int32), - ("call_status", _UniffiRustCallStatus), - ] -_UNIFFI_FOREIGN_FUTURE_COMPLETE_I32 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructI32, -) -class _UniffiForeignFutureStructU64(ctypes.Structure): - _fields_ = [ - ("return_value", ctypes.c_uint64), - ("call_status", _UniffiRustCallStatus), - ] -_UNIFFI_FOREIGN_FUTURE_COMPLETE_U64 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructU64, -) -class _UniffiForeignFutureStructI64(ctypes.Structure): - _fields_ = [ - ("return_value", ctypes.c_int64), - ("call_status", _UniffiRustCallStatus), - ] -_UNIFFI_FOREIGN_FUTURE_COMPLETE_I64 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructI64, -) -class _UniffiForeignFutureStructF32(ctypes.Structure): - _fields_ = [ - ("return_value", ctypes.c_float), - ("call_status", _UniffiRustCallStatus), - ] -_UNIFFI_FOREIGN_FUTURE_COMPLETE_F32 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructF32, -) -class _UniffiForeignFutureStructF64(ctypes.Structure): - _fields_ = [ - ("return_value", ctypes.c_double), - ("call_status", _UniffiRustCallStatus), - ] -_UNIFFI_FOREIGN_FUTURE_COMPLETE_F64 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructF64, -) -class _UniffiForeignFutureStructPointer(ctypes.Structure): - _fields_ = [ - ("return_value", ctypes.c_void_p), - ("call_status", _UniffiRustCallStatus), - ] -_UNIFFI_FOREIGN_FUTURE_COMPLETE_POINTER = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructPointer, -) -class _UniffiForeignFutureStructRustBuffer(ctypes.Structure): - _fields_ = [ - ("return_value", _UniffiRustBuffer), - ("call_status", _UniffiRustCallStatus), - ] -_UNIFFI_FOREIGN_FUTURE_COMPLETE_RUST_BUFFER = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructRustBuffer, -) -class _UniffiForeignFutureStructVoid(ctypes.Structure): - _fields_ = [ - ("call_status", _UniffiRustCallStatus), - ] -_UNIFFI_FOREIGN_FUTURE_COMPLETE_VOID = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiForeignFutureStructVoid, -) -_UniffiLib.ffi_iota_sdk_types_rustbuffer_alloc.argtypes = ( - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_sdk_types_rustbuffer_alloc.restype = _UniffiRustBuffer -_UniffiLib.ffi_iota_sdk_types_rustbuffer_from_bytes.argtypes = ( - _UniffiForeignBytes, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_sdk_types_rustbuffer_from_bytes.restype = _UniffiRustBuffer -_UniffiLib.ffi_iota_sdk_types_rustbuffer_free.argtypes = ( - _UniffiRustBuffer, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_sdk_types_rustbuffer_free.restype = None -_UniffiLib.ffi_iota_sdk_types_rustbuffer_reserve.argtypes = ( - _UniffiRustBuffer, - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_sdk_types_rustbuffer_reserve.restype = _UniffiRustBuffer -_UniffiLib.ffi_iota_sdk_types_rust_future_poll_u8.argtypes = ( - ctypes.c_uint64, - _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_poll_u8.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_cancel_u8.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_cancel_u8.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_free_u8.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_free_u8.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_complete_u8.argtypes = ( - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_sdk_types_rust_future_complete_u8.restype = ctypes.c_uint8 -_UniffiLib.ffi_iota_sdk_types_rust_future_poll_i8.argtypes = ( - ctypes.c_uint64, - _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_poll_i8.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_cancel_i8.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_cancel_i8.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_free_i8.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_free_i8.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_complete_i8.argtypes = ( - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_sdk_types_rust_future_complete_i8.restype = ctypes.c_int8 -_UniffiLib.ffi_iota_sdk_types_rust_future_poll_u16.argtypes = ( - ctypes.c_uint64, - _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_poll_u16.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_cancel_u16.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_cancel_u16.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_free_u16.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_free_u16.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_complete_u16.argtypes = ( - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_sdk_types_rust_future_complete_u16.restype = ctypes.c_uint16 -_UniffiLib.ffi_iota_sdk_types_rust_future_poll_i16.argtypes = ( - ctypes.c_uint64, - _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_poll_i16.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_cancel_i16.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_cancel_i16.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_free_i16.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_free_i16.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_complete_i16.argtypes = ( - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_sdk_types_rust_future_complete_i16.restype = ctypes.c_int16 -_UniffiLib.ffi_iota_sdk_types_rust_future_poll_u32.argtypes = ( - ctypes.c_uint64, - _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_poll_u32.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_cancel_u32.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_cancel_u32.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_free_u32.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_free_u32.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_complete_u32.argtypes = ( - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_sdk_types_rust_future_complete_u32.restype = ctypes.c_uint32 -_UniffiLib.ffi_iota_sdk_types_rust_future_poll_i32.argtypes = ( - ctypes.c_uint64, - _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_poll_i32.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_cancel_i32.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_cancel_i32.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_free_i32.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_free_i32.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_complete_i32.argtypes = ( - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_sdk_types_rust_future_complete_i32.restype = ctypes.c_int32 -_UniffiLib.ffi_iota_sdk_types_rust_future_poll_u64.argtypes = ( - ctypes.c_uint64, - _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_poll_u64.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_cancel_u64.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_cancel_u64.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_free_u64.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_free_u64.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_complete_u64.argtypes = ( - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_sdk_types_rust_future_complete_u64.restype = ctypes.c_uint64 -_UniffiLib.ffi_iota_sdk_types_rust_future_poll_i64.argtypes = ( - ctypes.c_uint64, - _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_poll_i64.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_cancel_i64.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_cancel_i64.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_free_i64.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_free_i64.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_complete_i64.argtypes = ( - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_sdk_types_rust_future_complete_i64.restype = ctypes.c_int64 -_UniffiLib.ffi_iota_sdk_types_rust_future_poll_f32.argtypes = ( - ctypes.c_uint64, - _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_poll_f32.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_cancel_f32.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_cancel_f32.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_free_f32.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_free_f32.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_complete_f32.argtypes = ( - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_sdk_types_rust_future_complete_f32.restype = ctypes.c_float -_UniffiLib.ffi_iota_sdk_types_rust_future_poll_f64.argtypes = ( - ctypes.c_uint64, - _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_poll_f64.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_cancel_f64.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_cancel_f64.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_free_f64.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_free_f64.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_complete_f64.argtypes = ( - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_sdk_types_rust_future_complete_f64.restype = ctypes.c_double -_UniffiLib.ffi_iota_sdk_types_rust_future_poll_pointer.argtypes = ( - ctypes.c_uint64, - _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_poll_pointer.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_cancel_pointer.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_cancel_pointer.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_free_pointer.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_free_pointer.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_complete_pointer.argtypes = ( - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_sdk_types_rust_future_complete_pointer.restype = ctypes.c_void_p -_UniffiLib.ffi_iota_sdk_types_rust_future_poll_rust_buffer.argtypes = ( - ctypes.c_uint64, - _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_poll_rust_buffer.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_cancel_rust_buffer.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_cancel_rust_buffer.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_free_rust_buffer.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_free_rust_buffer.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_complete_rust_buffer.argtypes = ( - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_sdk_types_rust_future_complete_rust_buffer.restype = _UniffiRustBuffer -_UniffiLib.ffi_iota_sdk_types_rust_future_poll_void.argtypes = ( - ctypes.c_uint64, - _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK, - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_poll_void.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_cancel_void.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_cancel_void.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_free_void.argtypes = ( - ctypes.c_uint64, -) -_UniffiLib.ffi_iota_sdk_types_rust_future_free_void.restype = None -_UniffiLib.ffi_iota_sdk_types_rust_future_complete_void.argtypes = ( - ctypes.c_uint64, - ctypes.POINTER(_UniffiRustCallStatus), -) -_UniffiLib.ffi_iota_sdk_types_rust_future_complete_void.restype = None -_UniffiLib.ffi_iota_sdk_types_uniffi_contract_version.argtypes = ( -) -_UniffiLib.ffi_iota_sdk_types_uniffi_contract_version.restype = ctypes.c_uint32 - -_uniffi_check_contract_api_version(_UniffiLib) -# _uniffi_check_api_checksums(_UniffiLib) - -# 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(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(value, buf): - buf.write_u16(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(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(value, buf): - buf.write_u64(value) - -class _UniffiConverterInt64(_UniffiConverterPrimitiveInt): - CLASS_NAME = "i64" - VALUE_MIN = -2**63 - VALUE_MAX = 2**63 - - @staticmethod - def read(buf): - return buf.read_i64() - - @staticmethod - def write(value, buf): - buf.write_i64(value) - -class _UniffiConverterBool: - @classmethod - def check_lower(cls, value): - return not not value - - @classmethod - def lower(cls, value): - return 1 if value else 0 - - @staticmethod - def lift(value): - return value != 0 - - @classmethod - def read(cls, buf): - return cls.lift(buf.read_u8()) - - @classmethod - def write(cls, value, buf): - buf.write_u8(value) - -class _UniffiConverterString: - @staticmethod - def check_lower(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): - 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): - with _UniffiRustBuffer.alloc_with_builder() as builder: - builder.write(value.encode("utf-8")) - return builder.finalize() - -class _UniffiConverterBytes(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - size = buf.read_i32() - if size < 0: - raise InternalError("Unexpected negative byte string length") - return buf.read(size) - - @staticmethod - def check_lower(value): - try: - memoryview(value) - except TypeError: - raise TypeError("a bytes-like object is required, not {!r}".format(type(value).__name__)) - - @staticmethod - def write(value, buf): - buf.write_i32(len(value)) - buf.write(value) - -# The Duration type. -Duration = datetime.timedelta - -# There is a loss of precision when converting from Rust durations, -# which are accurate to the nanosecond, -# to Python durations, which are only accurate to the microsecond. -class _UniffiConverterDuration(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - seconds = buf.read_u64() - microseconds = buf.read_u32() / 1.0e3 - return datetime.timedelta(seconds=seconds, microseconds=microseconds) - - @staticmethod - def check_lower(value): - seconds = value.seconds + value.days * 24 * 3600 - if seconds < 0: - raise ValueError("Invalid duration, must be non-negative") - - @staticmethod - def write(value, buf): - seconds = value.seconds + value.days * 24 * 3600 - nanoseconds = value.microseconds * 1000 - buf.write_i64(seconds) - buf.write_u32(nanoseconds) - - -class ActiveJwk: - """ - A new Jwk - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - active-jwk = jwk-id jwk u64 - ``` - """ - - jwk_id: "JwkId" - """ - Identifier used to uniquely identify a Jwk - """ - - jwk: "Jwk" - """ - The Jwk - """ - - epoch: "int" - """ - Most recent epoch in which the jwk was validated - """ - - def __init__(self, *, jwk_id: "JwkId", jwk: "Jwk", epoch: "int"): - self.jwk_id = jwk_id - self.jwk = jwk - self.epoch = epoch - - def __str__(self): - return "ActiveJwk(jwk_id={}, jwk={}, epoch={})".format(self.jwk_id, self.jwk, self.epoch) - - def __eq__(self, other): - if self.jwk_id != other.jwk_id: - return False - if self.jwk != other.jwk: - return False - if self.epoch != other.epoch: - return False - return True - -class _UniffiConverterTypeActiveJwk(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return ActiveJwk( - jwk_id=_UniffiConverterTypeJwkId.read(buf), - jwk=_UniffiConverterTypeJwk.read(buf), - epoch=_UniffiConverterUInt64.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeJwkId.check_lower(value.jwk_id) - _UniffiConverterTypeJwk.check_lower(value.jwk) - _UniffiConverterUInt64.check_lower(value.epoch) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeJwkId.write(value.jwk_id, buf) - _UniffiConverterTypeJwk.write(value.jwk, buf) - _UniffiConverterUInt64.write(value.epoch, buf) - - -class AuthenticatorStateExpire: - """ - Expire old JWKs - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - authenticator-state-expire = u64 u64 - ``` - """ - - min_epoch: "int" - """ - expire JWKs that have a lower epoch than this - """ - - authenticator_obj_initial_shared_version: "int" - """ - The initial version of the authenticator object that it was shared at. - """ - - def __init__(self, *, min_epoch: "int", authenticator_obj_initial_shared_version: "int"): - self.min_epoch = min_epoch - self.authenticator_obj_initial_shared_version = authenticator_obj_initial_shared_version - - def __str__(self): - return "AuthenticatorStateExpire(min_epoch={}, authenticator_obj_initial_shared_version={})".format(self.min_epoch, self.authenticator_obj_initial_shared_version) - - def __eq__(self, other): - if self.min_epoch != other.min_epoch: - return False - if self.authenticator_obj_initial_shared_version != other.authenticator_obj_initial_shared_version: - return False - return True - -class _UniffiConverterTypeAuthenticatorStateExpire(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return AuthenticatorStateExpire( - min_epoch=_UniffiConverterUInt64.read(buf), - authenticator_obj_initial_shared_version=_UniffiConverterUInt64.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterUInt64.check_lower(value.min_epoch) - _UniffiConverterUInt64.check_lower(value.authenticator_obj_initial_shared_version) - - @staticmethod - def write(value, buf): - _UniffiConverterUInt64.write(value.min_epoch, buf) - _UniffiConverterUInt64.write(value.authenticator_obj_initial_shared_version, buf) - - -class AuthenticatorStateUpdateV1: - """ - Update the set of valid JWKs - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - authenticator-state-update = u64 ; epoch - u64 ; round - (vector active-jwk) - u64 ; initial version of the authenticator object - ``` - """ - - epoch: "int" - """ - Epoch of the authenticator state update transaction - """ - - round: "int" - """ - Consensus round of the authenticator state update - """ - - new_active_jwks: "typing.List[ActiveJwk]" - """ - newly active jwks - """ - - authenticator_obj_initial_shared_version: "int" - """ - The initial version of the authenticator object that it was shared at. - """ - - def __init__(self, *, epoch: "int", round: "int", new_active_jwks: "typing.List[ActiveJwk]", authenticator_obj_initial_shared_version: "int"): - self.epoch = epoch - self.round = round - self.new_active_jwks = new_active_jwks - self.authenticator_obj_initial_shared_version = authenticator_obj_initial_shared_version - - def __str__(self): - return "AuthenticatorStateUpdateV1(epoch={}, round={}, new_active_jwks={}, authenticator_obj_initial_shared_version={})".format(self.epoch, self.round, self.new_active_jwks, self.authenticator_obj_initial_shared_version) - - def __eq__(self, other): - if self.epoch != other.epoch: - return False - if self.round != other.round: - return False - if self.new_active_jwks != other.new_active_jwks: - return False - if self.authenticator_obj_initial_shared_version != other.authenticator_obj_initial_shared_version: - return False - return True - -class _UniffiConverterTypeAuthenticatorStateUpdateV1(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return AuthenticatorStateUpdateV1( - epoch=_UniffiConverterUInt64.read(buf), - round=_UniffiConverterUInt64.read(buf), - new_active_jwks=_UniffiConverterSequenceTypeActiveJwk.read(buf), - authenticator_obj_initial_shared_version=_UniffiConverterUInt64.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterUInt64.check_lower(value.epoch) - _UniffiConverterUInt64.check_lower(value.round) - _UniffiConverterSequenceTypeActiveJwk.check_lower(value.new_active_jwks) - _UniffiConverterUInt64.check_lower(value.authenticator_obj_initial_shared_version) - - @staticmethod - def write(value, buf): - _UniffiConverterUInt64.write(value.epoch, buf) - _UniffiConverterUInt64.write(value.round, buf) - _UniffiConverterSequenceTypeActiveJwk.write(value.new_active_jwks, buf) - _UniffiConverterUInt64.write(value.authenticator_obj_initial_shared_version, buf) - - -class CancelledTransaction: - """ - A transaction that was cancelled - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - cancelled-transaction = digest (vector version-assignment) - ``` - """ - - digest: "TransactionDigest" - version_assignments: "typing.List[VersionAssignment]" - def __init__(self, *, digest: "TransactionDigest", version_assignments: "typing.List[VersionAssignment]"): - self.digest = digest - self.version_assignments = version_assignments - - def __str__(self): - return "CancelledTransaction(digest={}, version_assignments={})".format(self.digest, self.version_assignments) - - def __eq__(self, other): - if self.digest != other.digest: - return False - if self.version_assignments != other.version_assignments: - return False - return True - -class _UniffiConverterTypeCancelledTransaction(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return CancelledTransaction( - digest=_UniffiConverterTypeTransactionDigest.read(buf), - version_assignments=_UniffiConverterSequenceTypeVersionAssignment.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeTransactionDigest.check_lower(value.digest) - _UniffiConverterSequenceTypeVersionAssignment.check_lower(value.version_assignments) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeTransactionDigest.write(value.digest, buf) - _UniffiConverterSequenceTypeVersionAssignment.write(value.version_assignments, buf) - - -class ChangeEpoch: - """ - System transaction used to change the epoch - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - change-epoch = u64 ; next epoch - u64 ; protocol version - u64 ; storage charge - u64 ; computation charge - u64 ; storage rebate - u64 ; non-refundable storage fee - u64 ; epoch start timestamp - (vector system-package) - ``` - """ - - epoch: "int" - """ - The next (to become) epoch ID. - """ - - protocol_version: "int" - """ - The protocol version in effect in the new epoch. - """ - - storage_charge: "int" - """ - The total amount of gas charged for storage during the epoch. - """ - - computation_charge: "int" - """ - The total amount of gas charged for computation during the epoch. - """ - - storage_rebate: "int" - """ - The amount of storage rebate refunded to the txn senders. - """ - - non_refundable_storage_fee: "int" - """ - The non-refundable storage fee. - """ - - epoch_start_timestamp_ms: "int" - """ - Unix timestamp when epoch started - """ - - system_packages: "typing.List[SystemPackage]" - """ - System packages (specifically framework and move stdlib) that are - written before the new epoch starts. This tracks framework upgrades - on chain. When executing the ChangeEpoch txn, the validator must - write out the modules below. Modules are provided with the version they - will be upgraded to, their modules in serialized form (which include - their package ID), and a list of their transitive dependencies. - """ - - def __init__(self, *, epoch: "int", protocol_version: "int", storage_charge: "int", computation_charge: "int", storage_rebate: "int", non_refundable_storage_fee: "int", epoch_start_timestamp_ms: "int", system_packages: "typing.List[SystemPackage]"): - self.epoch = epoch - self.protocol_version = protocol_version - self.storage_charge = storage_charge - self.computation_charge = computation_charge - self.storage_rebate = storage_rebate - self.non_refundable_storage_fee = non_refundable_storage_fee - self.epoch_start_timestamp_ms = epoch_start_timestamp_ms - self.system_packages = system_packages - - def __str__(self): - return "ChangeEpoch(epoch={}, protocol_version={}, storage_charge={}, computation_charge={}, storage_rebate={}, non_refundable_storage_fee={}, epoch_start_timestamp_ms={}, system_packages={})".format(self.epoch, self.protocol_version, self.storage_charge, self.computation_charge, self.storage_rebate, self.non_refundable_storage_fee, self.epoch_start_timestamp_ms, self.system_packages) - - def __eq__(self, other): - if self.epoch != other.epoch: - return False - if self.protocol_version != other.protocol_version: - return False - if self.storage_charge != other.storage_charge: - return False - if self.computation_charge != other.computation_charge: - return False - if self.storage_rebate != other.storage_rebate: - return False - if self.non_refundable_storage_fee != other.non_refundable_storage_fee: - return False - if self.epoch_start_timestamp_ms != other.epoch_start_timestamp_ms: - return False - if self.system_packages != other.system_packages: - return False - return True - -class _UniffiConverterTypeChangeEpoch(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return ChangeEpoch( - epoch=_UniffiConverterUInt64.read(buf), - protocol_version=_UniffiConverterUInt64.read(buf), - storage_charge=_UniffiConverterUInt64.read(buf), - computation_charge=_UniffiConverterUInt64.read(buf), - storage_rebate=_UniffiConverterUInt64.read(buf), - non_refundable_storage_fee=_UniffiConverterUInt64.read(buf), - epoch_start_timestamp_ms=_UniffiConverterUInt64.read(buf), - system_packages=_UniffiConverterSequenceTypeSystemPackage.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterUInt64.check_lower(value.epoch) - _UniffiConverterUInt64.check_lower(value.protocol_version) - _UniffiConverterUInt64.check_lower(value.storage_charge) - _UniffiConverterUInt64.check_lower(value.computation_charge) - _UniffiConverterUInt64.check_lower(value.storage_rebate) - _UniffiConverterUInt64.check_lower(value.non_refundable_storage_fee) - _UniffiConverterUInt64.check_lower(value.epoch_start_timestamp_ms) - _UniffiConverterSequenceTypeSystemPackage.check_lower(value.system_packages) - - @staticmethod - def write(value, buf): - _UniffiConverterUInt64.write(value.epoch, buf) - _UniffiConverterUInt64.write(value.protocol_version, buf) - _UniffiConverterUInt64.write(value.storage_charge, buf) - _UniffiConverterUInt64.write(value.computation_charge, buf) - _UniffiConverterUInt64.write(value.storage_rebate, buf) - _UniffiConverterUInt64.write(value.non_refundable_storage_fee, buf) - _UniffiConverterUInt64.write(value.epoch_start_timestamp_ms, buf) - _UniffiConverterSequenceTypeSystemPackage.write(value.system_packages, buf) - - -class ChangeEpochV2: - """ - System package - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - system-package = u64 ; version - (vector bytes) ; modules - (vector object-id) ; dependencies - ``` - """ - - epoch: "int" - """ - The next (to become) epoch ID. - """ - - protocol_version: "int" - """ - The protocol version in effect in the new epoch. - """ - - storage_charge: "int" - """ - The total amount of gas charged for storage during the epoch. - """ - - computation_charge: "int" - """ - The total amount of gas charged for computation during the epoch. - """ - - computation_charge_burned: "int" - """ - The total amount of gas burned for computation during the epoch. - """ - - storage_rebate: "int" - """ - The amount of storage rebate refunded to the txn senders. - """ - - non_refundable_storage_fee: "int" - """ - The non-refundable storage fee. - """ - - epoch_start_timestamp_ms: "int" - """ - Unix timestamp when epoch started - """ - - system_packages: "typing.List[SystemPackage]" - """ - System packages (specifically framework and move stdlib) that are - written before the new epoch starts. This tracks framework upgrades - on chain. When executing the ChangeEpoch txn, the validator must - write out the modules below. Modules are provided with the version they - will be upgraded to, their modules in serialized form (which include - their package ID), and a list of their transitive dependencies. - """ - - def __init__(self, *, epoch: "int", protocol_version: "int", storage_charge: "int", computation_charge: "int", computation_charge_burned: "int", storage_rebate: "int", non_refundable_storage_fee: "int", epoch_start_timestamp_ms: "int", system_packages: "typing.List[SystemPackage]"): - self.epoch = epoch - self.protocol_version = protocol_version - self.storage_charge = storage_charge - self.computation_charge = computation_charge - self.computation_charge_burned = computation_charge_burned - self.storage_rebate = storage_rebate - self.non_refundable_storage_fee = non_refundable_storage_fee - self.epoch_start_timestamp_ms = epoch_start_timestamp_ms - self.system_packages = system_packages - - def __str__(self): - return "ChangeEpochV2(epoch={}, protocol_version={}, storage_charge={}, computation_charge={}, computation_charge_burned={}, storage_rebate={}, non_refundable_storage_fee={}, epoch_start_timestamp_ms={}, system_packages={})".format(self.epoch, self.protocol_version, self.storage_charge, self.computation_charge, self.computation_charge_burned, self.storage_rebate, self.non_refundable_storage_fee, self.epoch_start_timestamp_ms, self.system_packages) - - def __eq__(self, other): - if self.epoch != other.epoch: - return False - if self.protocol_version != other.protocol_version: - return False - if self.storage_charge != other.storage_charge: - return False - if self.computation_charge != other.computation_charge: - return False - if self.computation_charge_burned != other.computation_charge_burned: - return False - if self.storage_rebate != other.storage_rebate: - return False - if self.non_refundable_storage_fee != other.non_refundable_storage_fee: - return False - if self.epoch_start_timestamp_ms != other.epoch_start_timestamp_ms: - return False - if self.system_packages != other.system_packages: - return False - return True - -class _UniffiConverterTypeChangeEpochV2(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return ChangeEpochV2( - epoch=_UniffiConverterUInt64.read(buf), - protocol_version=_UniffiConverterUInt64.read(buf), - storage_charge=_UniffiConverterUInt64.read(buf), - computation_charge=_UniffiConverterUInt64.read(buf), - computation_charge_burned=_UniffiConverterUInt64.read(buf), - storage_rebate=_UniffiConverterUInt64.read(buf), - non_refundable_storage_fee=_UniffiConverterUInt64.read(buf), - epoch_start_timestamp_ms=_UniffiConverterUInt64.read(buf), - system_packages=_UniffiConverterSequenceTypeSystemPackage.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterUInt64.check_lower(value.epoch) - _UniffiConverterUInt64.check_lower(value.protocol_version) - _UniffiConverterUInt64.check_lower(value.storage_charge) - _UniffiConverterUInt64.check_lower(value.computation_charge) - _UniffiConverterUInt64.check_lower(value.computation_charge_burned) - _UniffiConverterUInt64.check_lower(value.storage_rebate) - _UniffiConverterUInt64.check_lower(value.non_refundable_storage_fee) - _UniffiConverterUInt64.check_lower(value.epoch_start_timestamp_ms) - _UniffiConverterSequenceTypeSystemPackage.check_lower(value.system_packages) - - @staticmethod - def write(value, buf): - _UniffiConverterUInt64.write(value.epoch, buf) - _UniffiConverterUInt64.write(value.protocol_version, buf) - _UniffiConverterUInt64.write(value.storage_charge, buf) - _UniffiConverterUInt64.write(value.computation_charge, buf) - _UniffiConverterUInt64.write(value.computation_charge_burned, buf) - _UniffiConverterUInt64.write(value.storage_rebate, buf) - _UniffiConverterUInt64.write(value.non_refundable_storage_fee, buf) - _UniffiConverterUInt64.write(value.epoch_start_timestamp_ms, buf) - _UniffiConverterSequenceTypeSystemPackage.write(value.system_packages, buf) - - -class ChangedObject: - """ - Input/output state of an object that was changed during execution - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - changed-object = object-id object-in object-out id-operation - ``` - """ - - object_id: "ObjectId" - """ - Id of the object - """ - - input_state: "ObjectIn" - """ - State of the object in the store prior to this transaction. - """ - - output_state: "ObjectOut" - """ - State of the object in the store after this transaction. - """ - - id_operation: "IdOperation" - """ - Whether this object ID is created or deleted in this transaction. - This information isn't required by the protocol but is useful for - providing more detailed semantics on object changes. - """ - - def __init__(self, *, object_id: "ObjectId", input_state: "ObjectIn", output_state: "ObjectOut", id_operation: "IdOperation"): - self.object_id = object_id - self.input_state = input_state - self.output_state = output_state - self.id_operation = id_operation - - def __str__(self): - return "ChangedObject(object_id={}, input_state={}, output_state={}, id_operation={})".format(self.object_id, self.input_state, self.output_state, self.id_operation) - - def __eq__(self, other): - if self.object_id != other.object_id: - return False - if self.input_state != other.input_state: - return False - if self.output_state != other.output_state: - return False - if self.id_operation != other.id_operation: - return False - return True - -class _UniffiConverterTypeChangedObject(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return ChangedObject( - object_id=_UniffiConverterTypeObjectId.read(buf), - input_state=_UniffiConverterTypeObjectIn.read(buf), - output_state=_UniffiConverterTypeObjectOut.read(buf), - id_operation=_UniffiConverterTypeIdOperation.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeObjectId.check_lower(value.object_id) - _UniffiConverterTypeObjectIn.check_lower(value.input_state) - _UniffiConverterTypeObjectOut.check_lower(value.output_state) - _UniffiConverterTypeIdOperation.check_lower(value.id_operation) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeObjectId.write(value.object_id, buf) - _UniffiConverterTypeObjectIn.write(value.input_state, buf) - _UniffiConverterTypeObjectOut.write(value.output_state, buf) - _UniffiConverterTypeIdOperation.write(value.id_operation, buf) - - -class CheckpointSummary: - """ - A header for a Checkpoint on the IOTA blockchain. - - On the IOTA network, checkpoints define the history of the blockchain. They - are quite similar to the concept of blocks used by other blockchains like - Bitcoin or Ethereum. The IOTA blockchain, however, forms checkpoints after - transaction execution has already happened to provide a certified history of - the chain, instead of being formed before execution. - - Checkpoints commit to a variety of state including but not limited to: - - The hash of the previous checkpoint. - - The set of transaction digests, their corresponding effects digests, as - well as the set of user signatures which authorized its execution. - - The object's produced by a transaction. - - The set of live objects that make up the current state of the chain. - - On epoch transitions, the next validator committee. - - `CheckpointSummary`s themselves don't directly include all of the above - information but they are the top-level type by which all the above are - committed to transitively via cryptographic hashes included in the summary. - `CheckpointSummary`s are signed and certified by a quorum of the validator - committee in a given epoch in order to allow verification of the chain's - state. - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - checkpoint-summary = u64 ; epoch - u64 ; sequence_number - u64 ; network_total_transactions - digest ; content_digest - (option digest) ; previous_digest - gas-cost-summary ; epoch_rolling_gas_cost_summary - u64 ; timestamp_ms - (vector checkpoint-commitment) ; checkpoint_commitments - (option end-of-epoch-data) ; end_of_epoch_data - bytes ; version_specific_data - ``` - """ - - epoch: "int" - """ - Epoch that this checkpoint belongs to. - """ - - sequence_number: "int" - """ - The height of this checkpoint. - """ - - network_total_transactions: "int" - """ - Total number of transactions committed since genesis, including those in - this checkpoint. - """ - - content_digest: "CheckpointContentsDigest" - """ - The hash of the [`CheckpointContents`] for this checkpoint. - """ - - previous_digest: "typing.Optional[CheckpointDigest]" - """ - The hash of the previous `CheckpointSummary`. - - This will be only be `None` for the first, or genesis checkpoint. - """ - - epoch_rolling_gas_cost_summary: "GasCostSummary" - """ - The running total gas costs of all transactions included in the current - epoch so far until this checkpoint. - """ - - timestamp_ms: "int" - """ - Timestamp of the checkpoint - number of milliseconds from the Unix epoch - Checkpoint timestamps are monotonic, but not strongly monotonic - - subsequent checkpoints can have same timestamp if they originate - from the same underlining consensus commit - """ - - checkpoint_commitments: "typing.List[CheckpointCommitment]" - """ - Commitments to checkpoint-specific state. - """ - - end_of_epoch_data: "typing.Optional[EndOfEpochData]" - """ - Extra data only present in the final checkpoint of an epoch. - """ - - version_specific_data: "bytes" - """ - CheckpointSummary is not an evolvable structure - it must be readable by - any version of the code. Therefore, in order to allow extensions to - be added to CheckpointSummary, we allow opaque data to be added to - checkpoints which can be deserialized based on the current - protocol version. - """ - - def __init__(self, *, epoch: "int", sequence_number: "int", network_total_transactions: "int", content_digest: "CheckpointContentsDigest", previous_digest: "typing.Optional[CheckpointDigest]", epoch_rolling_gas_cost_summary: "GasCostSummary", timestamp_ms: "int", checkpoint_commitments: "typing.List[CheckpointCommitment]", end_of_epoch_data: "typing.Optional[EndOfEpochData]", version_specific_data: "bytes"): - self.epoch = epoch - self.sequence_number = sequence_number - self.network_total_transactions = network_total_transactions - self.content_digest = content_digest - self.previous_digest = previous_digest - self.epoch_rolling_gas_cost_summary = epoch_rolling_gas_cost_summary - self.timestamp_ms = timestamp_ms - self.checkpoint_commitments = checkpoint_commitments - self.end_of_epoch_data = end_of_epoch_data - self.version_specific_data = version_specific_data - - def __str__(self): - return "CheckpointSummary(epoch={}, sequence_number={}, network_total_transactions={}, content_digest={}, previous_digest={}, epoch_rolling_gas_cost_summary={}, timestamp_ms={}, checkpoint_commitments={}, end_of_epoch_data={}, version_specific_data={})".format(self.epoch, self.sequence_number, self.network_total_transactions, self.content_digest, self.previous_digest, self.epoch_rolling_gas_cost_summary, self.timestamp_ms, self.checkpoint_commitments, self.end_of_epoch_data, self.version_specific_data) - - def __eq__(self, other): - if self.epoch != other.epoch: - return False - if self.sequence_number != other.sequence_number: - return False - if self.network_total_transactions != other.network_total_transactions: - return False - if self.content_digest != other.content_digest: - return False - if self.previous_digest != other.previous_digest: - return False - if self.epoch_rolling_gas_cost_summary != other.epoch_rolling_gas_cost_summary: - return False - if self.timestamp_ms != other.timestamp_ms: - return False - if self.checkpoint_commitments != other.checkpoint_commitments: - return False - if self.end_of_epoch_data != other.end_of_epoch_data: - return False - if self.version_specific_data != other.version_specific_data: - return False - return True - -class _UniffiConverterTypeCheckpointSummary(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return CheckpointSummary( - epoch=_UniffiConverterUInt64.read(buf), - sequence_number=_UniffiConverterUInt64.read(buf), - network_total_transactions=_UniffiConverterUInt64.read(buf), - content_digest=_UniffiConverterTypeCheckpointContentsDigest.read(buf), - previous_digest=_UniffiConverterOptionalTypeCheckpointDigest.read(buf), - epoch_rolling_gas_cost_summary=_UniffiConverterTypeGasCostSummary.read(buf), - timestamp_ms=_UniffiConverterUInt64.read(buf), - checkpoint_commitments=_UniffiConverterSequenceTypeCheckpointCommitment.read(buf), - end_of_epoch_data=_UniffiConverterOptionalTypeEndOfEpochData.read(buf), - version_specific_data=_UniffiConverterBytes.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterUInt64.check_lower(value.epoch) - _UniffiConverterUInt64.check_lower(value.sequence_number) - _UniffiConverterUInt64.check_lower(value.network_total_transactions) - _UniffiConverterTypeCheckpointContentsDigest.check_lower(value.content_digest) - _UniffiConverterOptionalTypeCheckpointDigest.check_lower(value.previous_digest) - _UniffiConverterTypeGasCostSummary.check_lower(value.epoch_rolling_gas_cost_summary) - _UniffiConverterUInt64.check_lower(value.timestamp_ms) - _UniffiConverterSequenceTypeCheckpointCommitment.check_lower(value.checkpoint_commitments) - _UniffiConverterOptionalTypeEndOfEpochData.check_lower(value.end_of_epoch_data) - _UniffiConverterBytes.check_lower(value.version_specific_data) - - @staticmethod - def write(value, buf): - _UniffiConverterUInt64.write(value.epoch, buf) - _UniffiConverterUInt64.write(value.sequence_number, buf) - _UniffiConverterUInt64.write(value.network_total_transactions, buf) - _UniffiConverterTypeCheckpointContentsDigest.write(value.content_digest, buf) - _UniffiConverterOptionalTypeCheckpointDigest.write(value.previous_digest, buf) - _UniffiConverterTypeGasCostSummary.write(value.epoch_rolling_gas_cost_summary, buf) - _UniffiConverterUInt64.write(value.timestamp_ms, buf) - _UniffiConverterSequenceTypeCheckpointCommitment.write(value.checkpoint_commitments, buf) - _UniffiConverterOptionalTypeEndOfEpochData.write(value.end_of_epoch_data, buf) - _UniffiConverterBytes.write(value.version_specific_data, buf) - - -class Coin: - coin_type: "TypeTag" - id: "ObjectId" - balance: "int" - def __init__(self, *, coin_type: "TypeTag", id: "ObjectId", balance: "int"): - self.coin_type = coin_type - self.id = id - self.balance = balance - - def __str__(self): - return "Coin(coin_type={}, id={}, balance={})".format(self.coin_type, self.id, self.balance) - - def __eq__(self, other): - if self.coin_type != other.coin_type: - return False - if self.id != other.id: - return False - if self.balance != other.balance: - return False - return True - -class _UniffiConverterTypeCoin(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return Coin( - coin_type=_UniffiConverterTypeTypeTag.read(buf), - id=_UniffiConverterTypeObjectId.read(buf), - balance=_UniffiConverterUInt64.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeTypeTag.check_lower(value.coin_type) - _UniffiConverterTypeObjectId.check_lower(value.id) - _UniffiConverterUInt64.check_lower(value.balance) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeTypeTag.write(value.coin_type, buf) - _UniffiConverterTypeObjectId.write(value.id, buf) - _UniffiConverterUInt64.write(value.balance, buf) - - -class ConsensusCommitPrologueV1: - """ - V1 of the consensus commit prologue system transaction - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - consensus-commit-prologue-v1 = u64 u64 (option u64) u64 digest - consensus-determined-version-assignments - ``` - """ - - epoch: "int" - """ - Epoch of the commit prologue transaction - """ - - round: "int" - """ - Consensus round of the commit - """ - - sub_dag_index: "typing.Optional[int]" - """ - The sub DAG index of the consensus commit. This field will be populated - if there are multiple consensus commits per round. - """ - - commit_timestamp_ms: "int" - """ - Unix timestamp from consensus - """ - - consensus_commit_digest: "ConsensusCommitDigest" - """ - Digest of consensus output - """ - - consensus_determined_version_assignments: "ConsensusDeterminedVersionAssignments" - """ - Stores consensus handler determined shared object version assignments. - """ - - def __init__(self, *, epoch: "int", round: "int", sub_dag_index: "typing.Optional[int]", commit_timestamp_ms: "int", consensus_commit_digest: "ConsensusCommitDigest", consensus_determined_version_assignments: "ConsensusDeterminedVersionAssignments"): - self.epoch = epoch - self.round = round - self.sub_dag_index = sub_dag_index - self.commit_timestamp_ms = commit_timestamp_ms - self.consensus_commit_digest = consensus_commit_digest - self.consensus_determined_version_assignments = consensus_determined_version_assignments - - def __str__(self): - return "ConsensusCommitPrologueV1(epoch={}, round={}, sub_dag_index={}, commit_timestamp_ms={}, consensus_commit_digest={}, consensus_determined_version_assignments={})".format(self.epoch, self.round, self.sub_dag_index, self.commit_timestamp_ms, self.consensus_commit_digest, self.consensus_determined_version_assignments) - - def __eq__(self, other): - if self.epoch != other.epoch: - return False - if self.round != other.round: - return False - if self.sub_dag_index != other.sub_dag_index: - return False - if self.commit_timestamp_ms != other.commit_timestamp_ms: - return False - if self.consensus_commit_digest != other.consensus_commit_digest: - return False - if self.consensus_determined_version_assignments != other.consensus_determined_version_assignments: - return False - return True - -class _UniffiConverterTypeConsensusCommitPrologueV1(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return ConsensusCommitPrologueV1( - epoch=_UniffiConverterUInt64.read(buf), - round=_UniffiConverterUInt64.read(buf), - sub_dag_index=_UniffiConverterOptionalUInt64.read(buf), - commit_timestamp_ms=_UniffiConverterUInt64.read(buf), - consensus_commit_digest=_UniffiConverterTypeConsensusCommitDigest.read(buf), - consensus_determined_version_assignments=_UniffiConverterTypeConsensusDeterminedVersionAssignments.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterUInt64.check_lower(value.epoch) - _UniffiConverterUInt64.check_lower(value.round) - _UniffiConverterOptionalUInt64.check_lower(value.sub_dag_index) - _UniffiConverterUInt64.check_lower(value.commit_timestamp_ms) - _UniffiConverterTypeConsensusCommitDigest.check_lower(value.consensus_commit_digest) - _UniffiConverterTypeConsensusDeterminedVersionAssignments.check_lower(value.consensus_determined_version_assignments) - - @staticmethod - def write(value, buf): - _UniffiConverterUInt64.write(value.epoch, buf) - _UniffiConverterUInt64.write(value.round, buf) - _UniffiConverterOptionalUInt64.write(value.sub_dag_index, buf) - _UniffiConverterUInt64.write(value.commit_timestamp_ms, buf) - _UniffiConverterTypeConsensusCommitDigest.write(value.consensus_commit_digest, buf) - _UniffiConverterTypeConsensusDeterminedVersionAssignments.write(value.consensus_determined_version_assignments, buf) - - -class EndOfEpochData: - """ - Data, which when included in a [`CheckpointSummary`], signals the end of an - `Epoch`. - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - end-of-epoch-data = (vector validator-committee-member) ; next_epoch_committee - u64 ; next_epoch_protocol_version - (vector checkpoint-commitment) ; epoch_commitments - ``` - """ - - next_epoch_committee: "typing.List[ValidatorCommitteeMember]" - """ - The set of Validators that will be in the ValidatorCommittee for the - next epoch. - """ - - next_epoch_protocol_version: "int" - """ - The protocol version that is in effect during the next epoch. - """ - - epoch_commitments: "typing.List[CheckpointCommitment]" - """ - Commitments to epoch specific state (e.g. live object set) - """ - - epoch_supply_change: "int" - """ - The number of tokens that were minted (if positive) or burnt (if - negative) in this epoch. - """ - - def __init__(self, *, next_epoch_committee: "typing.List[ValidatorCommitteeMember]", next_epoch_protocol_version: "int", epoch_commitments: "typing.List[CheckpointCommitment]", epoch_supply_change: "int"): - self.next_epoch_committee = next_epoch_committee - self.next_epoch_protocol_version = next_epoch_protocol_version - self.epoch_commitments = epoch_commitments - self.epoch_supply_change = epoch_supply_change - - def __str__(self): - return "EndOfEpochData(next_epoch_committee={}, next_epoch_protocol_version={}, epoch_commitments={}, epoch_supply_change={})".format(self.next_epoch_committee, self.next_epoch_protocol_version, self.epoch_commitments, self.epoch_supply_change) - - def __eq__(self, other): - if self.next_epoch_committee != other.next_epoch_committee: - return False - if self.next_epoch_protocol_version != other.next_epoch_protocol_version: - return False - if self.epoch_commitments != other.epoch_commitments: - return False - if self.epoch_supply_change != other.epoch_supply_change: - return False - return True - -class _UniffiConverterTypeEndOfEpochData(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return EndOfEpochData( - next_epoch_committee=_UniffiConverterSequenceTypeValidatorCommitteeMember.read(buf), - next_epoch_protocol_version=_UniffiConverterUInt64.read(buf), - epoch_commitments=_UniffiConverterSequenceTypeCheckpointCommitment.read(buf), - epoch_supply_change=_UniffiConverterInt64.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterSequenceTypeValidatorCommitteeMember.check_lower(value.next_epoch_committee) - _UniffiConverterUInt64.check_lower(value.next_epoch_protocol_version) - _UniffiConverterSequenceTypeCheckpointCommitment.check_lower(value.epoch_commitments) - _UniffiConverterInt64.check_lower(value.epoch_supply_change) - - @staticmethod - def write(value, buf): - _UniffiConverterSequenceTypeValidatorCommitteeMember.write(value.next_epoch_committee, buf) - _UniffiConverterUInt64.write(value.next_epoch_protocol_version, buf) - _UniffiConverterSequenceTypeCheckpointCommitment.write(value.epoch_commitments, buf) - _UniffiConverterInt64.write(value.epoch_supply_change, buf) - - -class Event: - """ - An event - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - event = object-id identifier address struct-tag bytes - ``` - """ - - package_id: "ObjectId" - """ - Package id of the top-level function invoked by a MoveCall command which - triggered this event to be emitted. - """ - - module: "Identifier" - """ - Module name of the top-level function invoked by a MoveCall command - which triggered this event to be emitted. - """ - - sender: "Address" - """ - Address of the account that sent the transaction where this event was - emitted. - """ - - type: "StructTag" - """ - The type of the event emitted - """ - - contents: "bytes" - """ - BCS serialized bytes of the event - """ - - def __init__(self, *, package_id: "ObjectId", module: "Identifier", sender: "Address", type: "StructTag", contents: "bytes"): - self.package_id = package_id - self.module = module - self.sender = sender - self.type = type - self.contents = contents - - def __str__(self): - return "Event(package_id={}, module={}, sender={}, type={}, contents={})".format(self.package_id, self.module, self.sender, self.type, self.contents) - - def __eq__(self, other): - if self.package_id != other.package_id: - return False - if self.module != other.module: - return False - if self.sender != other.sender: - return False - if self.type != other.type: - return False - if self.contents != other.contents: - return False - return True - -class _UniffiConverterTypeEvent(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return Event( - package_id=_UniffiConverterTypeObjectId.read(buf), - module=_UniffiConverterTypeIdentifier.read(buf), - sender=_UniffiConverterTypeAddress.read(buf), - type=_UniffiConverterTypeStructTag.read(buf), - contents=_UniffiConverterBytes.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeObjectId.check_lower(value.package_id) - _UniffiConverterTypeIdentifier.check_lower(value.module) - _UniffiConverterTypeAddress.check_lower(value.sender) - _UniffiConverterTypeStructTag.check_lower(value.type) - _UniffiConverterBytes.check_lower(value.contents) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeObjectId.write(value.package_id, buf) - _UniffiConverterTypeIdentifier.write(value.module, buf) - _UniffiConverterTypeAddress.write(value.sender, buf) - _UniffiConverterTypeStructTag.write(value.type, buf) - _UniffiConverterBytes.write(value.contents, buf) - - -class GasCostSummary: - """ - Summary of gas charges. - - Storage is charged independently of computation. - There are 3 parts to the storage charges: - `storage_cost`: it is the charge of storage at the time the transaction is - executed. The cost of storage is the number of bytes of the - objects being mutated multiplied by a variable storage cost - per byte `storage_rebate`: this is the amount a user gets back when - manipulating an object. The `storage_rebate` is the - `storage_cost` for an object minus fees. `non_refundable_storage_fee`: not - all the value of the object storage cost is - given back to user and there is a small fraction that - is kept by the system. This value tracks that charge. - - When looking at a gas cost summary the amount charged to the user is - `computation_cost + storage_cost - storage_rebate` - and that is the amount that is deducted from the gas coins. - `non_refundable_storage_fee` is collected from the objects being - mutated/deleted and it is tracked by the system in storage funds. - - Objects deleted, including the older versions of objects mutated, have the - storage field on the objects added up to a pool of "potential rebate". This - rebate then is reduced by the "nonrefundable rate" such that: - `potential_rebate(storage cost of deleted/mutated objects) = - storage_rebate + non_refundable_storage_fee` - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - gas-cost-summary = u64 ; computation-cost - u64 ; storage-cost - u64 ; storage-rebate - u64 ; non-refundable-storage-fee - ``` - """ - - computation_cost: "int" - """ - Cost of computation/execution - """ - - computation_cost_burned: "int" - """ - The burned component of the computation/execution costs - """ - - storage_cost: "int" - """ - Storage cost, it's the sum of all storage cost for all objects created - or mutated. - """ - - storage_rebate: "int" - """ - The amount of storage cost refunded to the user for all objects deleted - or mutated in the transaction. - """ - - non_refundable_storage_fee: "int" - """ - The fee for the rebate. The portion of the storage rebate kept by the - system. - """ - - def __init__(self, *, computation_cost: "int", computation_cost_burned: "int", storage_cost: "int", storage_rebate: "int", non_refundable_storage_fee: "int"): - self.computation_cost = computation_cost - self.computation_cost_burned = computation_cost_burned - self.storage_cost = storage_cost - self.storage_rebate = storage_rebate - self.non_refundable_storage_fee = non_refundable_storage_fee - - def __str__(self): - return "GasCostSummary(computation_cost={}, computation_cost_burned={}, storage_cost={}, storage_rebate={}, non_refundable_storage_fee={})".format(self.computation_cost, self.computation_cost_burned, self.storage_cost, self.storage_rebate, self.non_refundable_storage_fee) - - def __eq__(self, other): - if self.computation_cost != other.computation_cost: - return False - if self.computation_cost_burned != other.computation_cost_burned: - return False - if self.storage_cost != other.storage_cost: - return False - if self.storage_rebate != other.storage_rebate: - return False - if self.non_refundable_storage_fee != other.non_refundable_storage_fee: - return False - return True - -class _UniffiConverterTypeGasCostSummary(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return GasCostSummary( - computation_cost=_UniffiConverterUInt64.read(buf), - computation_cost_burned=_UniffiConverterUInt64.read(buf), - storage_cost=_UniffiConverterUInt64.read(buf), - storage_rebate=_UniffiConverterUInt64.read(buf), - non_refundable_storage_fee=_UniffiConverterUInt64.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterUInt64.check_lower(value.computation_cost) - _UniffiConverterUInt64.check_lower(value.computation_cost_burned) - _UniffiConverterUInt64.check_lower(value.storage_cost) - _UniffiConverterUInt64.check_lower(value.storage_rebate) - _UniffiConverterUInt64.check_lower(value.non_refundable_storage_fee) - - @staticmethod - def write(value, buf): - _UniffiConverterUInt64.write(value.computation_cost, buf) - _UniffiConverterUInt64.write(value.computation_cost_burned, buf) - _UniffiConverterUInt64.write(value.storage_cost, buf) - _UniffiConverterUInt64.write(value.storage_rebate, buf) - _UniffiConverterUInt64.write(value.non_refundable_storage_fee, buf) - - -class GasPayment: - """ - Payment information for executing a transaction - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - gas-payment = (vector object-ref) ; gas coin objects - address ; owner - u64 ; price - u64 ; budget - ``` - """ - - objects: "typing.List[ObjectReference]" - owner: "Address" - """ - Owner of the gas objects, either the transaction sender or a sponsor - """ - - price: "int" - """ - Gas unit price to use when charging for computation - - Must be greater-than-or-equal-to the network's current RGP (reference - gas price) - """ - - budget: "int" - """ - Total budget willing to spend for the execution of a transaction - """ - - def __init__(self, *, objects: "typing.List[ObjectReference]", owner: "Address", price: "int", budget: "int"): - self.objects = objects - self.owner = owner - self.price = price - self.budget = budget - - def __str__(self): - return "GasPayment(objects={}, owner={}, price={}, budget={})".format(self.objects, self.owner, self.price, self.budget) - - def __eq__(self, other): - if self.objects != other.objects: - return False - if self.owner != other.owner: - return False - if self.price != other.price: - return False - if self.budget != other.budget: - return False - return True - -class _UniffiConverterTypeGasPayment(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return GasPayment( - objects=_UniffiConverterSequenceTypeObjectReference.read(buf), - owner=_UniffiConverterTypeAddress.read(buf), - price=_UniffiConverterUInt64.read(buf), - budget=_UniffiConverterUInt64.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterSequenceTypeObjectReference.check_lower(value.objects) - _UniffiConverterTypeAddress.check_lower(value.owner) - _UniffiConverterUInt64.check_lower(value.price) - _UniffiConverterUInt64.check_lower(value.budget) - - @staticmethod - def write(value, buf): - _UniffiConverterSequenceTypeObjectReference.write(value.objects, buf) - _UniffiConverterTypeAddress.write(value.owner, buf) - _UniffiConverterUInt64.write(value.price, buf) - _UniffiConverterUInt64.write(value.budget, buf) - - -class GenesisObject: - """ - An object part of the initial chain state - - `GenesisObject`'s are included as a part of genesis, the initial - checkpoint/transaction, that initializes the state of the blockchain. - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - genesis-object = object-data owner - ``` - """ - - data: "ObjectData" - owner: "Owner" - def __init__(self, *, data: "ObjectData", owner: "Owner"): - self.data = data - self.owner = owner - - def __str__(self): - return "GenesisObject(data={}, owner={})".format(self.data, self.owner) - - def __eq__(self, other): - if self.data != other.data: - return False - if self.owner != other.owner: - return False - return True - -class _UniffiConverterTypeGenesisObject(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return GenesisObject( - data=_UniffiConverterTypeObjectData.read(buf), - owner=_UniffiConverterTypeOwner.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeObjectData.check_lower(value.data) - _UniffiConverterTypeOwner.check_lower(value.owner) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeObjectData.write(value.data, buf) - _UniffiConverterTypeOwner.write(value.owner, buf) - - -class GenesisTransaction: - """ - The genesis transaction - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - genesis-transaction = (vector genesis-object) - ``` - """ - - objects: "typing.List[GenesisObject]" - events: "typing.List[Event]" - def __init__(self, *, objects: "typing.List[GenesisObject]", events: "typing.List[Event]"): - self.objects = objects - self.events = events - - def __str__(self): - return "GenesisTransaction(objects={}, events={})".format(self.objects, self.events) - - def __eq__(self, other): - if self.objects != other.objects: - return False - if self.events != other.events: - return False - return True - -class _UniffiConverterTypeGenesisTransaction(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return GenesisTransaction( - objects=_UniffiConverterSequenceTypeGenesisObject.read(buf), - events=_UniffiConverterSequenceTypeEvent.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterSequenceTypeGenesisObject.check_lower(value.objects) - _UniffiConverterSequenceTypeEvent.check_lower(value.events) - - @staticmethod - def write(value, buf): - _UniffiConverterSequenceTypeGenesisObject.write(value.objects, buf) - _UniffiConverterSequenceTypeEvent.write(value.events, buf) - - -class Jwk: - """ - A JSON Web Key - - Struct that contains info for a JWK. A list of them for different kids can - be retrieved from the JWK endpoint (e.g. ). - The JWK is used to verify the JWT token. - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - jwk = string string string string - ``` - """ - - kty: "str" - """ - Key type parameter, - """ - - e: "str" - """ - RSA public exponent, - """ - - n: "str" - """ - RSA modulus, - """ - - alg: "str" - """ - Algorithm parameter, - """ - - def __init__(self, *, kty: "str", e: "str", n: "str", alg: "str"): - self.kty = kty - self.e = e - self.n = n - self.alg = alg - - def __str__(self): - return "Jwk(kty={}, e={}, n={}, alg={})".format(self.kty, self.e, self.n, self.alg) - - def __eq__(self, other): - if self.kty != other.kty: - return False - if self.e != other.e: - return False - if self.n != other.n: - return False - if self.alg != other.alg: - return False - return True - -class _UniffiConverterTypeJwk(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return Jwk( - kty=_UniffiConverterString.read(buf), - e=_UniffiConverterString.read(buf), - n=_UniffiConverterString.read(buf), - alg=_UniffiConverterString.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterString.check_lower(value.kty) - _UniffiConverterString.check_lower(value.e) - _UniffiConverterString.check_lower(value.n) - _UniffiConverterString.check_lower(value.alg) - - @staticmethod - def write(value, buf): - _UniffiConverterString.write(value.kty, buf) - _UniffiConverterString.write(value.e, buf) - _UniffiConverterString.write(value.n, buf) - _UniffiConverterString.write(value.alg, buf) - - -class JwkId: - """ - Key to uniquely identify a JWK - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - jwk-id = string string - ``` - """ - - iss: "str" - """ - The issuer or identity of the OIDC provider. - """ - - kid: "str" - """ - A key id use to uniquely identify a key from an OIDC provider. - """ - - def __init__(self, *, iss: "str", kid: "str"): - self.iss = iss - self.kid = kid - - def __str__(self): - return "JwkId(iss={}, kid={})".format(self.iss, self.kid) - - def __eq__(self, other): - if self.iss != other.iss: - return False - if self.kid != other.kid: - return False - return True - -class _UniffiConverterTypeJwkId(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return JwkId( - iss=_UniffiConverterString.read(buf), - kid=_UniffiConverterString.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterString.check_lower(value.iss) - _UniffiConverterString.check_lower(value.kid) - - @staticmethod - def write(value, buf): - _UniffiConverterString.write(value.iss, buf) - _UniffiConverterString.write(value.kid, buf) - - -class MakeMoveVector: - """ - Command to build a move vector out of a set of individual elements - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - make-move-vector = (option type-tag) (vector argument) - ``` - """ - - type: "typing.Optional[TypeTag]" - """ - Type of the individual elements - - This is required to be set when the type can't be inferred, for example - when the set of provided arguments are all pure input values. - """ - - elements: "typing.List[Argument]" - """ - The set individual elements to build the vector with - """ - - def __init__(self, *, type: "typing.Optional[TypeTag]", elements: "typing.List[Argument]"): - self.type = type - self.elements = elements - - def __str__(self): - return "MakeMoveVector(type={}, elements={})".format(self.type, self.elements) - - def __eq__(self, other): - if self.type != other.type: - return False - if self.elements != other.elements: - return False - return True - -class _UniffiConverterTypeMakeMoveVector(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return MakeMoveVector( - type=_UniffiConverterOptionalTypeTypeTag.read(buf), - elements=_UniffiConverterSequenceTypeArgument.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterOptionalTypeTypeTag.check_lower(value.type) - _UniffiConverterSequenceTypeArgument.check_lower(value.elements) - - @staticmethod - def write(value, buf): - _UniffiConverterOptionalTypeTypeTag.write(value.type, buf) - _UniffiConverterSequenceTypeArgument.write(value.elements, buf) - - -class MergeCoins: - """ - Command to merge multiple coins of the same type into a single coin - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - merge-coins = argument (vector argument) - ``` - """ - - coin: "Argument" - """ - Coin to merge coins into - """ - - coins_to_merge: "typing.List[Argument]" - """ - Set of coins to merge into `coin` - - All listed coins must be of the same type and be the same type as `coin` - """ - - def __init__(self, *, coin: "Argument", coins_to_merge: "typing.List[Argument]"): - self.coin = coin - self.coins_to_merge = coins_to_merge - - def __str__(self): - return "MergeCoins(coin={}, coins_to_merge={})".format(self.coin, self.coins_to_merge) - - def __eq__(self, other): - if self.coin != other.coin: - return False - if self.coins_to_merge != other.coins_to_merge: - return False - return True - -class _UniffiConverterTypeMergeCoins(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return MergeCoins( - coin=_UniffiConverterTypeArgument.read(buf), - coins_to_merge=_UniffiConverterSequenceTypeArgument.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeArgument.check_lower(value.coin) - _UniffiConverterSequenceTypeArgument.check_lower(value.coins_to_merge) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeArgument.write(value.coin, buf) - _UniffiConverterSequenceTypeArgument.write(value.coins_to_merge, buf) - - -class MoveCall: - """ - Command to call a move function - - Functions that can be called by a `MoveCall` command are those that have a - function signature that is either `entry` or `public` (which don't have a - reference return type). - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - move-call = object-id ; package id - identifier ; module name - identifier ; function name - (vector type-tag) ; type arguments, if any - (vector argument) ; input arguments - ``` - """ - - package: "ObjectId" - """ - The package containing the module and function. - """ - - module: "Identifier" - """ - The specific module in the package containing the function. - """ - - function: "Identifier" - """ - The function to be called. - """ - - type_arguments: "typing.List[TypeTag]" - """ - The type arguments to the function. - """ - - arguments: "typing.List[Argument]" - """ - The arguments to the function. - """ - - def __init__(self, *, package: "ObjectId", module: "Identifier", function: "Identifier", type_arguments: "typing.List[TypeTag]", arguments: "typing.List[Argument]"): - self.package = package - self.module = module - self.function = function - self.type_arguments = type_arguments - self.arguments = arguments - - def __str__(self): - return "MoveCall(package={}, module={}, function={}, type_arguments={}, arguments={})".format(self.package, self.module, self.function, self.type_arguments, self.arguments) - - def __eq__(self, other): - if self.package != other.package: - return False - if self.module != other.module: - return False - if self.function != other.function: - return False - if self.type_arguments != other.type_arguments: - return False - if self.arguments != other.arguments: - return False - return True - -class _UniffiConverterTypeMoveCall(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return MoveCall( - package=_UniffiConverterTypeObjectId.read(buf), - module=_UniffiConverterTypeIdentifier.read(buf), - function=_UniffiConverterTypeIdentifier.read(buf), - type_arguments=_UniffiConverterSequenceTypeTypeTag.read(buf), - arguments=_UniffiConverterSequenceTypeArgument.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeObjectId.check_lower(value.package) - _UniffiConverterTypeIdentifier.check_lower(value.module) - _UniffiConverterTypeIdentifier.check_lower(value.function) - _UniffiConverterSequenceTypeTypeTag.check_lower(value.type_arguments) - _UniffiConverterSequenceTypeArgument.check_lower(value.arguments) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeObjectId.write(value.package, buf) - _UniffiConverterTypeIdentifier.write(value.module, buf) - _UniffiConverterTypeIdentifier.write(value.function, buf) - _UniffiConverterSequenceTypeTypeTag.write(value.type_arguments, buf) - _UniffiConverterSequenceTypeArgument.write(value.arguments, buf) - - -class MoveLocation: - """ - Location in move bytecode where an error occurred - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - move-location = object-id identifier u16 u16 (option identifier) - ``` - """ - - package: "ObjectId" - """ - The package id - """ - - module: "Identifier" - """ - The module name - """ - - function: "int" - """ - The function index - """ - - instruction: "int" - """ - Index into the code stream for a jump. The offset is relative to the - beginning of the instruction stream. - """ - - function_name: "typing.Optional[Identifier]" - """ - The name of the function if available - """ - - def __init__(self, *, package: "ObjectId", module: "Identifier", function: "int", instruction: "int", function_name: "typing.Optional[Identifier]"): - self.package = package - self.module = module - self.function = function - self.instruction = instruction - self.function_name = function_name - - def __str__(self): - return "MoveLocation(package={}, module={}, function={}, instruction={}, function_name={})".format(self.package, self.module, self.function, self.instruction, self.function_name) - - def __eq__(self, other): - if self.package != other.package: - return False - if self.module != other.module: - return False - if self.function != other.function: - return False - if self.instruction != other.instruction: - return False - if self.function_name != other.function_name: - return False - return True - -class _UniffiConverterTypeMoveLocation(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return MoveLocation( - package=_UniffiConverterTypeObjectId.read(buf), - module=_UniffiConverterTypeIdentifier.read(buf), - function=_UniffiConverterUInt16.read(buf), - instruction=_UniffiConverterUInt16.read(buf), - function_name=_UniffiConverterOptionalTypeIdentifier.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeObjectId.check_lower(value.package) - _UniffiConverterTypeIdentifier.check_lower(value.module) - _UniffiConverterUInt16.check_lower(value.function) - _UniffiConverterUInt16.check_lower(value.instruction) - _UniffiConverterOptionalTypeIdentifier.check_lower(value.function_name) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeObjectId.write(value.package, buf) - _UniffiConverterTypeIdentifier.write(value.module, buf) - _UniffiConverterUInt16.write(value.function, buf) - _UniffiConverterUInt16.write(value.instruction, buf) - _UniffiConverterOptionalTypeIdentifier.write(value.function_name, buf) - - -class MoveStruct: - """ - A move struct - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - object-move-struct = compressed-struct-tag bool u64 object-contents - - compressed-struct-tag = other-struct-type / gas-coin-type / staked-iota-type / coin-type - other-struct-type = %x00 struct-tag - gas-coin-type = %x01 - staked-iota-type = %x02 - coin-type = %x03 type-tag - - ; first 32 bytes of the contents are the object's object-id - object-contents = uleb128 (object-id *OCTET) ; length followed by contents - ``` - """ - - type: "StructTag" - """ - The type of this object - """ - - version: "int" - """ - Number that increases each time a tx takes this object as a mutable - input This is a lamport timestamp, not a sequentially increasing - version - """ - - contents: "bytes" - """ - BCS bytes of a Move struct value - """ - - def __init__(self, *, type: "StructTag", version: "int", contents: "bytes"): - self.type = type - self.version = version - self.contents = contents - - def __str__(self): - return "MoveStruct(type={}, version={}, contents={})".format(self.type, self.version, self.contents) - - def __eq__(self, other): - if self.type != other.type: - return False - if self.version != other.version: - return False - if self.contents != other.contents: - return False - return True - -class _UniffiConverterTypeMoveStruct(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return MoveStruct( - type=_UniffiConverterTypeStructTag.read(buf), - version=_UniffiConverterUInt64.read(buf), - contents=_UniffiConverterBytes.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeStructTag.check_lower(value.type) - _UniffiConverterUInt64.check_lower(value.version) - _UniffiConverterBytes.check_lower(value.contents) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeStructTag.write(value.type, buf) - _UniffiConverterUInt64.write(value.version, buf) - _UniffiConverterBytes.write(value.contents, buf) - - -class MultisigAggregatedSignature: - """ - Aggregated signature from members of a multisig committee. - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - multisig-aggregated-signature = (vector multisig-member-signature) - u16 ; bitmap - multisig-committee - ``` - - There is also a legacy encoding for this type defined as: - - ```text - legacy-multisig-aggregated-signature = (vector multisig-member-signature) - roaring-bitmap ; bitmap - legacy-multisig-committee - roaring-bitmap = bytes ; where the contents of the bytes are valid - ; according to the serialized spec for - ; roaring bitmaps - ``` - - See [here](https://github.com/RoaringBitmap/RoaringFormatSpec) for the specification for the - serialized format of RoaringBitmaps. - """ - - signatures: "typing.List[MultisigMemberSignature]" - """ - The plain signature encoded with signature scheme. - - The signatures must be in the same order as they are listed in the - committee. - """ - - bitmap: "int" - """ - A bitmap that indicates the position of which public key the signature - should be authenticated with. - """ - - committee: "MultisigCommittee" - """ - The public key encoded with each public key with its signature scheme - used along with the corresponding weight. - """ - - def __init__(self, *, signatures: "typing.List[MultisigMemberSignature]", bitmap: "int", committee: "MultisigCommittee"): - self.signatures = signatures - self.bitmap = bitmap - self.committee = committee - - def __str__(self): - return "MultisigAggregatedSignature(signatures={}, bitmap={}, committee={})".format(self.signatures, self.bitmap, self.committee) - - def __eq__(self, other): - if self.signatures != other.signatures: - return False - if self.bitmap != other.bitmap: - return False - if self.committee != other.committee: - return False - return True - -class _UniffiConverterTypeMultisigAggregatedSignature(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return MultisigAggregatedSignature( - signatures=_UniffiConverterSequenceTypeMultisigMemberSignature.read(buf), - bitmap=_UniffiConverterUInt16.read(buf), - committee=_UniffiConverterTypeMultisigCommittee.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterSequenceTypeMultisigMemberSignature.check_lower(value.signatures) - _UniffiConverterUInt16.check_lower(value.bitmap) - _UniffiConverterTypeMultisigCommittee.check_lower(value.committee) - - @staticmethod - def write(value, buf): - _UniffiConverterSequenceTypeMultisigMemberSignature.write(value.signatures, buf) - _UniffiConverterUInt16.write(value.bitmap, buf) - _UniffiConverterTypeMultisigCommittee.write(value.committee, buf) - - -class MultisigCommittee: - """ - A multisig committee - - A `MultisigCommittee` is a set of members who collectively control a single - `Address` on the IOTA blockchain. The number of required signautres to - authorize the execution of a transaction is determined by - `(signature_0_weight + signature_1_weight ..) >= threshold`. - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - multisig-committee = (vector multisig-member) - u16 ; threshold - ``` - - There is also a legacy encoding for this type defined as: - - ```text - legacy-multisig-committee = (vector legacy-multisig-member) - u16 ; threshold - ``` - """ - - members: "typing.List[MultisigMember]" - """ - A list of committee members and their corresponding weight. - """ - - threshold: "int" - """ - If the total weight of the public keys corresponding to verified - signatures is larger than threshold, the Multisig is verified. - """ - - def __init__(self, *, members: "typing.List[MultisigMember]", threshold: "int"): - self.members = members - self.threshold = threshold - - def __str__(self): - return "MultisigCommittee(members={}, threshold={})".format(self.members, self.threshold) - - def __eq__(self, other): - if self.members != other.members: - return False - if self.threshold != other.threshold: - return False - return True - -class _UniffiConverterTypeMultisigCommittee(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return MultisigCommittee( - members=_UniffiConverterSequenceTypeMultisigMember.read(buf), - threshold=_UniffiConverterUInt16.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterSequenceTypeMultisigMember.check_lower(value.members) - _UniffiConverterUInt16.check_lower(value.threshold) - - @staticmethod - def write(value, buf): - _UniffiConverterSequenceTypeMultisigMember.write(value.members, buf) - _UniffiConverterUInt16.write(value.threshold, buf) - - -class MultisigMember: - """ - A member in a multisig committee - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - multisig-member = multisig-member-public-key - u8 ; weight - ``` - - There is also a legacy encoding for this type defined as: - - ```text - legacy-multisig-member = legacy-multisig-member-public-key - u8 ; weight - ``` - """ - - public_key: "MultisigMemberPublicKey" - weight: "int" - def __init__(self, *, public_key: "MultisigMemberPublicKey", weight: "int"): - self.public_key = public_key - self.weight = weight - - def __str__(self): - return "MultisigMember(public_key={}, weight={})".format(self.public_key, self.weight) - - def __eq__(self, other): - if self.public_key != other.public_key: - return False - if self.weight != other.weight: - return False - return True - -class _UniffiConverterTypeMultisigMember(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return MultisigMember( - public_key=_UniffiConverterTypeMultisigMemberPublicKey.read(buf), - weight=_UniffiConverterUInt8.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeMultisigMemberPublicKey.check_lower(value.public_key) - _UniffiConverterUInt8.check_lower(value.weight) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeMultisigMemberPublicKey.write(value.public_key, buf) - _UniffiConverterUInt8.write(value.weight, buf) - - -class Object: - """ - An object on the IOTA blockchain - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - object = object-data owner digest u64 - ``` - """ - - data: "ObjectData" - """ - The meat of the object - """ - - owner: "Owner" - """ - The owner that unlocks this object - """ - - previous_transaction: "TransactionDigest" - """ - The digest of the transaction that created or last mutated this object - """ - - storage_rebate: "int" - """ - The amount of IOTA we would rebate if this object gets deleted. - This number is re-calculated each time the object is mutated based on - the present storage gas price. - """ - - def __init__(self, *, data: "ObjectData", owner: "Owner", previous_transaction: "TransactionDigest", storage_rebate: "int"): - self.data = data - self.owner = owner - self.previous_transaction = previous_transaction - self.storage_rebate = storage_rebate - - def __str__(self): - return "Object(data={}, owner={}, previous_transaction={}, storage_rebate={})".format(self.data, self.owner, self.previous_transaction, self.storage_rebate) - - def __eq__(self, other): - if self.data != other.data: - return False - if self.owner != other.owner: - return False - if self.previous_transaction != other.previous_transaction: - return False - if self.storage_rebate != other.storage_rebate: - return False - return True - -class _UniffiConverterTypeObject(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return Object( - data=_UniffiConverterTypeObjectData.read(buf), - owner=_UniffiConverterTypeOwner.read(buf), - previous_transaction=_UniffiConverterTypeTransactionDigest.read(buf), - storage_rebate=_UniffiConverterUInt64.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeObjectData.check_lower(value.data) - _UniffiConverterTypeOwner.check_lower(value.owner) - _UniffiConverterTypeTransactionDigest.check_lower(value.previous_transaction) - _UniffiConverterUInt64.check_lower(value.storage_rebate) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeObjectData.write(value.data, buf) - _UniffiConverterTypeOwner.write(value.owner, buf) - _UniffiConverterTypeTransactionDigest.write(value.previous_transaction, buf) - _UniffiConverterUInt64.write(value.storage_rebate, buf) - - -class ObjectReference: - """ - Reference to an object - - Contains sufficient information to uniquely identify a specific object. - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - object-ref = object-id u64 digest - ``` - """ - - object_id: "ObjectId" - """ - The object id of this object. - """ - - version: "int" - """ - The version of this object. - """ - - digest: "ObjectDigest" - """ - The digest of this object. - """ - - def __init__(self, *, object_id: "ObjectId", version: "int", digest: "ObjectDigest"): - self.object_id = object_id - self.version = version - self.digest = digest - - def __str__(self): - return "ObjectReference(object_id={}, version={}, digest={})".format(self.object_id, self.version, self.digest) - - def __eq__(self, other): - if self.object_id != other.object_id: - return False - if self.version != other.version: - return False - if self.digest != other.digest: - return False - return True - -class _UniffiConverterTypeObjectReference(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return ObjectReference( - object_id=_UniffiConverterTypeObjectId.read(buf), - version=_UniffiConverterUInt64.read(buf), - digest=_UniffiConverterTypeObjectDigest.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeObjectId.check_lower(value.object_id) - _UniffiConverterUInt64.check_lower(value.version) - _UniffiConverterTypeObjectDigest.check_lower(value.digest) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeObjectId.write(value.object_id, buf) - _UniffiConverterUInt64.write(value.version, buf) - _UniffiConverterTypeObjectDigest.write(value.digest, buf) - - -class PasskeyAuthenticator: - """ - A passkey authenticator. - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - passkey-bcs = bytes ; where the contents of the bytes are - ; defined by - passkey = passkey-flag - bytes ; passkey authenticator data - client-data-json ; valid json - simple-signature ; required to be a secp256r1 signature - - client-data-json = string ; valid json - ``` - - See [CollectedClientData](https://www.w3.org/TR/webauthn-2/#dictdef-collectedclientdata) for - the required json-schema for the `client-data-json` rule. In addition, IOTA - currently requires that the `CollectedClientData.type` field is required to - be `webauthn.get`. - - Note: Due to historical reasons, signatures are serialized slightly - different from the majority of the types in IOTA. In particular if a - signature is ever embedded in another structure it generally is serialized - as `bytes` meaning it has a length prefix that defines the length of - the completely serialized signature. - """ - - public_key: "Secp256r1PublicKey" - """ - The secp256r1 public key for this passkey. - """ - - signature: "Secp256r1Signature" - """ - The secp256r1 signature from the passkey. - """ - - challenge: "bytes" - """ - Parsed base64url decoded challenge bytes from - `client_data_json.challenge`. - """ - - authenticator_data: "bytes" - """ - Opaque authenticator data for this passkey signature. - - See [Authenticator Data](https://www.w3.org/TR/webauthn-2/#sctn-authenticator-data) for - more information on this field. - """ - - client_data_json: "str" - """ - Structured, unparsed, JSON for this passkey signature. - - See [CollectedClientData](https://www.w3.org/TR/webauthn-2/#dictdef-collectedclientdata) - for more information on this field. - """ - - def __init__(self, *, public_key: "Secp256r1PublicKey", signature: "Secp256r1Signature", challenge: "bytes", authenticator_data: "bytes", client_data_json: "str"): - self.public_key = public_key - self.signature = signature - self.challenge = challenge - self.authenticator_data = authenticator_data - self.client_data_json = client_data_json - - def __str__(self): - return "PasskeyAuthenticator(public_key={}, signature={}, challenge={}, authenticator_data={}, client_data_json={})".format(self.public_key, self.signature, self.challenge, self.authenticator_data, self.client_data_json) - - def __eq__(self, other): - if self.public_key != other.public_key: - return False - if self.signature != other.signature: - return False - if self.challenge != other.challenge: - return False - if self.authenticator_data != other.authenticator_data: - return False - if self.client_data_json != other.client_data_json: - return False - return True - -class _UniffiConverterTypePasskeyAuthenticator(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return PasskeyAuthenticator( - public_key=_UniffiConverterTypeSecp256r1PublicKey.read(buf), - signature=_UniffiConverterTypeSecp256r1Signature.read(buf), - challenge=_UniffiConverterBytes.read(buf), - authenticator_data=_UniffiConverterBytes.read(buf), - client_data_json=_UniffiConverterString.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeSecp256r1PublicKey.check_lower(value.public_key) - _UniffiConverterTypeSecp256r1Signature.check_lower(value.signature) - _UniffiConverterBytes.check_lower(value.challenge) - _UniffiConverterBytes.check_lower(value.authenticator_data) - _UniffiConverterString.check_lower(value.client_data_json) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeSecp256r1PublicKey.write(value.public_key, buf) - _UniffiConverterTypeSecp256r1Signature.write(value.signature, buf) - _UniffiConverterBytes.write(value.challenge, buf) - _UniffiConverterBytes.write(value.authenticator_data, buf) - _UniffiConverterString.write(value.client_data_json, buf) - - -class ProgrammableTransaction: - """ - A user transaction - - Contains a series of native commands and move calls where the results of one - command can be used in future commands. - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - ptb = (vector input) (vector command) - ``` - """ - - inputs: "typing.List[Input]" - """ - Input objects or primitive values - """ - - commands: "typing.List[Command]" - """ - The commands to be executed sequentially. A failure in any command will - result in the failure of the entire transaction. - """ - - def __init__(self, *, inputs: "typing.List[Input]", commands: "typing.List[Command]"): - self.inputs = inputs - self.commands = commands - - def __str__(self): - return "ProgrammableTransaction(inputs={}, commands={})".format(self.inputs, self.commands) - - def __eq__(self, other): - if self.inputs != other.inputs: - return False - if self.commands != other.commands: - return False - return True - -class _UniffiConverterTypeProgrammableTransaction(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return ProgrammableTransaction( - inputs=_UniffiConverterSequenceTypeInput.read(buf), - commands=_UniffiConverterSequenceTypeCommand.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterSequenceTypeInput.check_lower(value.inputs) - _UniffiConverterSequenceTypeCommand.check_lower(value.commands) - - @staticmethod - def write(value, buf): - _UniffiConverterSequenceTypeInput.write(value.inputs, buf) - _UniffiConverterSequenceTypeCommand.write(value.commands, buf) - - -class Publish: - """ - Command to publish a new move package - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - publish = (vector bytes) ; the serialized move modules - (vector object-id) ; the set of package dependencies - ``` - """ - - modules: "typing.List[bytes]" - """ - The serialized move modules - """ - - dependencies: "typing.List[ObjectId]" - """ - Set of packages that the to-be published package depends on - """ - - def __init__(self, *, modules: "typing.List[bytes]", dependencies: "typing.List[ObjectId]"): - self.modules = modules - self.dependencies = dependencies - - def __str__(self): - return "Publish(modules={}, dependencies={})".format(self.modules, self.dependencies) - - def __eq__(self, other): - if self.modules != other.modules: - return False - if self.dependencies != other.dependencies: - return False - return True - -class _UniffiConverterTypePublish(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return Publish( - modules=_UniffiConverterSequenceBytes.read(buf), - dependencies=_UniffiConverterSequenceTypeObjectId.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterSequenceBytes.check_lower(value.modules) - _UniffiConverterSequenceTypeObjectId.check_lower(value.dependencies) - - @staticmethod - def write(value, buf): - _UniffiConverterSequenceBytes.write(value.modules, buf) - _UniffiConverterSequenceTypeObjectId.write(value.dependencies, buf) - - -class RandomnessStateUpdate: - """ - Randomness update - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - randomness-state-update = u64 u64 bytes u64 - ``` - """ - - epoch: "int" - """ - Epoch of the randomness state update transaction - """ - - randomness_round: "int" - """ - Randomness round of the update - """ - - random_bytes: "bytes" - """ - Updated random bytes - """ - - randomness_obj_initial_shared_version: "int" - """ - The initial version of the randomness object that it was shared at. - """ - - def __init__(self, *, epoch: "int", randomness_round: "int", random_bytes: "bytes", randomness_obj_initial_shared_version: "int"): - self.epoch = epoch - self.randomness_round = randomness_round - self.random_bytes = random_bytes - self.randomness_obj_initial_shared_version = randomness_obj_initial_shared_version - - def __str__(self): - return "RandomnessStateUpdate(epoch={}, randomness_round={}, random_bytes={}, randomness_obj_initial_shared_version={})".format(self.epoch, self.randomness_round, self.random_bytes, self.randomness_obj_initial_shared_version) - - def __eq__(self, other): - if self.epoch != other.epoch: - return False - if self.randomness_round != other.randomness_round: - return False - if self.random_bytes != other.random_bytes: - return False - if self.randomness_obj_initial_shared_version != other.randomness_obj_initial_shared_version: - return False - return True - -class _UniffiConverterTypeRandomnessStateUpdate(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return RandomnessStateUpdate( - epoch=_UniffiConverterUInt64.read(buf), - randomness_round=_UniffiConverterUInt64.read(buf), - random_bytes=_UniffiConverterBytes.read(buf), - randomness_obj_initial_shared_version=_UniffiConverterUInt64.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterUInt64.check_lower(value.epoch) - _UniffiConverterUInt64.check_lower(value.randomness_round) - _UniffiConverterBytes.check_lower(value.random_bytes) - _UniffiConverterUInt64.check_lower(value.randomness_obj_initial_shared_version) - - @staticmethod - def write(value, buf): - _UniffiConverterUInt64.write(value.epoch, buf) - _UniffiConverterUInt64.write(value.randomness_round, buf) - _UniffiConverterBytes.write(value.random_bytes, buf) - _UniffiConverterUInt64.write(value.randomness_obj_initial_shared_version, buf) - - -class SignedTransaction: - transaction: "Transaction" - signatures: "typing.List[UserSignature]" - def __init__(self, *, transaction: "Transaction", signatures: "typing.List[UserSignature]"): - self.transaction = transaction - self.signatures = signatures - - def __str__(self): - return "SignedTransaction(transaction={}, signatures={})".format(self.transaction, self.signatures) - - def __eq__(self, other): - if self.transaction != other.transaction: - return False - if self.signatures != other.signatures: - return False - return True - -class _UniffiConverterTypeSignedTransaction(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return SignedTransaction( - transaction=_UniffiConverterTypeTransaction.read(buf), - signatures=_UniffiConverterSequenceTypeUserSignature.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeTransaction.check_lower(value.transaction) - _UniffiConverterSequenceTypeUserSignature.check_lower(value.signatures) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeTransaction.write(value.transaction, buf) - _UniffiConverterSequenceTypeUserSignature.write(value.signatures, buf) - - -class SplitCoins: - """ - Command to split a single coin object into multiple coins - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - split-coins = argument (vector argument) - ``` - """ - - coin: "Argument" - """ - The coin to split - """ - - amounts: "typing.List[Argument]" - """ - The amounts to split off - """ - - def __init__(self, *, coin: "Argument", amounts: "typing.List[Argument]"): - self.coin = coin - self.amounts = amounts - - def __str__(self): - return "SplitCoins(coin={}, amounts={})".format(self.coin, self.amounts) - - def __eq__(self, other): - if self.coin != other.coin: - return False - if self.amounts != other.amounts: - return False - return True - -class _UniffiConverterTypeSplitCoins(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return SplitCoins( - coin=_UniffiConverterTypeArgument.read(buf), - amounts=_UniffiConverterSequenceTypeArgument.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeArgument.check_lower(value.coin) - _UniffiConverterSequenceTypeArgument.check_lower(value.amounts) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeArgument.write(value.coin, buf) - _UniffiConverterSequenceTypeArgument.write(value.amounts, buf) - - -class StructTag: - """ - Type information for a move struct - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - struct-tag = address ; address of the package - identifier ; name of the module - identifier ; name of the type - (vector type-tag) ; type parameters - ``` - """ - - address: "Address" - module: "Identifier" - name: "Identifier" - type_params: "typing.List[TypeTag]" - def __init__(self, *, address: "Address", module: "Identifier", name: "Identifier", type_params: "typing.List[TypeTag]"): - self.address = address - self.module = module - self.name = name - self.type_params = type_params - - def __str__(self): - return "StructTag(address={}, module={}, name={}, type_params={})".format(self.address, self.module, self.name, self.type_params) - - def __eq__(self, other): - if self.address != other.address: - return False - if self.module != other.module: - return False - if self.name != other.name: - return False - if self.type_params != other.type_params: - return False - return True - -class _UniffiConverterTypeStructTag(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return StructTag( - address=_UniffiConverterTypeAddress.read(buf), - module=_UniffiConverterTypeIdentifier.read(buf), - name=_UniffiConverterTypeIdentifier.read(buf), - type_params=_UniffiConverterSequenceTypeTypeTag.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeAddress.check_lower(value.address) - _UniffiConverterTypeIdentifier.check_lower(value.module) - _UniffiConverterTypeIdentifier.check_lower(value.name) - _UniffiConverterSequenceTypeTypeTag.check_lower(value.type_params) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeAddress.write(value.address, buf) - _UniffiConverterTypeIdentifier.write(value.module, buf) - _UniffiConverterTypeIdentifier.write(value.name, buf) - _UniffiConverterSequenceTypeTypeTag.write(value.type_params, buf) - - -class SystemPackage: - version: "int" - modules: "typing.List[bytes]" - dependencies: "typing.List[ObjectId]" - def __init__(self, *, version: "int", modules: "typing.List[bytes]", dependencies: "typing.List[ObjectId]"): - self.version = version - self.modules = modules - self.dependencies = dependencies - - def __str__(self): - return "SystemPackage(version={}, modules={}, dependencies={})".format(self.version, self.modules, self.dependencies) - - def __eq__(self, other): - if self.version != other.version: - return False - if self.modules != other.modules: - return False - if self.dependencies != other.dependencies: - return False - return True - -class _UniffiConverterTypeSystemPackage(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return SystemPackage( - version=_UniffiConverterUInt64.read(buf), - modules=_UniffiConverterSequenceBytes.read(buf), - dependencies=_UniffiConverterSequenceTypeObjectId.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterUInt64.check_lower(value.version) - _UniffiConverterSequenceBytes.check_lower(value.modules) - _UniffiConverterSequenceTypeObjectId.check_lower(value.dependencies) - - @staticmethod - def write(value, buf): - _UniffiConverterUInt64.write(value.version, buf) - _UniffiConverterSequenceBytes.write(value.modules, buf) - _UniffiConverterSequenceTypeObjectId.write(value.dependencies, buf) - - -class Transaction: - """ - A transaction - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - transaction = %x00 transaction-v1 - - transaction-v1 = transaction-kind address gas-payment transaction-expiration - ``` - """ - - kind: "TransactionKind" - sender: "Address" - gas_payment: "GasPayment" - expiration: "TransactionExpiration" - def __init__(self, *, kind: "TransactionKind", sender: "Address", gas_payment: "GasPayment", expiration: "TransactionExpiration"): - self.kind = kind - self.sender = sender - self.gas_payment = gas_payment - self.expiration = expiration - - def __str__(self): - return "Transaction(kind={}, sender={}, gas_payment={}, expiration={})".format(self.kind, self.sender, self.gas_payment, self.expiration) - - def __eq__(self, other): - if self.kind != other.kind: - return False - if self.sender != other.sender: - return False - if self.gas_payment != other.gas_payment: - return False - if self.expiration != other.expiration: - return False - return True - -class _UniffiConverterTypeTransaction(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return Transaction( - kind=_UniffiConverterTypeTransactionKind.read(buf), - sender=_UniffiConverterTypeAddress.read(buf), - gas_payment=_UniffiConverterTypeGasPayment.read(buf), - expiration=_UniffiConverterTypeTransactionExpiration.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeTransactionKind.check_lower(value.kind) - _UniffiConverterTypeAddress.check_lower(value.sender) - _UniffiConverterTypeGasPayment.check_lower(value.gas_payment) - _UniffiConverterTypeTransactionExpiration.check_lower(value.expiration) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeTransactionKind.write(value.kind, buf) - _UniffiConverterTypeAddress.write(value.sender, buf) - _UniffiConverterTypeGasPayment.write(value.gas_payment, buf) - _UniffiConverterTypeTransactionExpiration.write(value.expiration, buf) - - -class TransactionEffectsV1: - """ - Version 1 of TransactionEffects - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - effects-v1 = execution-status - u64 ; epoch - gas-cost-summary - digest ; transaction digest - (option u32) ; gas object index - (option digest) ; events digest - (vector digest) ; list of transaction dependencies - u64 ; lamport version - (vector changed-object) - (vector unchanged-shared-object) - (option digest) ; auxiliary data digest - ``` - """ - - status: "ExecutionStatus" - """ - The status of the execution - """ - - epoch: "int" - """ - The epoch when this transaction was executed. - """ - - gas_used: "GasCostSummary" - """ - The gas used by this transaction - """ - - transaction_digest: "TransactionDigest" - """ - The transaction digest - """ - - gas_object_index: "typing.Optional[int]" - """ - The updated gas object reference, as an index into the `changed_objects` - vector. Having a dedicated field for convenient access. - System transaction that don't require gas will leave this as None. - """ - - events_digest: "typing.Optional[TransactionEventsDigest]" - """ - The digest of the events emitted during execution, - can be None if the transaction does not emit any event. - """ - - dependencies: "typing.List[TransactionDigest]" - """ - The set of transaction digests this transaction depends on. - """ - - lamport_version: "int" - """ - The version number of all the written Move objects by this transaction. - """ - - changed_objects: "typing.List[ChangedObject]" - """ - Objects whose state are changed in the object store. - """ - - unchanged_shared_objects: "typing.List[UnchangedSharedObject]" - """ - Shared objects that are not mutated in this transaction. Unlike owned - objects, read-only shared objects' version are not committed in the - transaction, and in order for a node to catch up and execute it - without consensus sequencing, the version needs to be committed in - the effects. - """ - - auxiliary_data_digest: "typing.Optional[EffectsAuxiliaryDataDigest]" - """ - Auxiliary data that are not protocol-critical, generated as part of the - effects but are stored separately. Storing it separately allows us - to avoid bloating the effects with data that are not critical. - It also provides more flexibility on the format and type of the data. - """ - - def __init__(self, *, status: "ExecutionStatus", epoch: "int", gas_used: "GasCostSummary", transaction_digest: "TransactionDigest", gas_object_index: "typing.Optional[int]", events_digest: "typing.Optional[TransactionEventsDigest]", dependencies: "typing.List[TransactionDigest]", lamport_version: "int", changed_objects: "typing.List[ChangedObject]", unchanged_shared_objects: "typing.List[UnchangedSharedObject]", auxiliary_data_digest: "typing.Optional[EffectsAuxiliaryDataDigest]"): - self.status = status - self.epoch = epoch - self.gas_used = gas_used - self.transaction_digest = transaction_digest - self.gas_object_index = gas_object_index - self.events_digest = events_digest - self.dependencies = dependencies - self.lamport_version = lamport_version - self.changed_objects = changed_objects - self.unchanged_shared_objects = unchanged_shared_objects - self.auxiliary_data_digest = auxiliary_data_digest - - def __str__(self): - return "TransactionEffectsV1(status={}, epoch={}, gas_used={}, transaction_digest={}, gas_object_index={}, events_digest={}, dependencies={}, lamport_version={}, changed_objects={}, unchanged_shared_objects={}, auxiliary_data_digest={})".format(self.status, self.epoch, self.gas_used, self.transaction_digest, self.gas_object_index, self.events_digest, self.dependencies, self.lamport_version, self.changed_objects, self.unchanged_shared_objects, self.auxiliary_data_digest) - - def __eq__(self, other): - if self.status != other.status: - return False - if self.epoch != other.epoch: - return False - if self.gas_used != other.gas_used: - return False - if self.transaction_digest != other.transaction_digest: - return False - if self.gas_object_index != other.gas_object_index: - return False - if self.events_digest != other.events_digest: - return False - if self.dependencies != other.dependencies: - return False - if self.lamport_version != other.lamport_version: - return False - if self.changed_objects != other.changed_objects: - return False - if self.unchanged_shared_objects != other.unchanged_shared_objects: - return False - if self.auxiliary_data_digest != other.auxiliary_data_digest: - return False - return True - -class _UniffiConverterTypeTransactionEffectsV1(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return TransactionEffectsV1( - status=_UniffiConverterTypeExecutionStatus.read(buf), - epoch=_UniffiConverterUInt64.read(buf), - gas_used=_UniffiConverterTypeGasCostSummary.read(buf), - transaction_digest=_UniffiConverterTypeTransactionDigest.read(buf), - gas_object_index=_UniffiConverterOptionalUInt32.read(buf), - events_digest=_UniffiConverterOptionalTypeTransactionEventsDigest.read(buf), - dependencies=_UniffiConverterSequenceTypeTransactionDigest.read(buf), - lamport_version=_UniffiConverterUInt64.read(buf), - changed_objects=_UniffiConverterSequenceTypeChangedObject.read(buf), - unchanged_shared_objects=_UniffiConverterSequenceTypeUnchangedSharedObject.read(buf), - auxiliary_data_digest=_UniffiConverterOptionalTypeEffectsAuxiliaryDataDigest.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeExecutionStatus.check_lower(value.status) - _UniffiConverterUInt64.check_lower(value.epoch) - _UniffiConverterTypeGasCostSummary.check_lower(value.gas_used) - _UniffiConverterTypeTransactionDigest.check_lower(value.transaction_digest) - _UniffiConverterOptionalUInt32.check_lower(value.gas_object_index) - _UniffiConverterOptionalTypeTransactionEventsDigest.check_lower(value.events_digest) - _UniffiConverterSequenceTypeTransactionDigest.check_lower(value.dependencies) - _UniffiConverterUInt64.check_lower(value.lamport_version) - _UniffiConverterSequenceTypeChangedObject.check_lower(value.changed_objects) - _UniffiConverterSequenceTypeUnchangedSharedObject.check_lower(value.unchanged_shared_objects) - _UniffiConverterOptionalTypeEffectsAuxiliaryDataDigest.check_lower(value.auxiliary_data_digest) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeExecutionStatus.write(value.status, buf) - _UniffiConverterUInt64.write(value.epoch, buf) - _UniffiConverterTypeGasCostSummary.write(value.gas_used, buf) - _UniffiConverterTypeTransactionDigest.write(value.transaction_digest, buf) - _UniffiConverterOptionalUInt32.write(value.gas_object_index, buf) - _UniffiConverterOptionalTypeTransactionEventsDigest.write(value.events_digest, buf) - _UniffiConverterSequenceTypeTransactionDigest.write(value.dependencies, buf) - _UniffiConverterUInt64.write(value.lamport_version, buf) - _UniffiConverterSequenceTypeChangedObject.write(value.changed_objects, buf) - _UniffiConverterSequenceTypeUnchangedSharedObject.write(value.unchanged_shared_objects, buf) - _UniffiConverterOptionalTypeEffectsAuxiliaryDataDigest.write(value.auxiliary_data_digest, buf) - - -class TransferObjects: - """ - Command to transfer ownership of a set of objects to an address - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - transfer-objects = (vector argument) argument - ``` - """ - - objects: "typing.List[Argument]" - """ - Set of objects to transfer - """ - - address: "Argument" - """ - The address to transfer ownership to - """ - - def __init__(self, *, objects: "typing.List[Argument]", address: "Argument"): - self.objects = objects - self.address = address - - def __str__(self): - return "TransferObjects(objects={}, address={})".format(self.objects, self.address) - - def __eq__(self, other): - if self.objects != other.objects: - return False - if self.address != other.address: - return False - return True - -class _UniffiConverterTypeTransferObjects(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return TransferObjects( - objects=_UniffiConverterSequenceTypeArgument.read(buf), - address=_UniffiConverterTypeArgument.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterSequenceTypeArgument.check_lower(value.objects) - _UniffiConverterTypeArgument.check_lower(value.address) - - @staticmethod - def write(value, buf): - _UniffiConverterSequenceTypeArgument.write(value.objects, buf) - _UniffiConverterTypeArgument.write(value.address, buf) - - -class TypeOrigin: - """ - Identifies a struct and the module it was defined in - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - type-origin = identifier identifier object-id - ``` - """ - - module_name: "Identifier" - struct_name: "Identifier" - package: "ObjectId" - def __init__(self, *, module_name: "Identifier", struct_name: "Identifier", package: "ObjectId"): - self.module_name = module_name - self.struct_name = struct_name - self.package = package - - def __str__(self): - return "TypeOrigin(module_name={}, struct_name={}, package={})".format(self.module_name, self.struct_name, self.package) - - def __eq__(self, other): - if self.module_name != other.module_name: - return False - if self.struct_name != other.struct_name: - return False - if self.package != other.package: - return False - return True - -class _UniffiConverterTypeTypeOrigin(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return TypeOrigin( - module_name=_UniffiConverterTypeIdentifier.read(buf), - struct_name=_UniffiConverterTypeIdentifier.read(buf), - package=_UniffiConverterTypeObjectId.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeIdentifier.check_lower(value.module_name) - _UniffiConverterTypeIdentifier.check_lower(value.struct_name) - _UniffiConverterTypeObjectId.check_lower(value.package) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeIdentifier.write(value.module_name, buf) - _UniffiConverterTypeIdentifier.write(value.struct_name, buf) - _UniffiConverterTypeObjectId.write(value.package, buf) - - -class UnchangedSharedObject: - """ - A shared object that wasn't changed during execution - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - unchanged-shared-object = object-id unchanged-shared-object-kind - ``` - """ - - object_id: "ObjectId" - kind: "UnchangedSharedKind" - def __init__(self, *, object_id: "ObjectId", kind: "UnchangedSharedKind"): - self.object_id = object_id - self.kind = kind - - def __str__(self): - return "UnchangedSharedObject(object_id={}, kind={})".format(self.object_id, self.kind) - - def __eq__(self, other): - if self.object_id != other.object_id: - return False - if self.kind != other.kind: - return False - return True - -class _UniffiConverterTypeUnchangedSharedObject(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return UnchangedSharedObject( - object_id=_UniffiConverterTypeObjectId.read(buf), - kind=_UniffiConverterTypeUnchangedSharedKind.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeObjectId.check_lower(value.object_id) - _UniffiConverterTypeUnchangedSharedKind.check_lower(value.kind) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeObjectId.write(value.object_id, buf) - _UniffiConverterTypeUnchangedSharedKind.write(value.kind, buf) - - -class UniffiExecutionTimeObservation: - key: "ExecutionTimeObservationKey" - observations: "typing.List[ValidatorExecutionTimeObservation]" - def __init__(self, *, key: "ExecutionTimeObservationKey", observations: "typing.List[ValidatorExecutionTimeObservation]"): - self.key = key - self.observations = observations - - def __str__(self): - return "UniffiExecutionTimeObservation(key={}, observations={})".format(self.key, self.observations) - - def __eq__(self, other): - if self.key != other.key: - return False - if self.observations != other.observations: - return False - return True - -class _UniffiConverterTypeUniffiExecutionTimeObservation(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return UniffiExecutionTimeObservation( - key=_UniffiConverterTypeExecutionTimeObservationKey.read(buf), - observations=_UniffiConverterSequenceTypeValidatorExecutionTimeObservation.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeExecutionTimeObservationKey.check_lower(value.key) - _UniffiConverterSequenceTypeValidatorExecutionTimeObservation.check_lower(value.observations) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeExecutionTimeObservationKey.write(value.key, buf) - _UniffiConverterSequenceTypeValidatorExecutionTimeObservation.write(value.observations, buf) - - -class UniffiMovePackage: - id: "ObjectId" - version: "int" - modules: "dict[Identifier, bytes]" - type_origin_table: "typing.List[TypeOrigin]" - linkage_table: "dict[ObjectId, UpgradeInfo]" - def __init__(self, *, id: "ObjectId", version: "int", modules: "dict[Identifier, bytes]", type_origin_table: "typing.List[TypeOrigin]", linkage_table: "dict[ObjectId, UpgradeInfo]"): - self.id = id - self.version = version - self.modules = modules - self.type_origin_table = type_origin_table - self.linkage_table = linkage_table - - def __str__(self): - return "UniffiMovePackage(id={}, version={}, modules={}, type_origin_table={}, linkage_table={})".format(self.id, self.version, self.modules, self.type_origin_table, self.linkage_table) - - def __eq__(self, other): - if self.id != other.id: - return False - if self.version != other.version: - return False - if self.modules != other.modules: - return False - if self.type_origin_table != other.type_origin_table: - return False - if self.linkage_table != other.linkage_table: - return False - return True - -class _UniffiConverterTypeUniffiMovePackage(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return UniffiMovePackage( - id=_UniffiConverterTypeObjectId.read(buf), - version=_UniffiConverterUInt64.read(buf), - modules=_UniffiConverterMapTypeIdentifierBytes.read(buf), - type_origin_table=_UniffiConverterSequenceTypeTypeOrigin.read(buf), - linkage_table=_UniffiConverterMapTypeObjectIdTypeUpgradeInfo.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeObjectId.check_lower(value.id) - _UniffiConverterUInt64.check_lower(value.version) - _UniffiConverterMapTypeIdentifierBytes.check_lower(value.modules) - _UniffiConverterSequenceTypeTypeOrigin.check_lower(value.type_origin_table) - _UniffiConverterMapTypeObjectIdTypeUpgradeInfo.check_lower(value.linkage_table) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeObjectId.write(value.id, buf) - _UniffiConverterUInt64.write(value.version, buf) - _UniffiConverterMapTypeIdentifierBytes.write(value.modules, buf) - _UniffiConverterSequenceTypeTypeOrigin.write(value.type_origin_table, buf) - _UniffiConverterMapTypeObjectIdTypeUpgradeInfo.write(value.linkage_table, buf) - - -class Upgrade: - """ - Command to upgrade an already published package - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - upgrade = (vector bytes) ; move modules - (vector object-id) ; dependencies - object-id ; package-id of the package - argument ; upgrade ticket - ``` - """ - - modules: "typing.List[bytes]" - """ - The serialized move modules - """ - - dependencies: "typing.List[ObjectId]" - """ - Set of packages that the to-be published package depends on - """ - - package: "ObjectId" - """ - Package id of the package to upgrade - """ - - ticket: "Argument" - """ - Ticket authorizing the upgrade - """ - - def __init__(self, *, modules: "typing.List[bytes]", dependencies: "typing.List[ObjectId]", package: "ObjectId", ticket: "Argument"): - self.modules = modules - self.dependencies = dependencies - self.package = package - self.ticket = ticket - - def __str__(self): - return "Upgrade(modules={}, dependencies={}, package={}, ticket={})".format(self.modules, self.dependencies, self.package, self.ticket) - - def __eq__(self, other): - if self.modules != other.modules: - return False - if self.dependencies != other.dependencies: - return False - if self.package != other.package: - return False - if self.ticket != other.ticket: - return False - return True - -class _UniffiConverterTypeUpgrade(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return Upgrade( - modules=_UniffiConverterSequenceBytes.read(buf), - dependencies=_UniffiConverterSequenceTypeObjectId.read(buf), - package=_UniffiConverterTypeObjectId.read(buf), - ticket=_UniffiConverterTypeArgument.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterSequenceBytes.check_lower(value.modules) - _UniffiConverterSequenceTypeObjectId.check_lower(value.dependencies) - _UniffiConverterTypeObjectId.check_lower(value.package) - _UniffiConverterTypeArgument.check_lower(value.ticket) - - @staticmethod - def write(value, buf): - _UniffiConverterSequenceBytes.write(value.modules, buf) - _UniffiConverterSequenceTypeObjectId.write(value.dependencies, buf) - _UniffiConverterTypeObjectId.write(value.package, buf) - _UniffiConverterTypeArgument.write(value.ticket, buf) - - -class UpgradeInfo: - """ - Upgraded package info for the linkage table - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - upgrade-info = object-id u64 - ``` - """ - - upgraded_id: "ObjectId" - """ - Id of the upgraded packages - """ - - upgraded_version: "int" - """ - Version of the upgraded package - """ - - def __init__(self, *, upgraded_id: "ObjectId", upgraded_version: "int"): - self.upgraded_id = upgraded_id - self.upgraded_version = upgraded_version - - def __str__(self): - return "UpgradeInfo(upgraded_id={}, upgraded_version={})".format(self.upgraded_id, self.upgraded_version) - - def __eq__(self, other): - if self.upgraded_id != other.upgraded_id: - return False - if self.upgraded_version != other.upgraded_version: - return False - return True - -class _UniffiConverterTypeUpgradeInfo(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return UpgradeInfo( - upgraded_id=_UniffiConverterTypeObjectId.read(buf), - upgraded_version=_UniffiConverterUInt64.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeObjectId.check_lower(value.upgraded_id) - _UniffiConverterUInt64.check_lower(value.upgraded_version) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeObjectId.write(value.upgraded_id, buf) - _UniffiConverterUInt64.write(value.upgraded_version, buf) - - -class ValidatorCommitteeMember: - """ - A member of a Validator Committee - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - validator-committee-member = bls-public-key - u64 ; stake - ``` - """ - - public_key: "Bls12381PublicKey" - stake: "int" - def __init__(self, *, public_key: "Bls12381PublicKey", stake: "int"): - self.public_key = public_key - self.stake = stake - - def __str__(self): - return "ValidatorCommitteeMember(public_key={}, stake={})".format(self.public_key, self.stake) - - def __eq__(self, other): - if self.public_key != other.public_key: - return False - if self.stake != other.stake: - return False - return True - -class _UniffiConverterTypeValidatorCommitteeMember(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return ValidatorCommitteeMember( - public_key=_UniffiConverterTypeBls12381PublicKey.read(buf), - stake=_UniffiConverterUInt64.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeBls12381PublicKey.check_lower(value.public_key) - _UniffiConverterUInt64.check_lower(value.stake) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeBls12381PublicKey.write(value.public_key, buf) - _UniffiConverterUInt64.write(value.stake, buf) - - -class ValidatorExecutionTimeObservation: - """ - An execution time observation from a particular validator - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - execution-time-observation = bls-public-key duration - duration = u64 ; seconds - u32 ; subsecond nanoseconds - ``` - """ - - validator: "Bls12381PublicKey" - duration: "Duration" - def __init__(self, *, validator: "Bls12381PublicKey", duration: "Duration"): - self.validator = validator - self.duration = duration - - def __str__(self): - return "ValidatorExecutionTimeObservation(validator={}, duration={})".format(self.validator, self.duration) - - def __eq__(self, other): - if self.validator != other.validator: - return False - if self.duration != other.duration: - return False - return True - -class _UniffiConverterTypeValidatorExecutionTimeObservation(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return ValidatorExecutionTimeObservation( - validator=_UniffiConverterTypeBls12381PublicKey.read(buf), - duration=_UniffiConverterDuration.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeBls12381PublicKey.check_lower(value.validator) - _UniffiConverterDuration.check_lower(value.duration) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeBls12381PublicKey.write(value.validator, buf) - _UniffiConverterDuration.write(value.duration, buf) - - -class VersionAssignment: - """ - Object version assignment from consensus - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - version-assignment = object-id u64 - ``` - """ - - object_id: "ObjectId" - version: "int" - def __init__(self, *, object_id: "ObjectId", version: "int"): - self.object_id = object_id - self.version = version - - def __str__(self): - return "VersionAssignment(object_id={}, version={})".format(self.object_id, self.version) - - def __eq__(self, other): - if self.object_id != other.object_id: - return False - if self.version != other.version: - return False - return True - -class _UniffiConverterTypeVersionAssignment(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return VersionAssignment( - object_id=_UniffiConverterTypeObjectId.read(buf), - version=_UniffiConverterUInt64.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeObjectId.check_lower(value.object_id) - _UniffiConverterUInt64.check_lower(value.version) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeObjectId.write(value.object_id, buf) - _UniffiConverterUInt64.write(value.version, buf) - - -class ZkLoginAuthenticator: - """ - A zklogin authenticator - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - zklogin-bcs = bytes ; contents are defined by - zklogin = zklogin-flag - zklogin-inputs - u64 ; max epoch - simple-signature - ``` - - Note: Due to historical reasons, signatures are serialized slightly - different from the majority of the types in IOTA. In particular if a - signature is ever embedded in another structure it generally is serialized - as `bytes` meaning it has a length prefix that defines the length of - the completely serialized signature. - """ - - inputs: "ZkLoginInputs" - """ - Zklogin proof and inputs required to perform proof verification. - """ - - max_epoch: "int" - """ - Maximum epoch for which the proof is valid. - """ - - signature: "SimpleSignature" - """ - User signature with the pubkey attested to by the provided proof. - """ - - def __init__(self, *, inputs: "ZkLoginInputs", max_epoch: "int", signature: "SimpleSignature"): - self.inputs = inputs - self.max_epoch = max_epoch - self.signature = signature - - def __str__(self): - return "ZkLoginAuthenticator(inputs={}, max_epoch={}, signature={})".format(self.inputs, self.max_epoch, self.signature) - - def __eq__(self, other): - if self.inputs != other.inputs: - return False - if self.max_epoch != other.max_epoch: - return False - if self.signature != other.signature: - return False - return True - -class _UniffiConverterTypeZkLoginAuthenticator(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return ZkLoginAuthenticator( - inputs=_UniffiConverterTypeZkLoginInputs.read(buf), - max_epoch=_UniffiConverterUInt64.read(buf), - signature=_UniffiConverterTypeSimpleSignature.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeZkLoginInputs.check_lower(value.inputs) - _UniffiConverterUInt64.check_lower(value.max_epoch) - _UniffiConverterTypeSimpleSignature.check_lower(value.signature) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeZkLoginInputs.write(value.inputs, buf) - _UniffiConverterUInt64.write(value.max_epoch, buf) - _UniffiConverterTypeSimpleSignature.write(value.signature, buf) - - -class ZkLoginClaim: - """ - A claim of the iss in a zklogin proof - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - zklogin-claim = string u8 - ``` - """ - - value: "str" - index_mod_4: "int" - def __init__(self, *, value: "str", index_mod_4: "int"): - self.value = value - self.index_mod_4 = index_mod_4 - - def __str__(self): - return "ZkLoginClaim(value={}, index_mod_4={})".format(self.value, self.index_mod_4) - - def __eq__(self, other): - if self.value != other.value: - return False - if self.index_mod_4 != other.index_mod_4: - return False - return True - -class _UniffiConverterTypeZkLoginClaim(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return ZkLoginClaim( - value=_UniffiConverterString.read(buf), - index_mod_4=_UniffiConverterUInt8.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterString.check_lower(value.value) - _UniffiConverterUInt8.check_lower(value.index_mod_4) - - @staticmethod - def write(value, buf): - _UniffiConverterString.write(value.value, buf) - _UniffiConverterUInt8.write(value.index_mod_4, buf) - - -class ZkLoginInputs: - """ - A zklogin groth16 proof and the required inputs to perform proof - verification. - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - zklogin-inputs = zklogin-proof - zklogin-claim - string ; base64url-unpadded encoded JwtHeader - bn254-field-element ; address_seed - ``` - """ - - proof_points: "ZkLoginProof" - iss_base64_details: "ZkLoginClaim" - header_base64: "str" - address_seed: "Bn254FieldElement" - def __init__(self, *, proof_points: "ZkLoginProof", iss_base64_details: "ZkLoginClaim", header_base64: "str", address_seed: "Bn254FieldElement"): - self.proof_points = proof_points - self.iss_base64_details = iss_base64_details - self.header_base64 = header_base64 - self.address_seed = address_seed - - def __str__(self): - return "ZkLoginInputs(proof_points={}, iss_base64_details={}, header_base64={}, address_seed={})".format(self.proof_points, self.iss_base64_details, self.header_base64, self.address_seed) - - def __eq__(self, other): - if self.proof_points != other.proof_points: - return False - if self.iss_base64_details != other.iss_base64_details: - return False - if self.header_base64 != other.header_base64: - return False - if self.address_seed != other.address_seed: - return False - return True - -class _UniffiConverterTypeZkLoginInputs(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return ZkLoginInputs( - proof_points=_UniffiConverterTypeZkLoginProof.read(buf), - iss_base64_details=_UniffiConverterTypeZkLoginClaim.read(buf), - header_base64=_UniffiConverterString.read(buf), - address_seed=_UniffiConverterTypeBn254FieldElement.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeZkLoginProof.check_lower(value.proof_points) - _UniffiConverterTypeZkLoginClaim.check_lower(value.iss_base64_details) - _UniffiConverterString.check_lower(value.header_base64) - _UniffiConverterTypeBn254FieldElement.check_lower(value.address_seed) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeZkLoginProof.write(value.proof_points, buf) - _UniffiConverterTypeZkLoginClaim.write(value.iss_base64_details, buf) - _UniffiConverterString.write(value.header_base64, buf) - _UniffiConverterTypeBn254FieldElement.write(value.address_seed, buf) - - -class ZkLoginProof: - """ - A zklogin groth16 proof - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - zklogin-proof = circom-g1 circom-g2 circom-g1 - ``` - """ - - a: "CircomG1" - b: "CircomG2" - c: "CircomG1" - def __init__(self, *, a: "CircomG1", b: "CircomG2", c: "CircomG1"): - self.a = a - self.b = b - self.c = c - - def __str__(self): - return "ZkLoginProof(a={}, b={}, c={})".format(self.a, self.b, self.c) - - def __eq__(self, other): - if self.a != other.a: - return False - if self.b != other.b: - return False - if self.c != other.c: - return False - return True - -class _UniffiConverterTypeZkLoginProof(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return ZkLoginProof( - a=_UniffiConverterTypeCircomG1.read(buf), - b=_UniffiConverterTypeCircomG2.read(buf), - c=_UniffiConverterTypeCircomG1.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterTypeCircomG1.check_lower(value.a) - _UniffiConverterTypeCircomG2.check_lower(value.b) - _UniffiConverterTypeCircomG1.check_lower(value.c) - - @staticmethod - def write(value, buf): - _UniffiConverterTypeCircomG1.write(value.a, buf) - _UniffiConverterTypeCircomG2.write(value.b, buf) - _UniffiConverterTypeCircomG1.write(value.c, buf) - - -class ZkLoginPublicIdentifier: - """ - Public Key equivalent for Zklogin authenticators - - A `ZkLoginPublicIdentifier` is the equivalent of a public key for other - account authenticators, and contains the information required to derive the - onchain account [`Address`] for a Zklogin authenticator. - - ## Note - - Due to a historical bug that was introduced in the IOTA Typescript SDK when - the zklogin authenticator was first introduced, there are now possibly two - "valid" addresses for each zklogin authenticator depending on the - bit-pattern of the `address_seed` value. - - The original bug incorrectly derived a zklogin's address by stripping any - leading zero-bytes that could have been present in the 32-byte length - `address_seed` value prior to hashing, leading to a different derived - address. This incorrectly derived address was presented to users of various - wallets, leading them to sending funds to these addresses that they couldn't - access. Instead of letting these users lose any assets that were sent to - these addresses, the IOTA network decided to change the protocol to allow - for a zklogin authenticator who's `address_seed` value had leading - zero-bytes be authorized to sign for both the addresses derived from both - the unpadded and padded `address_seed` value. - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - zklogin-public-identifier-bcs = bytes ; where the contents are defined by - ; - - zklogin-public-identifier = zklogin-public-identifier-iss - address-seed - - zklogin-public-identifier-unpadded = zklogin-public-identifier-iss - address-seed-unpadded - - ; The iss, or issuer, is a utf8 string that is less than 255 bytes long - ; and is serialized with the iss's length in bytes as a u8 followed by - ; the bytes of the iss - zklogin-public-identifier-iss = u8 *255(OCTET) - - ; A Bn254FieldElement serialized as a 32-byte big-endian value - address-seed = 32(OCTET) - - ; A Bn254FieldElement serialized as a 32-byte big-endian value - ; with any leading zero bytes stripped - address-seed-unpadded = %x00 / %x01-ff *31(OCTET) - ``` - - [`Address`]: crate::Address - """ - - iss: "str" - address_seed: "Bn254FieldElement" - def __init__(self, *, iss: "str", address_seed: "Bn254FieldElement"): - self.iss = iss - self.address_seed = address_seed - - def __str__(self): - return "ZkLoginPublicIdentifier(iss={}, address_seed={})".format(self.iss, self.address_seed) - - def __eq__(self, other): - if self.iss != other.iss: - return False - if self.address_seed != other.address_seed: - return False - return True - -class _UniffiConverterTypeZkLoginPublicIdentifier(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - return ZkLoginPublicIdentifier( - iss=_UniffiConverterString.read(buf), - address_seed=_UniffiConverterTypeBn254FieldElement.read(buf), - ) - - @staticmethod - def check_lower(value): - _UniffiConverterString.check_lower(value.iss) - _UniffiConverterTypeBn254FieldElement.check_lower(value.address_seed) - - @staticmethod - def write(value, buf): - _UniffiConverterString.write(value.iss, buf) - _UniffiConverterTypeBn254FieldElement.write(value.address_seed, buf) - - - - - -class Argument: - """ - An argument to a programmable transaction command - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - argument = argument-gas - =/ argument-input - =/ argument-result - =/ argument-nested-result - - argument-gas = %x00 - argument-input = %x01 u16 - argument-result = %x02 u16 - argument-nested-result = %x03 u16 u16 - ``` - """ - - def __init__(self): - raise RuntimeError("Argument cannot be instantiated directly") - - # Each enum variant is a nested class of the enum itself. - class GAS: - """ - The gas coin. The gas coin can only be used by-ref, except for with - `TransferObjects`, which can use it by-value. - """ - - - def __init__(self,): - pass - - def __str__(self): - return "Argument.GAS()".format() - - def __eq__(self, other): - if not other.is_GAS(): - return False - return True - - class INPUT: - """ - One of the input objects or primitive values (from - `ProgrammableTransaction` inputs) - """ - - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"Argument.INPUT{self._values!r}" - - def __eq__(self, other): - if not other.is_INPUT(): - return False - return self._values == other._values - class RESULT: - """ - The result of another command (from `ProgrammableTransaction` commands) - """ - - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"Argument.RESULT{self._values!r}" - - def __eq__(self, other): - if not other.is_RESULT(): - return False - return self._values == other._values - class NESTED_RESULT: - """ - Like a `Result` but it accesses a nested result. Currently, the only - usage of this is to access a value from a Move call with multiple - return values. - """ - - def __init__(self, *values): - if len(values) != 2: - raise TypeError(f"Expected 2 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"Argument.NESTED_RESULT{self._values!r}" - - def __eq__(self, other): - if not other.is_NESTED_RESULT(): - return False - return self._values == other._values - - - # For each variant, we have `is_NAME` and `is_name` methods for easily checking - # whether an instance is that variant. - def is_GAS(self) -> bool: - return isinstance(self, Argument.GAS) - def is_gas(self) -> bool: - return isinstance(self, Argument.GAS) - def is_INPUT(self) -> bool: - return isinstance(self, Argument.INPUT) - def is_input(self) -> bool: - return isinstance(self, Argument.INPUT) - def is_RESULT(self) -> bool: - return isinstance(self, Argument.RESULT) - def is_result(self) -> bool: - return isinstance(self, Argument.RESULT) - def is_NESTED_RESULT(self) -> bool: - return isinstance(self, Argument.NESTED_RESULT) - def is_nested_result(self) -> bool: - return isinstance(self, Argument.NESTED_RESULT) - - -# 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. -Argument.GAS = type("Argument.GAS", (Argument.GAS, Argument,), {}) # type: ignore -Argument.INPUT = type("Argument.INPUT", (Argument.INPUT, Argument,), {}) # type: ignore -Argument.RESULT = type("Argument.RESULT", (Argument.RESULT, Argument,), {}) # type: ignore -Argument.NESTED_RESULT = type("Argument.NESTED_RESULT", (Argument.NESTED_RESULT, Argument,), {}) # type: ignore - - - - -class _UniffiConverterTypeArgument(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return Argument.GAS( - ) - if variant == 2: - return Argument.INPUT( - _UniffiConverterUInt16.read(buf), - ) - if variant == 3: - return Argument.RESULT( - _UniffiConverterUInt16.read(buf), - ) - if variant == 4: - return Argument.NESTED_RESULT( - _UniffiConverterUInt16.read(buf), - _UniffiConverterUInt16.read(buf), - ) - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value.is_GAS(): - return - if value.is_INPUT(): - _UniffiConverterUInt16.check_lower(value._values[0]) - return - if value.is_RESULT(): - _UniffiConverterUInt16.check_lower(value._values[0]) - return - if value.is_NESTED_RESULT(): - _UniffiConverterUInt16.check_lower(value._values[0]) - _UniffiConverterUInt16.check_lower(value._values[1]) - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value.is_GAS(): - buf.write_i32(1) - if value.is_INPUT(): - buf.write_i32(2) - _UniffiConverterUInt16.write(value._values[0], buf) - if value.is_RESULT(): - buf.write_i32(3) - _UniffiConverterUInt16.write(value._values[0], buf) - if value.is_NESTED_RESULT(): - buf.write_i32(4) - _UniffiConverterUInt16.write(value._values[0], buf) - _UniffiConverterUInt16.write(value._values[1], buf) - - - - - - - -class CheckpointCommitment: - """ - A commitment made by a checkpoint. - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - ; CheckpointCommitment is an enum and each variant is prefixed with its index - checkpoint-commitment = ecmh-live-object-set - ecmh-live-object-set = %x00 digest - ``` - """ - - def __init__(self): - raise RuntimeError("CheckpointCommitment cannot be instantiated directly") - - # Each enum variant is a nested class of the enum itself. - class ECMH_LIVE_OBJECT_SET: - """ - An Elliptic Curve Multiset Hash attesting to the set of Objects that - comprise the live state of the IOTA blockchain. - """ - - digest: "Digest" - - def __init__(self,digest: "Digest"): - self.digest = digest - - def __str__(self): - return "CheckpointCommitment.ECMH_LIVE_OBJECT_SET(digest={})".format(self.digest) - - def __eq__(self, other): - if not other.is_ECMH_LIVE_OBJECT_SET(): - return False - if self.digest != other.digest: - return False - return True - - - - # For each variant, we have `is_NAME` and `is_name` methods for easily checking - # whether an instance is that variant. - def is_ECMH_LIVE_OBJECT_SET(self) -> bool: - return isinstance(self, CheckpointCommitment.ECMH_LIVE_OBJECT_SET) - def is_ecmh_live_object_set(self) -> bool: - return isinstance(self, CheckpointCommitment.ECMH_LIVE_OBJECT_SET) - - -# 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. -CheckpointCommitment.ECMH_LIVE_OBJECT_SET = type("CheckpointCommitment.ECMH_LIVE_OBJECT_SET", (CheckpointCommitment.ECMH_LIVE_OBJECT_SET, CheckpointCommitment,), {}) # type: ignore - - - - -class _UniffiConverterTypeCheckpointCommitment(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return CheckpointCommitment.ECMH_LIVE_OBJECT_SET( - _UniffiConverterTypeDigest.read(buf), - ) - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value.is_ECMH_LIVE_OBJECT_SET(): - _UniffiConverterTypeDigest.check_lower(value.digest) - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value.is_ECMH_LIVE_OBJECT_SET(): - buf.write_i32(1) - _UniffiConverterTypeDigest.write(value.digest, buf) - - - - - - - -class Command: - """ - A single command in a programmable transaction. - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - command = command-move-call - =/ command-transfer-objects - =/ command-split-coins - =/ command-merge-coins - =/ command-publish - =/ command-make-move-vector - =/ command-upgrade - - command-move-call = %x00 move-call - command-transfer-objects = %x01 transfer-objects - command-split-coins = %x02 split-coins - command-merge-coins = %x03 merge-coins - command-publish = %x04 publish - command-make-move-vector = %x05 make-move-vector - command-upgrade = %x06 upgrade - ``` - """ - - def __init__(self): - raise RuntimeError("Command cannot be instantiated directly") - - # Each enum variant is a nested class of the enum itself. - class MOVE_CALL: - """ - A call to either an entry or a public Move function - """ - - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"Command.MOVE_CALL{self._values!r}" - - def __eq__(self, other): - if not other.is_MOVE_CALL(): - return False - return self._values == other._values - class TRANSFER_OBJECTS: - """ - `(Vec, address)` - It sends n-objects to the specified address. These objects must have - store (public transfer) and either the previous owner must be an - address or the object must be newly created. - """ - - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"Command.TRANSFER_OBJECTS{self._values!r}" - - def __eq__(self, other): - if not other.is_TRANSFER_OBJECTS(): - return False - return self._values == other._values - class SPLIT_COINS: - """ - `(&mut Coin, Vec)` -> `Vec>` - It splits off some amounts into a new coins with those amounts - """ - - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"Command.SPLIT_COINS{self._values!r}" - - def __eq__(self, other): - if not other.is_SPLIT_COINS(): - return False - return self._values == other._values - class MERGE_COINS: - """ - `(&mut Coin, Vec>)` - It merges n-coins into the first coin - """ - - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"Command.MERGE_COINS{self._values!r}" - - def __eq__(self, other): - if not other.is_MERGE_COINS(): - return False - return self._values == other._values - class PUBLISH: - """ - Publishes a Move package. It takes the package bytes and a list of the - package's transitive dependencies to link against on-chain. - """ - - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"Command.PUBLISH{self._values!r}" - - def __eq__(self, other): - if not other.is_PUBLISH(): - return False - return self._values == other._values - class MAKE_MOVE_VECTOR: - """ - `forall T: Vec -> vector` - Given n-values of the same type, it constructs a vector. For non objects - or an empty vector, the type tag must be specified. - """ - - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"Command.MAKE_MOVE_VECTOR{self._values!r}" - - def __eq__(self, other): - if not other.is_MAKE_MOVE_VECTOR(): - return False - return self._values == other._values - class UPGRADE: - """ - Upgrades a Move package - Takes (in order): - 1. A vector of serialized modules for the package. - 2. A vector of object ids for the transitive dependencies of the new - package. - 3. The object ID of the package being upgraded. - 4. An argument holding the `UpgradeTicket` that must have been produced - from an earlier command in the same programmable transaction. - """ - - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"Command.UPGRADE{self._values!r}" - - def __eq__(self, other): - if not other.is_UPGRADE(): - return False - return self._values == other._values - - - # For each variant, we have `is_NAME` and `is_name` methods for easily checking - # whether an instance is that variant. - def is_MOVE_CALL(self) -> bool: - return isinstance(self, Command.MOVE_CALL) - def is_move_call(self) -> bool: - return isinstance(self, Command.MOVE_CALL) - def is_TRANSFER_OBJECTS(self) -> bool: - return isinstance(self, Command.TRANSFER_OBJECTS) - def is_transfer_objects(self) -> bool: - return isinstance(self, Command.TRANSFER_OBJECTS) - def is_SPLIT_COINS(self) -> bool: - return isinstance(self, Command.SPLIT_COINS) - def is_split_coins(self) -> bool: - return isinstance(self, Command.SPLIT_COINS) - def is_MERGE_COINS(self) -> bool: - return isinstance(self, Command.MERGE_COINS) - def is_merge_coins(self) -> bool: - return isinstance(self, Command.MERGE_COINS) - def is_PUBLISH(self) -> bool: - return isinstance(self, Command.PUBLISH) - def is_publish(self) -> bool: - return isinstance(self, Command.PUBLISH) - def is_MAKE_MOVE_VECTOR(self) -> bool: - return isinstance(self, Command.MAKE_MOVE_VECTOR) - def is_make_move_vector(self) -> bool: - return isinstance(self, Command.MAKE_MOVE_VECTOR) - def is_UPGRADE(self) -> bool: - return isinstance(self, Command.UPGRADE) - def is_upgrade(self) -> bool: - return isinstance(self, Command.UPGRADE) - - -# 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. -Command.MOVE_CALL = type("Command.MOVE_CALL", (Command.MOVE_CALL, Command,), {}) # type: ignore -Command.TRANSFER_OBJECTS = type("Command.TRANSFER_OBJECTS", (Command.TRANSFER_OBJECTS, Command,), {}) # type: ignore -Command.SPLIT_COINS = type("Command.SPLIT_COINS", (Command.SPLIT_COINS, Command,), {}) # type: ignore -Command.MERGE_COINS = type("Command.MERGE_COINS", (Command.MERGE_COINS, Command,), {}) # type: ignore -Command.PUBLISH = type("Command.PUBLISH", (Command.PUBLISH, Command,), {}) # type: ignore -Command.MAKE_MOVE_VECTOR = type("Command.MAKE_MOVE_VECTOR", (Command.MAKE_MOVE_VECTOR, Command,), {}) # type: ignore -Command.UPGRADE = type("Command.UPGRADE", (Command.UPGRADE, Command,), {}) # type: ignore - - - - -class _UniffiConverterTypeCommand(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return Command.MOVE_CALL( - _UniffiConverterTypeMoveCall.read(buf), - ) - if variant == 2: - return Command.TRANSFER_OBJECTS( - _UniffiConverterTypeTransferObjects.read(buf), - ) - if variant == 3: - return Command.SPLIT_COINS( - _UniffiConverterTypeSplitCoins.read(buf), - ) - if variant == 4: - return Command.MERGE_COINS( - _UniffiConverterTypeMergeCoins.read(buf), - ) - if variant == 5: - return Command.PUBLISH( - _UniffiConverterTypePublish.read(buf), - ) - if variant == 6: - return Command.MAKE_MOVE_VECTOR( - _UniffiConverterTypeMakeMoveVector.read(buf), - ) - if variant == 7: - return Command.UPGRADE( - _UniffiConverterTypeUpgrade.read(buf), - ) - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value.is_MOVE_CALL(): - _UniffiConverterTypeMoveCall.check_lower(value._values[0]) - return - if value.is_TRANSFER_OBJECTS(): - _UniffiConverterTypeTransferObjects.check_lower(value._values[0]) - return - if value.is_SPLIT_COINS(): - _UniffiConverterTypeSplitCoins.check_lower(value._values[0]) - return - if value.is_MERGE_COINS(): - _UniffiConverterTypeMergeCoins.check_lower(value._values[0]) - return - if value.is_PUBLISH(): - _UniffiConverterTypePublish.check_lower(value._values[0]) - return - if value.is_MAKE_MOVE_VECTOR(): - _UniffiConverterTypeMakeMoveVector.check_lower(value._values[0]) - return - if value.is_UPGRADE(): - _UniffiConverterTypeUpgrade.check_lower(value._values[0]) - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value.is_MOVE_CALL(): - buf.write_i32(1) - _UniffiConverterTypeMoveCall.write(value._values[0], buf) - if value.is_TRANSFER_OBJECTS(): - buf.write_i32(2) - _UniffiConverterTypeTransferObjects.write(value._values[0], buf) - if value.is_SPLIT_COINS(): - buf.write_i32(3) - _UniffiConverterTypeSplitCoins.write(value._values[0], buf) - if value.is_MERGE_COINS(): - buf.write_i32(4) - _UniffiConverterTypeMergeCoins.write(value._values[0], buf) - if value.is_PUBLISH(): - buf.write_i32(5) - _UniffiConverterTypePublish.write(value._values[0], buf) - if value.is_MAKE_MOVE_VECTOR(): - buf.write_i32(6) - _UniffiConverterTypeMakeMoveVector.write(value._values[0], buf) - if value.is_UPGRADE(): - buf.write_i32(7) - _UniffiConverterTypeUpgrade.write(value._values[0], buf) - - - - - - - -class CommandArgumentError: - """ - An error with an argument to a command - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - command-argument-error = type-mismatch - =/ invalid-bcs-bytes - =/ invalid-usage-of-pure-argument - =/ invalid-argument-to-private-entry-function - =/ index-out-of-bounds - =/ secondary-index-out-of-bound - =/ invalid-result-arity - =/ invalid-gas-coin-usage - =/ invalid-value-usage - =/ invalid-object-by-value - =/ invalid-object-by-mut-ref - =/ shared-object-operation-not-allowed - - type-mismatch = %x00 - invalid-bcs-bytes = %x01 - invalid-usage-of-pure-argument = %x02 - invalid-argument-to-private-entry-function = %x03 - index-out-of-bounds = %x04 u16 - secondary-index-out-of-bound = %x05 u16 u16 - invalid-result-arity = %x06 u16 - invalid-gas-coin-usage = %x07 - invalid-value-usage = %x08 - invalid-object-by-value = %x09 - invalid-object-by-mut-ref = %x0a - shared-object-operation-not-allowed = %x0b - ``` - """ - - def __init__(self): - raise RuntimeError("CommandArgumentError cannot be instantiated directly") - - # Each enum variant is a nested class of the enum itself. - class TYPE_MISMATCH: - """ - The type of the value does not match the expected type - """ - - - def __init__(self,): - pass - - def __str__(self): - return "CommandArgumentError.TYPE_MISMATCH()".format() - - def __eq__(self, other): - if not other.is_TYPE_MISMATCH(): - return False - return True - - class INVALID_BCS_BYTES: - """ - The argument cannot be deserialized into a value of the specified type - """ - - - def __init__(self,): - pass - - def __str__(self): - return "CommandArgumentError.INVALID_BCS_BYTES()".format() - - def __eq__(self, other): - if not other.is_INVALID_BCS_BYTES(): - return False - return True - - class INVALID_USAGE_OF_PURE_ARGUMENT: - """ - The argument cannot be instantiated from raw bytes - """ - - - def __init__(self,): - pass - - def __str__(self): - return "CommandArgumentError.INVALID_USAGE_OF_PURE_ARGUMENT()".format() - - def __eq__(self, other): - if not other.is_INVALID_USAGE_OF_PURE_ARGUMENT(): - return False - return True - - class INVALID_ARGUMENT_TO_PRIVATE_ENTRY_FUNCTION: - """ - Invalid argument to private entry function. - Private entry functions cannot take arguments from other Move functions. - """ - - - def __init__(self,): - pass - - def __str__(self): - return "CommandArgumentError.INVALID_ARGUMENT_TO_PRIVATE_ENTRY_FUNCTION()".format() - - def __eq__(self, other): - if not other.is_INVALID_ARGUMENT_TO_PRIVATE_ENTRY_FUNCTION(): - return False - return True - - class INDEX_OUT_OF_BOUNDS: - """ - Out of bounds access to input or results - """ - - index: "int" - - def __init__(self,index: "int"): - self.index = index - - def __str__(self): - return "CommandArgumentError.INDEX_OUT_OF_BOUNDS(index={})".format(self.index) - - def __eq__(self, other): - if not other.is_INDEX_OUT_OF_BOUNDS(): - return False - if self.index != other.index: - return False - return True - - class SECONDARY_INDEX_OUT_OF_BOUNDS: - """ - Out of bounds access to subresult - """ - - result: "int" - subresult: "int" - - def __init__(self,result: "int", subresult: "int"): - self.result = result - self.subresult = subresult - - def __str__(self): - return "CommandArgumentError.SECONDARY_INDEX_OUT_OF_BOUNDS(result={}, subresult={})".format(self.result, self.subresult) - - def __eq__(self, other): - if not other.is_SECONDARY_INDEX_OUT_OF_BOUNDS(): - return False - if self.result != other.result: - return False - if self.subresult != other.subresult: - return False - return True - - class INVALID_RESULT_ARITY: - """ - Invalid usage of result. - Expected a single result but found either no return value or multiple. - """ - - result: "int" - - def __init__(self,result: "int"): - self.result = result - - def __str__(self): - return "CommandArgumentError.INVALID_RESULT_ARITY(result={})".format(self.result) - - def __eq__(self, other): - if not other.is_INVALID_RESULT_ARITY(): - return False - if self.result != other.result: - return False - return True - - class INVALID_GAS_COIN_USAGE: - """ - Invalid usage of Gas coin. - The Gas coin can only be used by-value with a TransferObjects command. - """ - - - def __init__(self,): - pass - - def __str__(self): - return "CommandArgumentError.INVALID_GAS_COIN_USAGE()".format() - - def __eq__(self, other): - if not other.is_INVALID_GAS_COIN_USAGE(): - return False - return True - - class INVALID_VALUE_USAGE: - """ - Invalid usage of move value. - """ - - - def __init__(self,): - pass - - def __str__(self): - return "CommandArgumentError.INVALID_VALUE_USAGE()".format() - - def __eq__(self, other): - if not other.is_INVALID_VALUE_USAGE(): - return False - return True - - class INVALID_OBJECT_BY_VALUE: - """ - Immutable objects cannot be passed by-value. - """ - - - def __init__(self,): - pass - - def __str__(self): - return "CommandArgumentError.INVALID_OBJECT_BY_VALUE()".format() - - def __eq__(self, other): - if not other.is_INVALID_OBJECT_BY_VALUE(): - return False - return True - - class INVALID_OBJECT_BY_MUT_REF: - """ - Immutable objects cannot be passed by mutable reference, &mut. - """ - - - def __init__(self,): - pass - - def __str__(self): - return "CommandArgumentError.INVALID_OBJECT_BY_MUT_REF()".format() - - def __eq__(self, other): - if not other.is_INVALID_OBJECT_BY_MUT_REF(): - return False - return True - - class SHARED_OBJECT_OPERATION_NOT_ALLOWED: - """ - Shared object operations such a wrapping, freezing, or converting to - owned are not allowed. - """ - - - def __init__(self,): - pass - - def __str__(self): - return "CommandArgumentError.SHARED_OBJECT_OPERATION_NOT_ALLOWED()".format() - - def __eq__(self, other): - if not other.is_SHARED_OBJECT_OPERATION_NOT_ALLOWED(): - return False - return True - - - - # For each variant, we have `is_NAME` and `is_name` methods for easily checking - # whether an instance is that variant. - def is_TYPE_MISMATCH(self) -> bool: - return isinstance(self, CommandArgumentError.TYPE_MISMATCH) - def is_type_mismatch(self) -> bool: - return isinstance(self, CommandArgumentError.TYPE_MISMATCH) - def is_INVALID_BCS_BYTES(self) -> bool: - return isinstance(self, CommandArgumentError.INVALID_BCS_BYTES) - def is_invalid_bcs_bytes(self) -> bool: - return isinstance(self, CommandArgumentError.INVALID_BCS_BYTES) - def is_INVALID_USAGE_OF_PURE_ARGUMENT(self) -> bool: - return isinstance(self, CommandArgumentError.INVALID_USAGE_OF_PURE_ARGUMENT) - def is_invalid_usage_of_pure_argument(self) -> bool: - return isinstance(self, CommandArgumentError.INVALID_USAGE_OF_PURE_ARGUMENT) - def is_INVALID_ARGUMENT_TO_PRIVATE_ENTRY_FUNCTION(self) -> bool: - return isinstance(self, CommandArgumentError.INVALID_ARGUMENT_TO_PRIVATE_ENTRY_FUNCTION) - def is_invalid_argument_to_private_entry_function(self) -> bool: - return isinstance(self, CommandArgumentError.INVALID_ARGUMENT_TO_PRIVATE_ENTRY_FUNCTION) - def is_INDEX_OUT_OF_BOUNDS(self) -> bool: - return isinstance(self, CommandArgumentError.INDEX_OUT_OF_BOUNDS) - def is_index_out_of_bounds(self) -> bool: - return isinstance(self, CommandArgumentError.INDEX_OUT_OF_BOUNDS) - def is_SECONDARY_INDEX_OUT_OF_BOUNDS(self) -> bool: - return isinstance(self, CommandArgumentError.SECONDARY_INDEX_OUT_OF_BOUNDS) - def is_secondary_index_out_of_bounds(self) -> bool: - return isinstance(self, CommandArgumentError.SECONDARY_INDEX_OUT_OF_BOUNDS) - def is_INVALID_RESULT_ARITY(self) -> bool: - return isinstance(self, CommandArgumentError.INVALID_RESULT_ARITY) - def is_invalid_result_arity(self) -> bool: - return isinstance(self, CommandArgumentError.INVALID_RESULT_ARITY) - def is_INVALID_GAS_COIN_USAGE(self) -> bool: - return isinstance(self, CommandArgumentError.INVALID_GAS_COIN_USAGE) - def is_invalid_gas_coin_usage(self) -> bool: - return isinstance(self, CommandArgumentError.INVALID_GAS_COIN_USAGE) - def is_INVALID_VALUE_USAGE(self) -> bool: - return isinstance(self, CommandArgumentError.INVALID_VALUE_USAGE) - def is_invalid_value_usage(self) -> bool: - return isinstance(self, CommandArgumentError.INVALID_VALUE_USAGE) - def is_INVALID_OBJECT_BY_VALUE(self) -> bool: - return isinstance(self, CommandArgumentError.INVALID_OBJECT_BY_VALUE) - def is_invalid_object_by_value(self) -> bool: - return isinstance(self, CommandArgumentError.INVALID_OBJECT_BY_VALUE) - def is_INVALID_OBJECT_BY_MUT_REF(self) -> bool: - return isinstance(self, CommandArgumentError.INVALID_OBJECT_BY_MUT_REF) - def is_invalid_object_by_mut_ref(self) -> bool: - return isinstance(self, CommandArgumentError.INVALID_OBJECT_BY_MUT_REF) - def is_SHARED_OBJECT_OPERATION_NOT_ALLOWED(self) -> bool: - return isinstance(self, CommandArgumentError.SHARED_OBJECT_OPERATION_NOT_ALLOWED) - def is_shared_object_operation_not_allowed(self) -> bool: - return isinstance(self, CommandArgumentError.SHARED_OBJECT_OPERATION_NOT_ALLOWED) - - -# 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. -CommandArgumentError.TYPE_MISMATCH = type("CommandArgumentError.TYPE_MISMATCH", (CommandArgumentError.TYPE_MISMATCH, CommandArgumentError,), {}) # type: ignore -CommandArgumentError.INVALID_BCS_BYTES = type("CommandArgumentError.INVALID_BCS_BYTES", (CommandArgumentError.INVALID_BCS_BYTES, CommandArgumentError,), {}) # type: ignore -CommandArgumentError.INVALID_USAGE_OF_PURE_ARGUMENT = type("CommandArgumentError.INVALID_USAGE_OF_PURE_ARGUMENT", (CommandArgumentError.INVALID_USAGE_OF_PURE_ARGUMENT, CommandArgumentError,), {}) # type: ignore -CommandArgumentError.INVALID_ARGUMENT_TO_PRIVATE_ENTRY_FUNCTION = type("CommandArgumentError.INVALID_ARGUMENT_TO_PRIVATE_ENTRY_FUNCTION", (CommandArgumentError.INVALID_ARGUMENT_TO_PRIVATE_ENTRY_FUNCTION, CommandArgumentError,), {}) # type: ignore -CommandArgumentError.INDEX_OUT_OF_BOUNDS = type("CommandArgumentError.INDEX_OUT_OF_BOUNDS", (CommandArgumentError.INDEX_OUT_OF_BOUNDS, CommandArgumentError,), {}) # type: ignore -CommandArgumentError.SECONDARY_INDEX_OUT_OF_BOUNDS = type("CommandArgumentError.SECONDARY_INDEX_OUT_OF_BOUNDS", (CommandArgumentError.SECONDARY_INDEX_OUT_OF_BOUNDS, CommandArgumentError,), {}) # type: ignore -CommandArgumentError.INVALID_RESULT_ARITY = type("CommandArgumentError.INVALID_RESULT_ARITY", (CommandArgumentError.INVALID_RESULT_ARITY, CommandArgumentError,), {}) # type: ignore -CommandArgumentError.INVALID_GAS_COIN_USAGE = type("CommandArgumentError.INVALID_GAS_COIN_USAGE", (CommandArgumentError.INVALID_GAS_COIN_USAGE, CommandArgumentError,), {}) # type: ignore -CommandArgumentError.INVALID_VALUE_USAGE = type("CommandArgumentError.INVALID_VALUE_USAGE", (CommandArgumentError.INVALID_VALUE_USAGE, CommandArgumentError,), {}) # type: ignore -CommandArgumentError.INVALID_OBJECT_BY_VALUE = type("CommandArgumentError.INVALID_OBJECT_BY_VALUE", (CommandArgumentError.INVALID_OBJECT_BY_VALUE, CommandArgumentError,), {}) # type: ignore -CommandArgumentError.INVALID_OBJECT_BY_MUT_REF = type("CommandArgumentError.INVALID_OBJECT_BY_MUT_REF", (CommandArgumentError.INVALID_OBJECT_BY_MUT_REF, CommandArgumentError,), {}) # type: ignore -CommandArgumentError.SHARED_OBJECT_OPERATION_NOT_ALLOWED = type("CommandArgumentError.SHARED_OBJECT_OPERATION_NOT_ALLOWED", (CommandArgumentError.SHARED_OBJECT_OPERATION_NOT_ALLOWED, CommandArgumentError,), {}) # type: ignore - - - - -class _UniffiConverterTypeCommandArgumentError(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return CommandArgumentError.TYPE_MISMATCH( - ) - if variant == 2: - return CommandArgumentError.INVALID_BCS_BYTES( - ) - if variant == 3: - return CommandArgumentError.INVALID_USAGE_OF_PURE_ARGUMENT( - ) - if variant == 4: - return CommandArgumentError.INVALID_ARGUMENT_TO_PRIVATE_ENTRY_FUNCTION( - ) - if variant == 5: - return CommandArgumentError.INDEX_OUT_OF_BOUNDS( - _UniffiConverterUInt16.read(buf), - ) - if variant == 6: - return CommandArgumentError.SECONDARY_INDEX_OUT_OF_BOUNDS( - _UniffiConverterUInt16.read(buf), - _UniffiConverterUInt16.read(buf), - ) - if variant == 7: - return CommandArgumentError.INVALID_RESULT_ARITY( - _UniffiConverterUInt16.read(buf), - ) - if variant == 8: - return CommandArgumentError.INVALID_GAS_COIN_USAGE( - ) - if variant == 9: - return CommandArgumentError.INVALID_VALUE_USAGE( - ) - if variant == 10: - return CommandArgumentError.INVALID_OBJECT_BY_VALUE( - ) - if variant == 11: - return CommandArgumentError.INVALID_OBJECT_BY_MUT_REF( - ) - if variant == 12: - return CommandArgumentError.SHARED_OBJECT_OPERATION_NOT_ALLOWED( - ) - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value.is_TYPE_MISMATCH(): - return - if value.is_INVALID_BCS_BYTES(): - return - if value.is_INVALID_USAGE_OF_PURE_ARGUMENT(): - return - if value.is_INVALID_ARGUMENT_TO_PRIVATE_ENTRY_FUNCTION(): - return - if value.is_INDEX_OUT_OF_BOUNDS(): - _UniffiConverterUInt16.check_lower(value.index) - return - if value.is_SECONDARY_INDEX_OUT_OF_BOUNDS(): - _UniffiConverterUInt16.check_lower(value.result) - _UniffiConverterUInt16.check_lower(value.subresult) - return - if value.is_INVALID_RESULT_ARITY(): - _UniffiConverterUInt16.check_lower(value.result) - return - if value.is_INVALID_GAS_COIN_USAGE(): - return - if value.is_INVALID_VALUE_USAGE(): - return - if value.is_INVALID_OBJECT_BY_VALUE(): - return - if value.is_INVALID_OBJECT_BY_MUT_REF(): - return - if value.is_SHARED_OBJECT_OPERATION_NOT_ALLOWED(): - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value.is_TYPE_MISMATCH(): - buf.write_i32(1) - if value.is_INVALID_BCS_BYTES(): - buf.write_i32(2) - if value.is_INVALID_USAGE_OF_PURE_ARGUMENT(): - buf.write_i32(3) - if value.is_INVALID_ARGUMENT_TO_PRIVATE_ENTRY_FUNCTION(): - buf.write_i32(4) - if value.is_INDEX_OUT_OF_BOUNDS(): - buf.write_i32(5) - _UniffiConverterUInt16.write(value.index, buf) - if value.is_SECONDARY_INDEX_OUT_OF_BOUNDS(): - buf.write_i32(6) - _UniffiConverterUInt16.write(value.result, buf) - _UniffiConverterUInt16.write(value.subresult, buf) - if value.is_INVALID_RESULT_ARITY(): - buf.write_i32(7) - _UniffiConverterUInt16.write(value.result, buf) - if value.is_INVALID_GAS_COIN_USAGE(): - buf.write_i32(8) - if value.is_INVALID_VALUE_USAGE(): - buf.write_i32(9) - if value.is_INVALID_OBJECT_BY_VALUE(): - buf.write_i32(10) - if value.is_INVALID_OBJECT_BY_MUT_REF(): - buf.write_i32(11) - if value.is_SHARED_OBJECT_OPERATION_NOT_ALLOWED(): - buf.write_i32(12) - - - - - - - -class ConsensusDeterminedVersionAssignments: - def __init__(self): - raise RuntimeError("ConsensusDeterminedVersionAssignments cannot be instantiated directly") - - # Each enum variant is a nested class of the enum itself. - class CANCELLED_TRANSACTIONS: - """ - Cancelled transaction version assignment. - """ - - cancelled_transactions: "typing.List[CancelledTransaction]" - - def __init__(self,cancelled_transactions: "typing.List[CancelledTransaction]"): - self.cancelled_transactions = cancelled_transactions - - def __str__(self): - return "ConsensusDeterminedVersionAssignments.CANCELLED_TRANSACTIONS(cancelled_transactions={})".format(self.cancelled_transactions) - - def __eq__(self, other): - if not other.is_CANCELLED_TRANSACTIONS(): - return False - if self.cancelled_transactions != other.cancelled_transactions: - return False - return True - - - - # For each variant, we have `is_NAME` and `is_name` methods for easily checking - # whether an instance is that variant. - def is_CANCELLED_TRANSACTIONS(self) -> bool: - return isinstance(self, ConsensusDeterminedVersionAssignments.CANCELLED_TRANSACTIONS) - def is_cancelled_transactions(self) -> bool: - return isinstance(self, ConsensusDeterminedVersionAssignments.CANCELLED_TRANSACTIONS) - - -# 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. -ConsensusDeterminedVersionAssignments.CANCELLED_TRANSACTIONS = type("ConsensusDeterminedVersionAssignments.CANCELLED_TRANSACTIONS", (ConsensusDeterminedVersionAssignments.CANCELLED_TRANSACTIONS, ConsensusDeterminedVersionAssignments,), {}) # type: ignore - - - - -class _UniffiConverterTypeConsensusDeterminedVersionAssignments(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return ConsensusDeterminedVersionAssignments.CANCELLED_TRANSACTIONS( - _UniffiConverterSequenceTypeCancelledTransaction.read(buf), - ) - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value.is_CANCELLED_TRANSACTIONS(): - _UniffiConverterSequenceTypeCancelledTransaction.check_lower(value.cancelled_transactions) - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value.is_CANCELLED_TRANSACTIONS(): - buf.write_i32(1) - _UniffiConverterSequenceTypeCancelledTransaction.write(value.cancelled_transactions, buf) - - - - - - - -class EndOfEpochTransactionKind: - """ - Operation run at the end of an epoch - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - end-of-epoch-transaction-kind = eoe-change-epoch - =/ eoe-authenticator-state-create - =/ eoe-authenticator-state-expire - =/ eoe-randomness-state-create - =/ eoe-deny-list-state-create - =/ eoe-bridge-state-create - =/ eoe-bridge-committee-init - =/ eoe-store-execution-time-observations - - eoe-change-epoch = %x00 change-epoch - eoe-authenticator-state-create = %x01 - eoe-authenticator-state-expire = %x02 authenticator-state-expire - eoe-randomness-state-create = %x03 - eoe-deny-list-state-create = %x04 - eoe-bridge-state-create = %x05 digest - eoe-bridge-committee-init = %x06 u64 - eoe-store-execution-time-observations = %x07 stored-execution-time-observations - ``` - """ - - def __init__(self): - raise RuntimeError("EndOfEpochTransactionKind cannot be instantiated directly") - - # Each enum variant is a nested class of the enum itself. - class CHANGE_EPOCH: - """ - End the epoch and start the next one - """ - - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"EndOfEpochTransactionKind.CHANGE_EPOCH{self._values!r}" - - def __eq__(self, other): - if not other.is_CHANGE_EPOCH(): - return False - return self._values == other._values - class CHANGE_EPOCH_V2: - """ - End the epoch and start the next one - """ - - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"EndOfEpochTransactionKind.CHANGE_EPOCH_V2{self._values!r}" - - def __eq__(self, other): - if not other.is_CHANGE_EPOCH_V2(): - return False - return self._values == other._values - class AUTHENTICATOR_STATE_CREATE: - """ - Create and initialize the authenticator object used for zklogin - """ - - - def __init__(self,): - pass - - def __str__(self): - return "EndOfEpochTransactionKind.AUTHENTICATOR_STATE_CREATE()".format() - - def __eq__(self, other): - if not other.is_AUTHENTICATOR_STATE_CREATE(): - return False - return True - - class AUTHENTICATOR_STATE_EXPIRE: - """ - Expire JWKs used for zklogin - """ - - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"EndOfEpochTransactionKind.AUTHENTICATOR_STATE_EXPIRE{self._values!r}" - - def __eq__(self, other): - if not other.is_AUTHENTICATOR_STATE_EXPIRE(): - return False - return self._values == other._values - class BRIDGE_STATE_CREATE: - """ - Create and initialize the bridge object - """ - - chain_id: "CheckpointDigest" - - def __init__(self,chain_id: "CheckpointDigest"): - self.chain_id = chain_id - - def __str__(self): - return "EndOfEpochTransactionKind.BRIDGE_STATE_CREATE(chain_id={})".format(self.chain_id) - - def __eq__(self, other): - if not other.is_BRIDGE_STATE_CREATE(): - return False - if self.chain_id != other.chain_id: - return False - return True - - class BRIDGE_COMMITTEE_INIT: - """ - Initialize the bridge committee - """ - - bridge_object_version: "int" - - def __init__(self,bridge_object_version: "int"): - self.bridge_object_version = bridge_object_version - - def __str__(self): - return "EndOfEpochTransactionKind.BRIDGE_COMMITTEE_INIT(bridge_object_version={})".format(self.bridge_object_version) - - def __eq__(self, other): - if not other.is_BRIDGE_COMMITTEE_INIT(): - return False - if self.bridge_object_version != other.bridge_object_version: - return False - return True - - class STORE_EXECUTION_TIME_OBSERVATIONS: - """ - Execution time observations from the committee to preserve cross epoch - """ - - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"EndOfEpochTransactionKind.STORE_EXECUTION_TIME_OBSERVATIONS{self._values!r}" - - def __eq__(self, other): - if not other.is_STORE_EXECUTION_TIME_OBSERVATIONS(): - return False - return self._values == other._values - - - # For each variant, we have `is_NAME` and `is_name` methods for easily checking - # whether an instance is that variant. - def is_CHANGE_EPOCH(self) -> bool: - return isinstance(self, EndOfEpochTransactionKind.CHANGE_EPOCH) - def is_change_epoch(self) -> bool: - return isinstance(self, EndOfEpochTransactionKind.CHANGE_EPOCH) - def is_CHANGE_EPOCH_V2(self) -> bool: - return isinstance(self, EndOfEpochTransactionKind.CHANGE_EPOCH_V2) - def is_change_epoch_v2(self) -> bool: - return isinstance(self, EndOfEpochTransactionKind.CHANGE_EPOCH_V2) - def is_AUTHENTICATOR_STATE_CREATE(self) -> bool: - return isinstance(self, EndOfEpochTransactionKind.AUTHENTICATOR_STATE_CREATE) - def is_authenticator_state_create(self) -> bool: - return isinstance(self, EndOfEpochTransactionKind.AUTHENTICATOR_STATE_CREATE) - def is_AUTHENTICATOR_STATE_EXPIRE(self) -> bool: - return isinstance(self, EndOfEpochTransactionKind.AUTHENTICATOR_STATE_EXPIRE) - def is_authenticator_state_expire(self) -> bool: - return isinstance(self, EndOfEpochTransactionKind.AUTHENTICATOR_STATE_EXPIRE) - def is_BRIDGE_STATE_CREATE(self) -> bool: - return isinstance(self, EndOfEpochTransactionKind.BRIDGE_STATE_CREATE) - def is_bridge_state_create(self) -> bool: - return isinstance(self, EndOfEpochTransactionKind.BRIDGE_STATE_CREATE) - def is_BRIDGE_COMMITTEE_INIT(self) -> bool: - return isinstance(self, EndOfEpochTransactionKind.BRIDGE_COMMITTEE_INIT) - def is_bridge_committee_init(self) -> bool: - return isinstance(self, EndOfEpochTransactionKind.BRIDGE_COMMITTEE_INIT) - def is_STORE_EXECUTION_TIME_OBSERVATIONS(self) -> bool: - return isinstance(self, EndOfEpochTransactionKind.STORE_EXECUTION_TIME_OBSERVATIONS) - def is_store_execution_time_observations(self) -> bool: - return isinstance(self, EndOfEpochTransactionKind.STORE_EXECUTION_TIME_OBSERVATIONS) - - -# 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. -EndOfEpochTransactionKind.CHANGE_EPOCH = type("EndOfEpochTransactionKind.CHANGE_EPOCH", (EndOfEpochTransactionKind.CHANGE_EPOCH, EndOfEpochTransactionKind,), {}) # type: ignore -EndOfEpochTransactionKind.CHANGE_EPOCH_V2 = type("EndOfEpochTransactionKind.CHANGE_EPOCH_V2", (EndOfEpochTransactionKind.CHANGE_EPOCH_V2, EndOfEpochTransactionKind,), {}) # type: ignore -EndOfEpochTransactionKind.AUTHENTICATOR_STATE_CREATE = type("EndOfEpochTransactionKind.AUTHENTICATOR_STATE_CREATE", (EndOfEpochTransactionKind.AUTHENTICATOR_STATE_CREATE, EndOfEpochTransactionKind,), {}) # type: ignore -EndOfEpochTransactionKind.AUTHENTICATOR_STATE_EXPIRE = type("EndOfEpochTransactionKind.AUTHENTICATOR_STATE_EXPIRE", (EndOfEpochTransactionKind.AUTHENTICATOR_STATE_EXPIRE, EndOfEpochTransactionKind,), {}) # type: ignore -EndOfEpochTransactionKind.BRIDGE_STATE_CREATE = type("EndOfEpochTransactionKind.BRIDGE_STATE_CREATE", (EndOfEpochTransactionKind.BRIDGE_STATE_CREATE, EndOfEpochTransactionKind,), {}) # type: ignore -EndOfEpochTransactionKind.BRIDGE_COMMITTEE_INIT = type("EndOfEpochTransactionKind.BRIDGE_COMMITTEE_INIT", (EndOfEpochTransactionKind.BRIDGE_COMMITTEE_INIT, EndOfEpochTransactionKind,), {}) # type: ignore -EndOfEpochTransactionKind.STORE_EXECUTION_TIME_OBSERVATIONS = type("EndOfEpochTransactionKind.STORE_EXECUTION_TIME_OBSERVATIONS", (EndOfEpochTransactionKind.STORE_EXECUTION_TIME_OBSERVATIONS, EndOfEpochTransactionKind,), {}) # type: ignore - - - - -class _UniffiConverterTypeEndOfEpochTransactionKind(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return EndOfEpochTransactionKind.CHANGE_EPOCH( - _UniffiConverterTypeChangeEpoch.read(buf), - ) - if variant == 2: - return EndOfEpochTransactionKind.CHANGE_EPOCH_V2( - _UniffiConverterTypeChangeEpochV2.read(buf), - ) - if variant == 3: - return EndOfEpochTransactionKind.AUTHENTICATOR_STATE_CREATE( - ) - if variant == 4: - return EndOfEpochTransactionKind.AUTHENTICATOR_STATE_EXPIRE( - _UniffiConverterTypeAuthenticatorStateExpire.read(buf), - ) - if variant == 5: - return EndOfEpochTransactionKind.BRIDGE_STATE_CREATE( - _UniffiConverterTypeCheckpointDigest.read(buf), - ) - if variant == 6: - return EndOfEpochTransactionKind.BRIDGE_COMMITTEE_INIT( - _UniffiConverterUInt64.read(buf), - ) - if variant == 7: - return EndOfEpochTransactionKind.STORE_EXECUTION_TIME_OBSERVATIONS( - _UniffiConverterTypeExecutionTimeObservations.read(buf), - ) - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value.is_CHANGE_EPOCH(): - _UniffiConverterTypeChangeEpoch.check_lower(value._values[0]) - return - if value.is_CHANGE_EPOCH_V2(): - _UniffiConverterTypeChangeEpochV2.check_lower(value._values[0]) - return - if value.is_AUTHENTICATOR_STATE_CREATE(): - return - if value.is_AUTHENTICATOR_STATE_EXPIRE(): - _UniffiConverterTypeAuthenticatorStateExpire.check_lower(value._values[0]) - return - if value.is_BRIDGE_STATE_CREATE(): - _UniffiConverterTypeCheckpointDigest.check_lower(value.chain_id) - return - if value.is_BRIDGE_COMMITTEE_INIT(): - _UniffiConverterUInt64.check_lower(value.bridge_object_version) - return - if value.is_STORE_EXECUTION_TIME_OBSERVATIONS(): - _UniffiConverterTypeExecutionTimeObservations.check_lower(value._values[0]) - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value.is_CHANGE_EPOCH(): - buf.write_i32(1) - _UniffiConverterTypeChangeEpoch.write(value._values[0], buf) - if value.is_CHANGE_EPOCH_V2(): - buf.write_i32(2) - _UniffiConverterTypeChangeEpochV2.write(value._values[0], buf) - if value.is_AUTHENTICATOR_STATE_CREATE(): - buf.write_i32(3) - if value.is_AUTHENTICATOR_STATE_EXPIRE(): - buf.write_i32(4) - _UniffiConverterTypeAuthenticatorStateExpire.write(value._values[0], buf) - if value.is_BRIDGE_STATE_CREATE(): - buf.write_i32(5) - _UniffiConverterTypeCheckpointDigest.write(value.chain_id, buf) - if value.is_BRIDGE_COMMITTEE_INIT(): - buf.write_i32(6) - _UniffiConverterUInt64.write(value.bridge_object_version, buf) - if value.is_STORE_EXECUTION_TIME_OBSERVATIONS(): - buf.write_i32(7) - _UniffiConverterTypeExecutionTimeObservations.write(value._values[0], buf) - - - - - - - -class ExecutionError: - """ - An error that can occur during the execution of a transaction - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - - execution-error = insufficient-gas - =/ invalid-gas-object - =/ invariant-violation - =/ feature-not-yet-supported - =/ object-too-big - =/ package-too-big - =/ circular-object-ownership - =/ insufficient-coin-balance - =/ coin-balance-overflow - =/ publish-error-non-zero-address - =/ iota-move-verification-error - =/ move-primitive-runtime-error - =/ move-abort - =/ vm-verification-or-deserialization-error - =/ vm-invariant-violation - =/ function-not-found - =/ arity-mismatch - =/ type-arity-mismatch - =/ non-entry-function-invoked - =/ command-argument-error - =/ type-argument-error - =/ unused-value-without-drop - =/ invalid-public-function-return-type - =/ invalid-transfer-object - =/ effects-too-large - =/ publish-upgrade-missing-dependency - =/ publish-upgrade-dependency-downgrade - =/ package-upgrade-error - =/ written-objects-too-large - =/ certificate-denied - =/ iota-move-verification-timeout - =/ shared-object-operation-not-allowed - =/ input-object-deleted - =/ execution-cancelled-due-to-shared-object-congestion - =/ address-denied-for-coin - =/ coin-type-global-pause - =/ execution-cancelled-due-to-randomness-unavailable - - insufficient-gas = %x00 - invalid-gas-object = %x01 - invariant-violation = %x02 - feature-not-yet-supported = %x03 - object-too-big = %x04 u64 u64 - package-too-big = %x05 u64 u64 - circular-object-ownership = %x06 object-id - insufficient-coin-balance = %x07 - coin-balance-overflow = %x08 - publish-error-non-zero-address = %x09 - iota-move-verification-error = %x0a - move-primitive-runtime-error = %x0b (option move-location) - move-abort = %x0c move-location u64 - vm-verification-or-deserialization-error = %x0d - vm-invariant-violation = %x0e - function-not-found = %x0f - arity-mismatch = %x10 - type-arity-mismatch = %x11 - non-entry-function-invoked = %x12 - command-argument-error = %x13 u16 command-argument-error - type-argument-error = %x14 u16 type-argument-error - unused-value-without-drop = %x15 u16 u16 - invalid-public-function-return-type = %x16 u16 - invalid-transfer-object = %x17 - effects-too-large = %x18 u64 u64 - publish-upgrade-missing-dependency = %x19 - publish-upgrade-dependency-downgrade = %x1a - package-upgrade-error = %x1b package-upgrade-error - written-objects-too-large = %x1c u64 u64 - certificate-denied = %x1d - iota-move-verification-timeout = %x1e - shared-object-operation-not-allowed = %x1f - input-object-deleted = %x20 - execution-cancelled-due-to-shared-object-congestion = %x21 (vector object-id) - address-denied-for-coin = %x22 address string - coin-type-global-pause = %x23 string - execution-cancelled-due-to-randomness-unavailable = %x24 - ``` - """ - - def __init__(self): - raise RuntimeError("ExecutionError cannot be instantiated directly") - - # Each enum variant is a nested class of the enum itself. - class INSUFFICIENT_GAS: - """ - Insufficient Gas - """ - - - def __init__(self,): - pass - - def __str__(self): - return "ExecutionError.INSUFFICIENT_GAS()".format() - - def __eq__(self, other): - if not other.is_INSUFFICIENT_GAS(): - return False - return True - - class INVALID_GAS_OBJECT: - """ - Invalid Gas Object. - """ - - - def __init__(self,): - pass - - def __str__(self): - return "ExecutionError.INVALID_GAS_OBJECT()".format() - - def __eq__(self, other): - if not other.is_INVALID_GAS_OBJECT(): - return False - return True - - class INVARIANT_VIOLATION: - """ - Invariant Violation - """ - - - def __init__(self,): - pass - - def __str__(self): - return "ExecutionError.INVARIANT_VIOLATION()".format() - - def __eq__(self, other): - if not other.is_INVARIANT_VIOLATION(): - return False - return True - - class FEATURE_NOT_YET_SUPPORTED: - """ - Attempted to used feature that is not supported yet - """ - - - def __init__(self,): - pass - - def __str__(self): - return "ExecutionError.FEATURE_NOT_YET_SUPPORTED()".format() - - def __eq__(self, other): - if not other.is_FEATURE_NOT_YET_SUPPORTED(): - return False - return True - - class OBJECT_TOO_BIG: - """ - Move object is larger than the maximum allowed size - """ - - object_size: "int" - max_object_size: "int" - - def __init__(self,object_size: "int", max_object_size: "int"): - self.object_size = object_size - self.max_object_size = max_object_size - - def __str__(self): - return "ExecutionError.OBJECT_TOO_BIG(object_size={}, max_object_size={})".format(self.object_size, self.max_object_size) - - def __eq__(self, other): - if not other.is_OBJECT_TOO_BIG(): - return False - if self.object_size != other.object_size: - return False - if self.max_object_size != other.max_object_size: - return False - return True - - class PACKAGE_TOO_BIG: - """ - Package is larger than the maximum allowed size - """ - - object_size: "int" - max_object_size: "int" - - def __init__(self,object_size: "int", max_object_size: "int"): - self.object_size = object_size - self.max_object_size = max_object_size - - def __str__(self): - return "ExecutionError.PACKAGE_TOO_BIG(object_size={}, max_object_size={})".format(self.object_size, self.max_object_size) - - def __eq__(self, other): - if not other.is_PACKAGE_TOO_BIG(): - return False - if self.object_size != other.object_size: - return False - if self.max_object_size != other.max_object_size: - return False - return True - - class CIRCULAR_OBJECT_OWNERSHIP: - """ - Circular Object Ownership - """ - - object: "ObjectId" - - def __init__(self,object: "ObjectId"): - self.object = object - - def __str__(self): - return "ExecutionError.CIRCULAR_OBJECT_OWNERSHIP(object={})".format(self.object) - - def __eq__(self, other): - if not other.is_CIRCULAR_OBJECT_OWNERSHIP(): - return False - if self.object != other.object: - return False - return True - - class INSUFFICIENT_COIN_BALANCE: - """ - Insufficient coin balance for requested operation - """ - - - def __init__(self,): - pass - - def __str__(self): - return "ExecutionError.INSUFFICIENT_COIN_BALANCE()".format() - - def __eq__(self, other): - if not other.is_INSUFFICIENT_COIN_BALANCE(): - return False - return True - - class COIN_BALANCE_OVERFLOW: - """ - Coin balance overflowed an u64 - """ - - - def __init__(self,): - pass - - def __str__(self): - return "ExecutionError.COIN_BALANCE_OVERFLOW()".format() - - def __eq__(self, other): - if not other.is_COIN_BALANCE_OVERFLOW(): - return False - return True - - class PUBLISH_ERROR_NON_ZERO_ADDRESS: - """ - Publish Error, Non-zero Address. - The modules in the package must have their self-addresses set to zero. - """ - - - def __init__(self,): - pass - - def __str__(self): - return "ExecutionError.PUBLISH_ERROR_NON_ZERO_ADDRESS()".format() - - def __eq__(self, other): - if not other.is_PUBLISH_ERROR_NON_ZERO_ADDRESS(): - return False - return True - - class IOTA_MOVE_VERIFICATION_ERROR: - """ - IOTA Move Bytecode Verification Error. - """ - - - def __init__(self,): - pass - - def __str__(self): - return "ExecutionError.IOTA_MOVE_VERIFICATION_ERROR()".format() - - def __eq__(self, other): - if not other.is_IOTA_MOVE_VERIFICATION_ERROR(): - return False - return True - - class MOVE_PRIMITIVE_RUNTIME_ERROR: - """ - Error from a non-abort instruction. - Possible causes: - Arithmetic error, stack overflow, max value depth, etc." - """ - - location: "typing.Optional[MoveLocation]" - - def __init__(self,location: "typing.Optional[MoveLocation]"): - self.location = location - - def __str__(self): - return "ExecutionError.MOVE_PRIMITIVE_RUNTIME_ERROR(location={})".format(self.location) - - def __eq__(self, other): - if not other.is_MOVE_PRIMITIVE_RUNTIME_ERROR(): - return False - if self.location != other.location: - return False - return True - - class MOVE_ABORT: - """ - Move runtime abort - """ - - location: "MoveLocation" - code: "int" - - def __init__(self,location: "MoveLocation", code: "int"): - self.location = location - self.code = code - - def __str__(self): - return "ExecutionError.MOVE_ABORT(location={}, code={})".format(self.location, self.code) - - def __eq__(self, other): - if not other.is_MOVE_ABORT(): - return False - if self.location != other.location: - return False - if self.code != other.code: - return False - return True - - class VM_VERIFICATION_OR_DESERIALIZATION_ERROR: - """ - Bytecode verification error. - """ - - - def __init__(self,): - pass - - def __str__(self): - return "ExecutionError.VM_VERIFICATION_OR_DESERIALIZATION_ERROR()".format() - - def __eq__(self, other): - if not other.is_VM_VERIFICATION_OR_DESERIALIZATION_ERROR(): - return False - return True - - class VM_INVARIANT_VIOLATION: - """ - MoveVm invariant violation - """ - - - def __init__(self,): - pass - - def __str__(self): - return "ExecutionError.VM_INVARIANT_VIOLATION()".format() - - def __eq__(self, other): - if not other.is_VM_INVARIANT_VIOLATION(): - return False - return True - - class FUNCTION_NOT_FOUND: - """ - Function not found - """ - - - def __init__(self,): - pass - - def __str__(self): - return "ExecutionError.FUNCTION_NOT_FOUND()".format() - - def __eq__(self, other): - if not other.is_FUNCTION_NOT_FOUND(): - return False - return True - - class ARITY_MISMATCH: - """ - Arity mismatch for Move function. - The number of arguments does not match the number of parameters - """ - - - def __init__(self,): - pass - - def __str__(self): - return "ExecutionError.ARITY_MISMATCH()".format() - - def __eq__(self, other): - if not other.is_ARITY_MISMATCH(): - return False - return True - - class TYPE_ARITY_MISMATCH: - """ - Type arity mismatch for Move function. - Mismatch between the number of actual versus expected type arguments. - """ - - - def __init__(self,): - pass - - def __str__(self): - return "ExecutionError.TYPE_ARITY_MISMATCH()".format() - - def __eq__(self, other): - if not other.is_TYPE_ARITY_MISMATCH(): - return False - return True - - class NON_ENTRY_FUNCTION_INVOKED: - """ - Non Entry Function Invoked. Move Call must start with an entry function. - """ - - - def __init__(self,): - pass - - def __str__(self): - return "ExecutionError.NON_ENTRY_FUNCTION_INVOKED()".format() - - def __eq__(self, other): - if not other.is_NON_ENTRY_FUNCTION_INVOKED(): - return False - return True - - class COMMAND_ARGUMENT_ERROR: - """ - Invalid command argument - """ - - argument: "int" - kind: "CommandArgumentError" - - def __init__(self,argument: "int", kind: "CommandArgumentError"): - self.argument = argument - self.kind = kind - - def __str__(self): - return "ExecutionError.COMMAND_ARGUMENT_ERROR(argument={}, kind={})".format(self.argument, self.kind) - - def __eq__(self, other): - if not other.is_COMMAND_ARGUMENT_ERROR(): - return False - if self.argument != other.argument: - return False - if self.kind != other.kind: - return False - return True - - class TYPE_ARGUMENT_ERROR: - """ - Type argument error - """ - - type_argument: "int" - """ - Index of the problematic type argument - """ - - kind: "TypeArgumentError" - - def __init__(self,type_argument: "int", kind: "TypeArgumentError"): - self.type_argument = type_argument - self.kind = kind - - def __str__(self): - return "ExecutionError.TYPE_ARGUMENT_ERROR(type_argument={}, kind={})".format(self.type_argument, self.kind) - - def __eq__(self, other): - if not other.is_TYPE_ARGUMENT_ERROR(): - return False - if self.type_argument != other.type_argument: - return False - if self.kind != other.kind: - return False - return True - - class UNUSED_VALUE_WITHOUT_DROP: - """ - Unused result without the drop ability. - """ - - result: "int" - subresult: "int" - - def __init__(self,result: "int", subresult: "int"): - self.result = result - self.subresult = subresult - - def __str__(self): - return "ExecutionError.UNUSED_VALUE_WITHOUT_DROP(result={}, subresult={})".format(self.result, self.subresult) - - def __eq__(self, other): - if not other.is_UNUSED_VALUE_WITHOUT_DROP(): - return False - if self.result != other.result: - return False - if self.subresult != other.subresult: - return False - return True - - class INVALID_PUBLIC_FUNCTION_RETURN_TYPE: - """ - Invalid public Move function signature. - Unsupported return type for return value - """ - - index: "int" - - def __init__(self,index: "int"): - self.index = index - - def __str__(self): - return "ExecutionError.INVALID_PUBLIC_FUNCTION_RETURN_TYPE(index={})".format(self.index) - - def __eq__(self, other): - if not other.is_INVALID_PUBLIC_FUNCTION_RETURN_TYPE(): - return False - if self.index != other.index: - return False - return True - - class INVALID_TRANSFER_OBJECT: - """ - Invalid Transfer Object, object does not have public transfer. - """ - - - def __init__(self,): - pass - - def __str__(self): - return "ExecutionError.INVALID_TRANSFER_OBJECT()".format() - - def __eq__(self, other): - if not other.is_INVALID_TRANSFER_OBJECT(): - return False - return True - - class EFFECTS_TOO_LARGE: - """ - Effects from the transaction are too large - """ - - current_size: "int" - max_size: "int" - - def __init__(self,current_size: "int", max_size: "int"): - self.current_size = current_size - self.max_size = max_size - - def __str__(self): - return "ExecutionError.EFFECTS_TOO_LARGE(current_size={}, max_size={})".format(self.current_size, self.max_size) - - def __eq__(self, other): - if not other.is_EFFECTS_TOO_LARGE(): - return False - if self.current_size != other.current_size: - return False - if self.max_size != other.max_size: - return False - return True - - class PUBLISH_UPGRADE_MISSING_DEPENDENCY: - """ - Publish or Upgrade is missing dependency - """ - - - def __init__(self,): - pass - - def __str__(self): - return "ExecutionError.PUBLISH_UPGRADE_MISSING_DEPENDENCY()".format() - - def __eq__(self, other): - if not other.is_PUBLISH_UPGRADE_MISSING_DEPENDENCY(): - return False - return True - - class PUBLISH_UPGRADE_DEPENDENCY_DOWNGRADE: - """ - Publish or Upgrade dependency downgrade. - - Indirect (transitive) dependency of published or upgraded package has - been assigned an on-chain version that is less than the version - required by one of the package's transitive dependencies. - """ - - - def __init__(self,): - pass - - def __str__(self): - return "ExecutionError.PUBLISH_UPGRADE_DEPENDENCY_DOWNGRADE()".format() - - def __eq__(self, other): - if not other.is_PUBLISH_UPGRADE_DEPENDENCY_DOWNGRADE(): - return False - return True - - class PACKAGE_UPGRADE_ERROR: - """ - Invalid package upgrade - """ - - kind: "PackageUpgradeError" - - def __init__(self,kind: "PackageUpgradeError"): - self.kind = kind - - def __str__(self): - return "ExecutionError.PACKAGE_UPGRADE_ERROR(kind={})".format(self.kind) - - def __eq__(self, other): - if not other.is_PACKAGE_UPGRADE_ERROR(): - return False - if self.kind != other.kind: - return False - return True - - class WRITTEN_OBJECTS_TOO_LARGE: - """ - Indicates the transaction tried to write objects too large to storage - """ - - object_size: "int" - max_object_size: "int" - - def __init__(self,object_size: "int", max_object_size: "int"): - self.object_size = object_size - self.max_object_size = max_object_size - - def __str__(self): - return "ExecutionError.WRITTEN_OBJECTS_TOO_LARGE(object_size={}, max_object_size={})".format(self.object_size, self.max_object_size) - - def __eq__(self, other): - if not other.is_WRITTEN_OBJECTS_TOO_LARGE(): - return False - if self.object_size != other.object_size: - return False - if self.max_object_size != other.max_object_size: - return False - return True - - class CERTIFICATE_DENIED: - """ - Certificate is on the deny list - """ - - - def __init__(self,): - pass - - def __str__(self): - return "ExecutionError.CERTIFICATE_DENIED()".format() - - def __eq__(self, other): - if not other.is_CERTIFICATE_DENIED(): - return False - return True - - class IOTA_MOVE_VERIFICATION_TIMEOUT: - """ - IOTA Move Bytecode verification timed out. - """ - - - def __init__(self,): - pass - - def __str__(self): - return "ExecutionError.IOTA_MOVE_VERIFICATION_TIMEOUT()".format() - - def __eq__(self, other): - if not other.is_IOTA_MOVE_VERIFICATION_TIMEOUT(): - return False - return True - - class SHARED_OBJECT_OPERATION_NOT_ALLOWED: - """ - The requested shared object operation is not allowed - """ - - - def __init__(self,): - pass - - def __str__(self): - return "ExecutionError.SHARED_OBJECT_OPERATION_NOT_ALLOWED()".format() - - def __eq__(self, other): - if not other.is_SHARED_OBJECT_OPERATION_NOT_ALLOWED(): - return False - return True - - class INPUT_OBJECT_DELETED: - """ - Requested shared object has been deleted - """ - - - def __init__(self,): - pass - - def __str__(self): - return "ExecutionError.INPUT_OBJECT_DELETED()".format() - - def __eq__(self, other): - if not other.is_INPUT_OBJECT_DELETED(): - return False - return True - - class EXECUTION_CANCELLED_DUE_TO_SHARED_OBJECT_CONGESTION: - """ - Certificate is cancelled due to congestion on shared objects - """ - - congested_objects: "typing.List[ObjectId]" - - def __init__(self,congested_objects: "typing.List[ObjectId]"): - self.congested_objects = congested_objects - - def __str__(self): - return "ExecutionError.EXECUTION_CANCELLED_DUE_TO_SHARED_OBJECT_CONGESTION(congested_objects={})".format(self.congested_objects) - - def __eq__(self, other): - if not other.is_EXECUTION_CANCELLED_DUE_TO_SHARED_OBJECT_CONGESTION(): - return False - if self.congested_objects != other.congested_objects: - return False - return True - - class ADDRESS_DENIED_FOR_COIN: - """ - Address is denied for this coin type - """ - - address: "Address" - coin_type: "str" - - def __init__(self,address: "Address", coin_type: "str"): - self.address = address - self.coin_type = coin_type - - def __str__(self): - return "ExecutionError.ADDRESS_DENIED_FOR_COIN(address={}, coin_type={})".format(self.address, self.coin_type) - - def __eq__(self, other): - if not other.is_ADDRESS_DENIED_FOR_COIN(): - return False - if self.address != other.address: - return False - if self.coin_type != other.coin_type: - return False - return True - - class COIN_TYPE_GLOBAL_PAUSE: - """ - Coin type is globally paused for use - """ - - coin_type: "str" - - def __init__(self,coin_type: "str"): - self.coin_type = coin_type - - def __str__(self): - return "ExecutionError.COIN_TYPE_GLOBAL_PAUSE(coin_type={})".format(self.coin_type) - - def __eq__(self, other): - if not other.is_COIN_TYPE_GLOBAL_PAUSE(): - return False - if self.coin_type != other.coin_type: - return False - return True - - class EXECUTION_CANCELLED_DUE_TO_RANDOMNESS_UNAVAILABLE: - """ - Certificate is cancelled because randomness could not be generated this - epoch - """ - - - def __init__(self,): - pass - - def __str__(self): - return "ExecutionError.EXECUTION_CANCELLED_DUE_TO_RANDOMNESS_UNAVAILABLE()".format() - - def __eq__(self, other): - if not other.is_EXECUTION_CANCELLED_DUE_TO_RANDOMNESS_UNAVAILABLE(): - return False - return True - - - - # For each variant, we have `is_NAME` and `is_name` methods for easily checking - # whether an instance is that variant. - def is_INSUFFICIENT_GAS(self) -> bool: - return isinstance(self, ExecutionError.INSUFFICIENT_GAS) - def is_insufficient_gas(self) -> bool: - return isinstance(self, ExecutionError.INSUFFICIENT_GAS) - def is_INVALID_GAS_OBJECT(self) -> bool: - return isinstance(self, ExecutionError.INVALID_GAS_OBJECT) - def is_invalid_gas_object(self) -> bool: - return isinstance(self, ExecutionError.INVALID_GAS_OBJECT) - def is_INVARIANT_VIOLATION(self) -> bool: - return isinstance(self, ExecutionError.INVARIANT_VIOLATION) - def is_invariant_violation(self) -> bool: - return isinstance(self, ExecutionError.INVARIANT_VIOLATION) - def is_FEATURE_NOT_YET_SUPPORTED(self) -> bool: - return isinstance(self, ExecutionError.FEATURE_NOT_YET_SUPPORTED) - def is_feature_not_yet_supported(self) -> bool: - return isinstance(self, ExecutionError.FEATURE_NOT_YET_SUPPORTED) - def is_OBJECT_TOO_BIG(self) -> bool: - return isinstance(self, ExecutionError.OBJECT_TOO_BIG) - def is_object_too_big(self) -> bool: - return isinstance(self, ExecutionError.OBJECT_TOO_BIG) - def is_PACKAGE_TOO_BIG(self) -> bool: - return isinstance(self, ExecutionError.PACKAGE_TOO_BIG) - def is_package_too_big(self) -> bool: - return isinstance(self, ExecutionError.PACKAGE_TOO_BIG) - def is_CIRCULAR_OBJECT_OWNERSHIP(self) -> bool: - return isinstance(self, ExecutionError.CIRCULAR_OBJECT_OWNERSHIP) - def is_circular_object_ownership(self) -> bool: - return isinstance(self, ExecutionError.CIRCULAR_OBJECT_OWNERSHIP) - def is_INSUFFICIENT_COIN_BALANCE(self) -> bool: - return isinstance(self, ExecutionError.INSUFFICIENT_COIN_BALANCE) - def is_insufficient_coin_balance(self) -> bool: - return isinstance(self, ExecutionError.INSUFFICIENT_COIN_BALANCE) - def is_COIN_BALANCE_OVERFLOW(self) -> bool: - return isinstance(self, ExecutionError.COIN_BALANCE_OVERFLOW) - def is_coin_balance_overflow(self) -> bool: - return isinstance(self, ExecutionError.COIN_BALANCE_OVERFLOW) - def is_PUBLISH_ERROR_NON_ZERO_ADDRESS(self) -> bool: - return isinstance(self, ExecutionError.PUBLISH_ERROR_NON_ZERO_ADDRESS) - def is_publish_error_non_zero_address(self) -> bool: - return isinstance(self, ExecutionError.PUBLISH_ERROR_NON_ZERO_ADDRESS) - def is_IOTA_MOVE_VERIFICATION_ERROR(self) -> bool: - return isinstance(self, ExecutionError.IOTA_MOVE_VERIFICATION_ERROR) - def is_iota_move_verification_error(self) -> bool: - return isinstance(self, ExecutionError.IOTA_MOVE_VERIFICATION_ERROR) - def is_MOVE_PRIMITIVE_RUNTIME_ERROR(self) -> bool: - return isinstance(self, ExecutionError.MOVE_PRIMITIVE_RUNTIME_ERROR) - def is_move_primitive_runtime_error(self) -> bool: - return isinstance(self, ExecutionError.MOVE_PRIMITIVE_RUNTIME_ERROR) - def is_MOVE_ABORT(self) -> bool: - return isinstance(self, ExecutionError.MOVE_ABORT) - def is_move_abort(self) -> bool: - return isinstance(self, ExecutionError.MOVE_ABORT) - def is_VM_VERIFICATION_OR_DESERIALIZATION_ERROR(self) -> bool: - return isinstance(self, ExecutionError.VM_VERIFICATION_OR_DESERIALIZATION_ERROR) - def is_vm_verification_or_deserialization_error(self) -> bool: - return isinstance(self, ExecutionError.VM_VERIFICATION_OR_DESERIALIZATION_ERROR) - def is_VM_INVARIANT_VIOLATION(self) -> bool: - return isinstance(self, ExecutionError.VM_INVARIANT_VIOLATION) - def is_vm_invariant_violation(self) -> bool: - return isinstance(self, ExecutionError.VM_INVARIANT_VIOLATION) - def is_FUNCTION_NOT_FOUND(self) -> bool: - return isinstance(self, ExecutionError.FUNCTION_NOT_FOUND) - def is_function_not_found(self) -> bool: - return isinstance(self, ExecutionError.FUNCTION_NOT_FOUND) - def is_ARITY_MISMATCH(self) -> bool: - return isinstance(self, ExecutionError.ARITY_MISMATCH) - def is_arity_mismatch(self) -> bool: - return isinstance(self, ExecutionError.ARITY_MISMATCH) - def is_TYPE_ARITY_MISMATCH(self) -> bool: - return isinstance(self, ExecutionError.TYPE_ARITY_MISMATCH) - def is_type_arity_mismatch(self) -> bool: - return isinstance(self, ExecutionError.TYPE_ARITY_MISMATCH) - def is_NON_ENTRY_FUNCTION_INVOKED(self) -> bool: - return isinstance(self, ExecutionError.NON_ENTRY_FUNCTION_INVOKED) - def is_non_entry_function_invoked(self) -> bool: - return isinstance(self, ExecutionError.NON_ENTRY_FUNCTION_INVOKED) - def is_COMMAND_ARGUMENT_ERROR(self) -> bool: - return isinstance(self, ExecutionError.COMMAND_ARGUMENT_ERROR) - def is_command_argument_error(self) -> bool: - return isinstance(self, ExecutionError.COMMAND_ARGUMENT_ERROR) - def is_TYPE_ARGUMENT_ERROR(self) -> bool: - return isinstance(self, ExecutionError.TYPE_ARGUMENT_ERROR) - def is_type_argument_error(self) -> bool: - return isinstance(self, ExecutionError.TYPE_ARGUMENT_ERROR) - def is_UNUSED_VALUE_WITHOUT_DROP(self) -> bool: - return isinstance(self, ExecutionError.UNUSED_VALUE_WITHOUT_DROP) - def is_unused_value_without_drop(self) -> bool: - return isinstance(self, ExecutionError.UNUSED_VALUE_WITHOUT_DROP) - def is_INVALID_PUBLIC_FUNCTION_RETURN_TYPE(self) -> bool: - return isinstance(self, ExecutionError.INVALID_PUBLIC_FUNCTION_RETURN_TYPE) - def is_invalid_public_function_return_type(self) -> bool: - return isinstance(self, ExecutionError.INVALID_PUBLIC_FUNCTION_RETURN_TYPE) - def is_INVALID_TRANSFER_OBJECT(self) -> bool: - return isinstance(self, ExecutionError.INVALID_TRANSFER_OBJECT) - def is_invalid_transfer_object(self) -> bool: - return isinstance(self, ExecutionError.INVALID_TRANSFER_OBJECT) - def is_EFFECTS_TOO_LARGE(self) -> bool: - return isinstance(self, ExecutionError.EFFECTS_TOO_LARGE) - def is_effects_too_large(self) -> bool: - return isinstance(self, ExecutionError.EFFECTS_TOO_LARGE) - def is_PUBLISH_UPGRADE_MISSING_DEPENDENCY(self) -> bool: - return isinstance(self, ExecutionError.PUBLISH_UPGRADE_MISSING_DEPENDENCY) - def is_publish_upgrade_missing_dependency(self) -> bool: - return isinstance(self, ExecutionError.PUBLISH_UPGRADE_MISSING_DEPENDENCY) - def is_PUBLISH_UPGRADE_DEPENDENCY_DOWNGRADE(self) -> bool: - return isinstance(self, ExecutionError.PUBLISH_UPGRADE_DEPENDENCY_DOWNGRADE) - def is_publish_upgrade_dependency_downgrade(self) -> bool: - return isinstance(self, ExecutionError.PUBLISH_UPGRADE_DEPENDENCY_DOWNGRADE) - def is_PACKAGE_UPGRADE_ERROR(self) -> bool: - return isinstance(self, ExecutionError.PACKAGE_UPGRADE_ERROR) - def is_package_upgrade_error(self) -> bool: - return isinstance(self, ExecutionError.PACKAGE_UPGRADE_ERROR) - def is_WRITTEN_OBJECTS_TOO_LARGE(self) -> bool: - return isinstance(self, ExecutionError.WRITTEN_OBJECTS_TOO_LARGE) - def is_written_objects_too_large(self) -> bool: - return isinstance(self, ExecutionError.WRITTEN_OBJECTS_TOO_LARGE) - def is_CERTIFICATE_DENIED(self) -> bool: - return isinstance(self, ExecutionError.CERTIFICATE_DENIED) - def is_certificate_denied(self) -> bool: - return isinstance(self, ExecutionError.CERTIFICATE_DENIED) - def is_IOTA_MOVE_VERIFICATION_TIMEOUT(self) -> bool: - return isinstance(self, ExecutionError.IOTA_MOVE_VERIFICATION_TIMEOUT) - def is_iota_move_verification_timeout(self) -> bool: - return isinstance(self, ExecutionError.IOTA_MOVE_VERIFICATION_TIMEOUT) - def is_SHARED_OBJECT_OPERATION_NOT_ALLOWED(self) -> bool: - return isinstance(self, ExecutionError.SHARED_OBJECT_OPERATION_NOT_ALLOWED) - def is_shared_object_operation_not_allowed(self) -> bool: - return isinstance(self, ExecutionError.SHARED_OBJECT_OPERATION_NOT_ALLOWED) - def is_INPUT_OBJECT_DELETED(self) -> bool: - return isinstance(self, ExecutionError.INPUT_OBJECT_DELETED) - def is_input_object_deleted(self) -> bool: - return isinstance(self, ExecutionError.INPUT_OBJECT_DELETED) - def is_EXECUTION_CANCELLED_DUE_TO_SHARED_OBJECT_CONGESTION(self) -> bool: - return isinstance(self, ExecutionError.EXECUTION_CANCELLED_DUE_TO_SHARED_OBJECT_CONGESTION) - def is_execution_cancelled_due_to_shared_object_congestion(self) -> bool: - return isinstance(self, ExecutionError.EXECUTION_CANCELLED_DUE_TO_SHARED_OBJECT_CONGESTION) - def is_ADDRESS_DENIED_FOR_COIN(self) -> bool: - return isinstance(self, ExecutionError.ADDRESS_DENIED_FOR_COIN) - def is_address_denied_for_coin(self) -> bool: - return isinstance(self, ExecutionError.ADDRESS_DENIED_FOR_COIN) - def is_COIN_TYPE_GLOBAL_PAUSE(self) -> bool: - return isinstance(self, ExecutionError.COIN_TYPE_GLOBAL_PAUSE) - def is_coin_type_global_pause(self) -> bool: - return isinstance(self, ExecutionError.COIN_TYPE_GLOBAL_PAUSE) - def is_EXECUTION_CANCELLED_DUE_TO_RANDOMNESS_UNAVAILABLE(self) -> bool: - return isinstance(self, ExecutionError.EXECUTION_CANCELLED_DUE_TO_RANDOMNESS_UNAVAILABLE) - def is_execution_cancelled_due_to_randomness_unavailable(self) -> bool: - return isinstance(self, ExecutionError.EXECUTION_CANCELLED_DUE_TO_RANDOMNESS_UNAVAILABLE) - - -# 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. -ExecutionError.INSUFFICIENT_GAS = type("ExecutionError.INSUFFICIENT_GAS", (ExecutionError.INSUFFICIENT_GAS, ExecutionError,), {}) # type: ignore -ExecutionError.INVALID_GAS_OBJECT = type("ExecutionError.INVALID_GAS_OBJECT", (ExecutionError.INVALID_GAS_OBJECT, ExecutionError,), {}) # type: ignore -ExecutionError.INVARIANT_VIOLATION = type("ExecutionError.INVARIANT_VIOLATION", (ExecutionError.INVARIANT_VIOLATION, ExecutionError,), {}) # type: ignore -ExecutionError.FEATURE_NOT_YET_SUPPORTED = type("ExecutionError.FEATURE_NOT_YET_SUPPORTED", (ExecutionError.FEATURE_NOT_YET_SUPPORTED, ExecutionError,), {}) # type: ignore -ExecutionError.OBJECT_TOO_BIG = type("ExecutionError.OBJECT_TOO_BIG", (ExecutionError.OBJECT_TOO_BIG, ExecutionError,), {}) # type: ignore -ExecutionError.PACKAGE_TOO_BIG = type("ExecutionError.PACKAGE_TOO_BIG", (ExecutionError.PACKAGE_TOO_BIG, ExecutionError,), {}) # type: ignore -ExecutionError.CIRCULAR_OBJECT_OWNERSHIP = type("ExecutionError.CIRCULAR_OBJECT_OWNERSHIP", (ExecutionError.CIRCULAR_OBJECT_OWNERSHIP, ExecutionError,), {}) # type: ignore -ExecutionError.INSUFFICIENT_COIN_BALANCE = type("ExecutionError.INSUFFICIENT_COIN_BALANCE", (ExecutionError.INSUFFICIENT_COIN_BALANCE, ExecutionError,), {}) # type: ignore -ExecutionError.COIN_BALANCE_OVERFLOW = type("ExecutionError.COIN_BALANCE_OVERFLOW", (ExecutionError.COIN_BALANCE_OVERFLOW, ExecutionError,), {}) # type: ignore -ExecutionError.PUBLISH_ERROR_NON_ZERO_ADDRESS = type("ExecutionError.PUBLISH_ERROR_NON_ZERO_ADDRESS", (ExecutionError.PUBLISH_ERROR_NON_ZERO_ADDRESS, ExecutionError,), {}) # type: ignore -ExecutionError.IOTA_MOVE_VERIFICATION_ERROR = type("ExecutionError.IOTA_MOVE_VERIFICATION_ERROR", (ExecutionError.IOTA_MOVE_VERIFICATION_ERROR, ExecutionError,), {}) # type: ignore -ExecutionError.MOVE_PRIMITIVE_RUNTIME_ERROR = type("ExecutionError.MOVE_PRIMITIVE_RUNTIME_ERROR", (ExecutionError.MOVE_PRIMITIVE_RUNTIME_ERROR, ExecutionError,), {}) # type: ignore -ExecutionError.MOVE_ABORT = type("ExecutionError.MOVE_ABORT", (ExecutionError.MOVE_ABORT, ExecutionError,), {}) # type: ignore -ExecutionError.VM_VERIFICATION_OR_DESERIALIZATION_ERROR = type("ExecutionError.VM_VERIFICATION_OR_DESERIALIZATION_ERROR", (ExecutionError.VM_VERIFICATION_OR_DESERIALIZATION_ERROR, ExecutionError,), {}) # type: ignore -ExecutionError.VM_INVARIANT_VIOLATION = type("ExecutionError.VM_INVARIANT_VIOLATION", (ExecutionError.VM_INVARIANT_VIOLATION, ExecutionError,), {}) # type: ignore -ExecutionError.FUNCTION_NOT_FOUND = type("ExecutionError.FUNCTION_NOT_FOUND", (ExecutionError.FUNCTION_NOT_FOUND, ExecutionError,), {}) # type: ignore -ExecutionError.ARITY_MISMATCH = type("ExecutionError.ARITY_MISMATCH", (ExecutionError.ARITY_MISMATCH, ExecutionError,), {}) # type: ignore -ExecutionError.TYPE_ARITY_MISMATCH = type("ExecutionError.TYPE_ARITY_MISMATCH", (ExecutionError.TYPE_ARITY_MISMATCH, ExecutionError,), {}) # type: ignore -ExecutionError.NON_ENTRY_FUNCTION_INVOKED = type("ExecutionError.NON_ENTRY_FUNCTION_INVOKED", (ExecutionError.NON_ENTRY_FUNCTION_INVOKED, ExecutionError,), {}) # type: ignore -ExecutionError.COMMAND_ARGUMENT_ERROR = type("ExecutionError.COMMAND_ARGUMENT_ERROR", (ExecutionError.COMMAND_ARGUMENT_ERROR, ExecutionError,), {}) # type: ignore -ExecutionError.TYPE_ARGUMENT_ERROR = type("ExecutionError.TYPE_ARGUMENT_ERROR", (ExecutionError.TYPE_ARGUMENT_ERROR, ExecutionError,), {}) # type: ignore -ExecutionError.UNUSED_VALUE_WITHOUT_DROP = type("ExecutionError.UNUSED_VALUE_WITHOUT_DROP", (ExecutionError.UNUSED_VALUE_WITHOUT_DROP, ExecutionError,), {}) # type: ignore -ExecutionError.INVALID_PUBLIC_FUNCTION_RETURN_TYPE = type("ExecutionError.INVALID_PUBLIC_FUNCTION_RETURN_TYPE", (ExecutionError.INVALID_PUBLIC_FUNCTION_RETURN_TYPE, ExecutionError,), {}) # type: ignore -ExecutionError.INVALID_TRANSFER_OBJECT = type("ExecutionError.INVALID_TRANSFER_OBJECT", (ExecutionError.INVALID_TRANSFER_OBJECT, ExecutionError,), {}) # type: ignore -ExecutionError.EFFECTS_TOO_LARGE = type("ExecutionError.EFFECTS_TOO_LARGE", (ExecutionError.EFFECTS_TOO_LARGE, ExecutionError,), {}) # type: ignore -ExecutionError.PUBLISH_UPGRADE_MISSING_DEPENDENCY = type("ExecutionError.PUBLISH_UPGRADE_MISSING_DEPENDENCY", (ExecutionError.PUBLISH_UPGRADE_MISSING_DEPENDENCY, ExecutionError,), {}) # type: ignore -ExecutionError.PUBLISH_UPGRADE_DEPENDENCY_DOWNGRADE = type("ExecutionError.PUBLISH_UPGRADE_DEPENDENCY_DOWNGRADE", (ExecutionError.PUBLISH_UPGRADE_DEPENDENCY_DOWNGRADE, ExecutionError,), {}) # type: ignore -ExecutionError.PACKAGE_UPGRADE_ERROR = type("ExecutionError.PACKAGE_UPGRADE_ERROR", (ExecutionError.PACKAGE_UPGRADE_ERROR, ExecutionError,), {}) # type: ignore -ExecutionError.WRITTEN_OBJECTS_TOO_LARGE = type("ExecutionError.WRITTEN_OBJECTS_TOO_LARGE", (ExecutionError.WRITTEN_OBJECTS_TOO_LARGE, ExecutionError,), {}) # type: ignore -ExecutionError.CERTIFICATE_DENIED = type("ExecutionError.CERTIFICATE_DENIED", (ExecutionError.CERTIFICATE_DENIED, ExecutionError,), {}) # type: ignore -ExecutionError.IOTA_MOVE_VERIFICATION_TIMEOUT = type("ExecutionError.IOTA_MOVE_VERIFICATION_TIMEOUT", (ExecutionError.IOTA_MOVE_VERIFICATION_TIMEOUT, ExecutionError,), {}) # type: ignore -ExecutionError.SHARED_OBJECT_OPERATION_NOT_ALLOWED = type("ExecutionError.SHARED_OBJECT_OPERATION_NOT_ALLOWED", (ExecutionError.SHARED_OBJECT_OPERATION_NOT_ALLOWED, ExecutionError,), {}) # type: ignore -ExecutionError.INPUT_OBJECT_DELETED = type("ExecutionError.INPUT_OBJECT_DELETED", (ExecutionError.INPUT_OBJECT_DELETED, ExecutionError,), {}) # type: ignore -ExecutionError.EXECUTION_CANCELLED_DUE_TO_SHARED_OBJECT_CONGESTION = type("ExecutionError.EXECUTION_CANCELLED_DUE_TO_SHARED_OBJECT_CONGESTION", (ExecutionError.EXECUTION_CANCELLED_DUE_TO_SHARED_OBJECT_CONGESTION, ExecutionError,), {}) # type: ignore -ExecutionError.ADDRESS_DENIED_FOR_COIN = type("ExecutionError.ADDRESS_DENIED_FOR_COIN", (ExecutionError.ADDRESS_DENIED_FOR_COIN, ExecutionError,), {}) # type: ignore -ExecutionError.COIN_TYPE_GLOBAL_PAUSE = type("ExecutionError.COIN_TYPE_GLOBAL_PAUSE", (ExecutionError.COIN_TYPE_GLOBAL_PAUSE, ExecutionError,), {}) # type: ignore -ExecutionError.EXECUTION_CANCELLED_DUE_TO_RANDOMNESS_UNAVAILABLE = type("ExecutionError.EXECUTION_CANCELLED_DUE_TO_RANDOMNESS_UNAVAILABLE", (ExecutionError.EXECUTION_CANCELLED_DUE_TO_RANDOMNESS_UNAVAILABLE, ExecutionError,), {}) # type: ignore - - - - -class _UniffiConverterTypeExecutionError(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return ExecutionError.INSUFFICIENT_GAS( - ) - if variant == 2: - return ExecutionError.INVALID_GAS_OBJECT( - ) - if variant == 3: - return ExecutionError.INVARIANT_VIOLATION( - ) - if variant == 4: - return ExecutionError.FEATURE_NOT_YET_SUPPORTED( - ) - if variant == 5: - return ExecutionError.OBJECT_TOO_BIG( - _UniffiConverterUInt64.read(buf), - _UniffiConverterUInt64.read(buf), - ) - if variant == 6: - return ExecutionError.PACKAGE_TOO_BIG( - _UniffiConverterUInt64.read(buf), - _UniffiConverterUInt64.read(buf), - ) - if variant == 7: - return ExecutionError.CIRCULAR_OBJECT_OWNERSHIP( - _UniffiConverterTypeObjectId.read(buf), - ) - if variant == 8: - return ExecutionError.INSUFFICIENT_COIN_BALANCE( - ) - if variant == 9: - return ExecutionError.COIN_BALANCE_OVERFLOW( - ) - if variant == 10: - return ExecutionError.PUBLISH_ERROR_NON_ZERO_ADDRESS( - ) - if variant == 11: - return ExecutionError.IOTA_MOVE_VERIFICATION_ERROR( - ) - if variant == 12: - return ExecutionError.MOVE_PRIMITIVE_RUNTIME_ERROR( - _UniffiConverterOptionalTypeMoveLocation.read(buf), - ) - if variant == 13: - return ExecutionError.MOVE_ABORT( - _UniffiConverterTypeMoveLocation.read(buf), - _UniffiConverterUInt64.read(buf), - ) - if variant == 14: - return ExecutionError.VM_VERIFICATION_OR_DESERIALIZATION_ERROR( - ) - if variant == 15: - return ExecutionError.VM_INVARIANT_VIOLATION( - ) - if variant == 16: - return ExecutionError.FUNCTION_NOT_FOUND( - ) - if variant == 17: - return ExecutionError.ARITY_MISMATCH( - ) - if variant == 18: - return ExecutionError.TYPE_ARITY_MISMATCH( - ) - if variant == 19: - return ExecutionError.NON_ENTRY_FUNCTION_INVOKED( - ) - if variant == 20: - return ExecutionError.COMMAND_ARGUMENT_ERROR( - _UniffiConverterUInt16.read(buf), - _UniffiConverterTypeCommandArgumentError.read(buf), - ) - if variant == 21: - return ExecutionError.TYPE_ARGUMENT_ERROR( - _UniffiConverterUInt16.read(buf), - _UniffiConverterTypeTypeArgumentError.read(buf), - ) - if variant == 22: - return ExecutionError.UNUSED_VALUE_WITHOUT_DROP( - _UniffiConverterUInt16.read(buf), - _UniffiConverterUInt16.read(buf), - ) - if variant == 23: - return ExecutionError.INVALID_PUBLIC_FUNCTION_RETURN_TYPE( - _UniffiConverterUInt16.read(buf), - ) - if variant == 24: - return ExecutionError.INVALID_TRANSFER_OBJECT( - ) - if variant == 25: - return ExecutionError.EFFECTS_TOO_LARGE( - _UniffiConverterUInt64.read(buf), - _UniffiConverterUInt64.read(buf), - ) - if variant == 26: - return ExecutionError.PUBLISH_UPGRADE_MISSING_DEPENDENCY( - ) - if variant == 27: - return ExecutionError.PUBLISH_UPGRADE_DEPENDENCY_DOWNGRADE( - ) - if variant == 28: - return ExecutionError.PACKAGE_UPGRADE_ERROR( - _UniffiConverterTypePackageUpgradeError.read(buf), - ) - if variant == 29: - return ExecutionError.WRITTEN_OBJECTS_TOO_LARGE( - _UniffiConverterUInt64.read(buf), - _UniffiConverterUInt64.read(buf), - ) - if variant == 30: - return ExecutionError.CERTIFICATE_DENIED( - ) - if variant == 31: - return ExecutionError.IOTA_MOVE_VERIFICATION_TIMEOUT( - ) - if variant == 32: - return ExecutionError.SHARED_OBJECT_OPERATION_NOT_ALLOWED( - ) - if variant == 33: - return ExecutionError.INPUT_OBJECT_DELETED( - ) - if variant == 34: - return ExecutionError.EXECUTION_CANCELLED_DUE_TO_SHARED_OBJECT_CONGESTION( - _UniffiConverterSequenceTypeObjectId.read(buf), - ) - if variant == 35: - return ExecutionError.ADDRESS_DENIED_FOR_COIN( - _UniffiConverterTypeAddress.read(buf), - _UniffiConverterString.read(buf), - ) - if variant == 36: - return ExecutionError.COIN_TYPE_GLOBAL_PAUSE( - _UniffiConverterString.read(buf), - ) - if variant == 37: - return ExecutionError.EXECUTION_CANCELLED_DUE_TO_RANDOMNESS_UNAVAILABLE( - ) - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value.is_INSUFFICIENT_GAS(): - return - if value.is_INVALID_GAS_OBJECT(): - return - if value.is_INVARIANT_VIOLATION(): - return - if value.is_FEATURE_NOT_YET_SUPPORTED(): - return - if value.is_OBJECT_TOO_BIG(): - _UniffiConverterUInt64.check_lower(value.object_size) - _UniffiConverterUInt64.check_lower(value.max_object_size) - return - if value.is_PACKAGE_TOO_BIG(): - _UniffiConverterUInt64.check_lower(value.object_size) - _UniffiConverterUInt64.check_lower(value.max_object_size) - return - if value.is_CIRCULAR_OBJECT_OWNERSHIP(): - _UniffiConverterTypeObjectId.check_lower(value.object) - return - if value.is_INSUFFICIENT_COIN_BALANCE(): - return - if value.is_COIN_BALANCE_OVERFLOW(): - return - if value.is_PUBLISH_ERROR_NON_ZERO_ADDRESS(): - return - if value.is_IOTA_MOVE_VERIFICATION_ERROR(): - return - if value.is_MOVE_PRIMITIVE_RUNTIME_ERROR(): - _UniffiConverterOptionalTypeMoveLocation.check_lower(value.location) - return - if value.is_MOVE_ABORT(): - _UniffiConverterTypeMoveLocation.check_lower(value.location) - _UniffiConverterUInt64.check_lower(value.code) - return - if value.is_VM_VERIFICATION_OR_DESERIALIZATION_ERROR(): - return - if value.is_VM_INVARIANT_VIOLATION(): - return - if value.is_FUNCTION_NOT_FOUND(): - return - if value.is_ARITY_MISMATCH(): - return - if value.is_TYPE_ARITY_MISMATCH(): - return - if value.is_NON_ENTRY_FUNCTION_INVOKED(): - return - if value.is_COMMAND_ARGUMENT_ERROR(): - _UniffiConverterUInt16.check_lower(value.argument) - _UniffiConverterTypeCommandArgumentError.check_lower(value.kind) - return - if value.is_TYPE_ARGUMENT_ERROR(): - _UniffiConverterUInt16.check_lower(value.type_argument) - _UniffiConverterTypeTypeArgumentError.check_lower(value.kind) - return - if value.is_UNUSED_VALUE_WITHOUT_DROP(): - _UniffiConverterUInt16.check_lower(value.result) - _UniffiConverterUInt16.check_lower(value.subresult) - return - if value.is_INVALID_PUBLIC_FUNCTION_RETURN_TYPE(): - _UniffiConverterUInt16.check_lower(value.index) - return - if value.is_INVALID_TRANSFER_OBJECT(): - return - if value.is_EFFECTS_TOO_LARGE(): - _UniffiConverterUInt64.check_lower(value.current_size) - _UniffiConverterUInt64.check_lower(value.max_size) - return - if value.is_PUBLISH_UPGRADE_MISSING_DEPENDENCY(): - return - if value.is_PUBLISH_UPGRADE_DEPENDENCY_DOWNGRADE(): - return - if value.is_PACKAGE_UPGRADE_ERROR(): - _UniffiConverterTypePackageUpgradeError.check_lower(value.kind) - return - if value.is_WRITTEN_OBJECTS_TOO_LARGE(): - _UniffiConverterUInt64.check_lower(value.object_size) - _UniffiConverterUInt64.check_lower(value.max_object_size) - return - if value.is_CERTIFICATE_DENIED(): - return - if value.is_IOTA_MOVE_VERIFICATION_TIMEOUT(): - return - if value.is_SHARED_OBJECT_OPERATION_NOT_ALLOWED(): - return - if value.is_INPUT_OBJECT_DELETED(): - return - if value.is_EXECUTION_CANCELLED_DUE_TO_SHARED_OBJECT_CONGESTION(): - _UniffiConverterSequenceTypeObjectId.check_lower(value.congested_objects) - return - if value.is_ADDRESS_DENIED_FOR_COIN(): - _UniffiConverterTypeAddress.check_lower(value.address) - _UniffiConverterString.check_lower(value.coin_type) - return - if value.is_COIN_TYPE_GLOBAL_PAUSE(): - _UniffiConverterString.check_lower(value.coin_type) - return - if value.is_EXECUTION_CANCELLED_DUE_TO_RANDOMNESS_UNAVAILABLE(): - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value.is_INSUFFICIENT_GAS(): - buf.write_i32(1) - if value.is_INVALID_GAS_OBJECT(): - buf.write_i32(2) - if value.is_INVARIANT_VIOLATION(): - buf.write_i32(3) - if value.is_FEATURE_NOT_YET_SUPPORTED(): - buf.write_i32(4) - if value.is_OBJECT_TOO_BIG(): - buf.write_i32(5) - _UniffiConverterUInt64.write(value.object_size, buf) - _UniffiConverterUInt64.write(value.max_object_size, buf) - if value.is_PACKAGE_TOO_BIG(): - buf.write_i32(6) - _UniffiConverterUInt64.write(value.object_size, buf) - _UniffiConverterUInt64.write(value.max_object_size, buf) - if value.is_CIRCULAR_OBJECT_OWNERSHIP(): - buf.write_i32(7) - _UniffiConverterTypeObjectId.write(value.object, buf) - if value.is_INSUFFICIENT_COIN_BALANCE(): - buf.write_i32(8) - if value.is_COIN_BALANCE_OVERFLOW(): - buf.write_i32(9) - if value.is_PUBLISH_ERROR_NON_ZERO_ADDRESS(): - buf.write_i32(10) - if value.is_IOTA_MOVE_VERIFICATION_ERROR(): - buf.write_i32(11) - if value.is_MOVE_PRIMITIVE_RUNTIME_ERROR(): - buf.write_i32(12) - _UniffiConverterOptionalTypeMoveLocation.write(value.location, buf) - if value.is_MOVE_ABORT(): - buf.write_i32(13) - _UniffiConverterTypeMoveLocation.write(value.location, buf) - _UniffiConverterUInt64.write(value.code, buf) - if value.is_VM_VERIFICATION_OR_DESERIALIZATION_ERROR(): - buf.write_i32(14) - if value.is_VM_INVARIANT_VIOLATION(): - buf.write_i32(15) - if value.is_FUNCTION_NOT_FOUND(): - buf.write_i32(16) - if value.is_ARITY_MISMATCH(): - buf.write_i32(17) - if value.is_TYPE_ARITY_MISMATCH(): - buf.write_i32(18) - if value.is_NON_ENTRY_FUNCTION_INVOKED(): - buf.write_i32(19) - if value.is_COMMAND_ARGUMENT_ERROR(): - buf.write_i32(20) - _UniffiConverterUInt16.write(value.argument, buf) - _UniffiConverterTypeCommandArgumentError.write(value.kind, buf) - if value.is_TYPE_ARGUMENT_ERROR(): - buf.write_i32(21) - _UniffiConverterUInt16.write(value.type_argument, buf) - _UniffiConverterTypeTypeArgumentError.write(value.kind, buf) - if value.is_UNUSED_VALUE_WITHOUT_DROP(): - buf.write_i32(22) - _UniffiConverterUInt16.write(value.result, buf) - _UniffiConverterUInt16.write(value.subresult, buf) - if value.is_INVALID_PUBLIC_FUNCTION_RETURN_TYPE(): - buf.write_i32(23) - _UniffiConverterUInt16.write(value.index, buf) - if value.is_INVALID_TRANSFER_OBJECT(): - buf.write_i32(24) - if value.is_EFFECTS_TOO_LARGE(): - buf.write_i32(25) - _UniffiConverterUInt64.write(value.current_size, buf) - _UniffiConverterUInt64.write(value.max_size, buf) - if value.is_PUBLISH_UPGRADE_MISSING_DEPENDENCY(): - buf.write_i32(26) - if value.is_PUBLISH_UPGRADE_DEPENDENCY_DOWNGRADE(): - buf.write_i32(27) - if value.is_PACKAGE_UPGRADE_ERROR(): - buf.write_i32(28) - _UniffiConverterTypePackageUpgradeError.write(value.kind, buf) - if value.is_WRITTEN_OBJECTS_TOO_LARGE(): - buf.write_i32(29) - _UniffiConverterUInt64.write(value.object_size, buf) - _UniffiConverterUInt64.write(value.max_object_size, buf) - if value.is_CERTIFICATE_DENIED(): - buf.write_i32(30) - if value.is_IOTA_MOVE_VERIFICATION_TIMEOUT(): - buf.write_i32(31) - if value.is_SHARED_OBJECT_OPERATION_NOT_ALLOWED(): - buf.write_i32(32) - if value.is_INPUT_OBJECT_DELETED(): - buf.write_i32(33) - if value.is_EXECUTION_CANCELLED_DUE_TO_SHARED_OBJECT_CONGESTION(): - buf.write_i32(34) - _UniffiConverterSequenceTypeObjectId.write(value.congested_objects, buf) - if value.is_ADDRESS_DENIED_FOR_COIN(): - buf.write_i32(35) - _UniffiConverterTypeAddress.write(value.address, buf) - _UniffiConverterString.write(value.coin_type, buf) - if value.is_COIN_TYPE_GLOBAL_PAUSE(): - buf.write_i32(36) - _UniffiConverterString.write(value.coin_type, buf) - if value.is_EXECUTION_CANCELLED_DUE_TO_RANDOMNESS_UNAVAILABLE(): - buf.write_i32(37) - - - - - - - -class ExecutionStatus: - """ - The status of an executed Transaction - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - execution-status = success / failure - success = %x00 - failure = %x01 execution-error (option u64) - ``` - """ - - def __init__(self): - raise RuntimeError("ExecutionStatus cannot be instantiated directly") - - # Each enum variant is a nested class of the enum itself. - class SUCCESS: - """ - The Transaction successfully executed. - """ - - - def __init__(self,): - pass - - def __str__(self): - return "ExecutionStatus.SUCCESS()".format() - - def __eq__(self, other): - if not other.is_SUCCESS(): - return False - return True - - class FAILURE: - """ - The Transaction didn't execute successfully. - - Failed transactions are still committed to the blockchain but any - intended effects are rolled back to prior to this transaction - executing with the caveat that gas objects are still smashed and gas - usage is still charged. - """ - - error: "ExecutionError" - """ - The error encountered during execution. - """ - - command: "typing.Optional[int]" - """ - The command, if any, during which the error occurred. - """ - - - def __init__(self,error: "ExecutionError", command: "typing.Optional[int]"): - self.error = error - self.command = command - - def __str__(self): - return "ExecutionStatus.FAILURE(error={}, command={})".format(self.error, self.command) - - def __eq__(self, other): - if not other.is_FAILURE(): - return False - if self.error != other.error: - return False - if self.command != other.command: - return False - return True - - - - # For each variant, we have `is_NAME` and `is_name` methods for easily checking - # whether an instance is that variant. - def is_SUCCESS(self) -> bool: - return isinstance(self, ExecutionStatus.SUCCESS) - def is_success(self) -> bool: - return isinstance(self, ExecutionStatus.SUCCESS) - def is_FAILURE(self) -> bool: - return isinstance(self, ExecutionStatus.FAILURE) - def is_failure(self) -> bool: - return isinstance(self, ExecutionStatus.FAILURE) - - -# 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. -ExecutionStatus.SUCCESS = type("ExecutionStatus.SUCCESS", (ExecutionStatus.SUCCESS, ExecutionStatus,), {}) # type: ignore -ExecutionStatus.FAILURE = type("ExecutionStatus.FAILURE", (ExecutionStatus.FAILURE, ExecutionStatus,), {}) # type: ignore - - - - -class _UniffiConverterTypeExecutionStatus(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return ExecutionStatus.SUCCESS( - ) - if variant == 2: - return ExecutionStatus.FAILURE( - _UniffiConverterTypeExecutionError.read(buf), - _UniffiConverterOptionalUInt64.read(buf), - ) - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value.is_SUCCESS(): - return - if value.is_FAILURE(): - _UniffiConverterTypeExecutionError.check_lower(value.error) - _UniffiConverterOptionalUInt64.check_lower(value.command) - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value.is_SUCCESS(): - buf.write_i32(1) - if value.is_FAILURE(): - buf.write_i32(2) - _UniffiConverterTypeExecutionError.write(value.error, buf) - _UniffiConverterOptionalUInt64.write(value.command, buf) - - - - - - - -class ExecutionTimeObservationKey: - """ - Key for an execution time observation - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - execution-time-observation-key = %x00 move-entry-point - =/ %x01 ; transfer-objects - =/ %x02 ; split-coins - =/ %x03 ; merge-coins - =/ %x04 ; publish - =/ %x05 ; make-move-vec - =/ %x06 ; upgrade - - move-entry-point = object-id string string (vec type-tag) - ``` - """ - - def __init__(self): - raise RuntimeError("ExecutionTimeObservationKey cannot be instantiated directly") - - # Each enum variant is a nested class of the enum itself. - class MOVE_ENTRY_POINT: - package: "ObjectId" - """ - The package containing the module and function. - """ - - module: "str" - """ - The specific module in the package containing the function. - """ - - function: "str" - """ - The function to be called. - """ - - type_arguments: "typing.List[TypeTag]" - """ - The type arguments to the function. - NOTE: This field is currently not populated. - """ - - - def __init__(self,package: "ObjectId", module: "str", function: "str", type_arguments: "typing.List[TypeTag]"): - self.package = package - self.module = module - self.function = function - self.type_arguments = type_arguments - - def __str__(self): - return "ExecutionTimeObservationKey.MOVE_ENTRY_POINT(package={}, module={}, function={}, type_arguments={})".format(self.package, self.module, self.function, self.type_arguments) - - def __eq__(self, other): - if not other.is_MOVE_ENTRY_POINT(): - return False - if self.package != other.package: - return False - if self.module != other.module: - return False - if self.function != other.function: - return False - if self.type_arguments != other.type_arguments: - return False - return True - - class TRANSFER_OBJECTS: - - def __init__(self,): - pass - - def __str__(self): - return "ExecutionTimeObservationKey.TRANSFER_OBJECTS()".format() - - def __eq__(self, other): - if not other.is_TRANSFER_OBJECTS(): - return False - return True - - class SPLIT_COINS: - - def __init__(self,): - pass - - def __str__(self): - return "ExecutionTimeObservationKey.SPLIT_COINS()".format() - - def __eq__(self, other): - if not other.is_SPLIT_COINS(): - return False - return True - - class MERGE_COINS: - - def __init__(self,): - pass - - def __str__(self): - return "ExecutionTimeObservationKey.MERGE_COINS()".format() - - def __eq__(self, other): - if not other.is_MERGE_COINS(): - return False - return True - - class PUBLISH: - - def __init__(self,): - pass - - def __str__(self): - return "ExecutionTimeObservationKey.PUBLISH()".format() - - def __eq__(self, other): - if not other.is_PUBLISH(): - return False - return True - - class MAKE_MOVE_VEC: - - def __init__(self,): - pass - - def __str__(self): - return "ExecutionTimeObservationKey.MAKE_MOVE_VEC()".format() - - def __eq__(self, other): - if not other.is_MAKE_MOVE_VEC(): - return False - return True - - class UPGRADE: - - def __init__(self,): - pass - - def __str__(self): - return "ExecutionTimeObservationKey.UPGRADE()".format() - - def __eq__(self, other): - if not other.is_UPGRADE(): - return False - return True - - - - # For each variant, we have `is_NAME` and `is_name` methods for easily checking - # whether an instance is that variant. - def is_MOVE_ENTRY_POINT(self) -> bool: - return isinstance(self, ExecutionTimeObservationKey.MOVE_ENTRY_POINT) - def is_move_entry_point(self) -> bool: - return isinstance(self, ExecutionTimeObservationKey.MOVE_ENTRY_POINT) - def is_TRANSFER_OBJECTS(self) -> bool: - return isinstance(self, ExecutionTimeObservationKey.TRANSFER_OBJECTS) - def is_transfer_objects(self) -> bool: - return isinstance(self, ExecutionTimeObservationKey.TRANSFER_OBJECTS) - def is_SPLIT_COINS(self) -> bool: - return isinstance(self, ExecutionTimeObservationKey.SPLIT_COINS) - def is_split_coins(self) -> bool: - return isinstance(self, ExecutionTimeObservationKey.SPLIT_COINS) - def is_MERGE_COINS(self) -> bool: - return isinstance(self, ExecutionTimeObservationKey.MERGE_COINS) - def is_merge_coins(self) -> bool: - return isinstance(self, ExecutionTimeObservationKey.MERGE_COINS) - def is_PUBLISH(self) -> bool: - return isinstance(self, ExecutionTimeObservationKey.PUBLISH) - def is_publish(self) -> bool: - return isinstance(self, ExecutionTimeObservationKey.PUBLISH) - def is_MAKE_MOVE_VEC(self) -> bool: - return isinstance(self, ExecutionTimeObservationKey.MAKE_MOVE_VEC) - def is_make_move_vec(self) -> bool: - return isinstance(self, ExecutionTimeObservationKey.MAKE_MOVE_VEC) - def is_UPGRADE(self) -> bool: - return isinstance(self, ExecutionTimeObservationKey.UPGRADE) - def is_upgrade(self) -> bool: - return isinstance(self, ExecutionTimeObservationKey.UPGRADE) - - -# 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. -ExecutionTimeObservationKey.MOVE_ENTRY_POINT = type("ExecutionTimeObservationKey.MOVE_ENTRY_POINT", (ExecutionTimeObservationKey.MOVE_ENTRY_POINT, ExecutionTimeObservationKey,), {}) # type: ignore -ExecutionTimeObservationKey.TRANSFER_OBJECTS = type("ExecutionTimeObservationKey.TRANSFER_OBJECTS", (ExecutionTimeObservationKey.TRANSFER_OBJECTS, ExecutionTimeObservationKey,), {}) # type: ignore -ExecutionTimeObservationKey.SPLIT_COINS = type("ExecutionTimeObservationKey.SPLIT_COINS", (ExecutionTimeObservationKey.SPLIT_COINS, ExecutionTimeObservationKey,), {}) # type: ignore -ExecutionTimeObservationKey.MERGE_COINS = type("ExecutionTimeObservationKey.MERGE_COINS", (ExecutionTimeObservationKey.MERGE_COINS, ExecutionTimeObservationKey,), {}) # type: ignore -ExecutionTimeObservationKey.PUBLISH = type("ExecutionTimeObservationKey.PUBLISH", (ExecutionTimeObservationKey.PUBLISH, ExecutionTimeObservationKey,), {}) # type: ignore -ExecutionTimeObservationKey.MAKE_MOVE_VEC = type("ExecutionTimeObservationKey.MAKE_MOVE_VEC", (ExecutionTimeObservationKey.MAKE_MOVE_VEC, ExecutionTimeObservationKey,), {}) # type: ignore -ExecutionTimeObservationKey.UPGRADE = type("ExecutionTimeObservationKey.UPGRADE", (ExecutionTimeObservationKey.UPGRADE, ExecutionTimeObservationKey,), {}) # type: ignore - - - - -class _UniffiConverterTypeExecutionTimeObservationKey(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return ExecutionTimeObservationKey.MOVE_ENTRY_POINT( - _UniffiConverterTypeObjectId.read(buf), - _UniffiConverterString.read(buf), - _UniffiConverterString.read(buf), - _UniffiConverterSequenceTypeTypeTag.read(buf), - ) - if variant == 2: - return ExecutionTimeObservationKey.TRANSFER_OBJECTS( - ) - if variant == 3: - return ExecutionTimeObservationKey.SPLIT_COINS( - ) - if variant == 4: - return ExecutionTimeObservationKey.MERGE_COINS( - ) - if variant == 5: - return ExecutionTimeObservationKey.PUBLISH( - ) - if variant == 6: - return ExecutionTimeObservationKey.MAKE_MOVE_VEC( - ) - if variant == 7: - return ExecutionTimeObservationKey.UPGRADE( - ) - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value.is_MOVE_ENTRY_POINT(): - _UniffiConverterTypeObjectId.check_lower(value.package) - _UniffiConverterString.check_lower(value.module) - _UniffiConverterString.check_lower(value.function) - _UniffiConverterSequenceTypeTypeTag.check_lower(value.type_arguments) - return - if value.is_TRANSFER_OBJECTS(): - return - if value.is_SPLIT_COINS(): - return - if value.is_MERGE_COINS(): - return - if value.is_PUBLISH(): - return - if value.is_MAKE_MOVE_VEC(): - return - if value.is_UPGRADE(): - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value.is_MOVE_ENTRY_POINT(): - buf.write_i32(1) - _UniffiConverterTypeObjectId.write(value.package, buf) - _UniffiConverterString.write(value.module, buf) - _UniffiConverterString.write(value.function, buf) - _UniffiConverterSequenceTypeTypeTag.write(value.type_arguments, buf) - if value.is_TRANSFER_OBJECTS(): - buf.write_i32(2) - if value.is_SPLIT_COINS(): - buf.write_i32(3) - if value.is_MERGE_COINS(): - buf.write_i32(4) - if value.is_PUBLISH(): - buf.write_i32(5) - if value.is_MAKE_MOVE_VEC(): - buf.write_i32(6) - if value.is_UPGRADE(): - buf.write_i32(7) - - - - - - - -class IdOperation(enum.Enum): - """ - Defines what happened to an ObjectId during execution - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - id-operation = id-operation-none - =/ id-operation-created - =/ id-operation-deleted - - id-operation-none = %x00 - id-operation-created = %x01 - id-operation-deleted = %x02 - ``` - """ - - NONE = 0 - - CREATED = 1 - - DELETED = 2 - - - -class _UniffiConverterTypeIdOperation(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return IdOperation.NONE - if variant == 2: - return IdOperation.CREATED - if variant == 3: - return IdOperation.DELETED - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value == IdOperation.NONE: - return - if value == IdOperation.CREATED: - return - if value == IdOperation.DELETED: - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value == IdOperation.NONE: - buf.write_i32(1) - if value == IdOperation.CREATED: - buf.write_i32(2) - if value == IdOperation.DELETED: - buf.write_i32(3) - - - - - - - -class Input: - """ - An input to a user transaction - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - input = input-pure / input-immutable-or-owned / input-shared / input-receiving - - input-pure = %x00 bytes - input-immutable-or-owned = %x01 object-ref - input-shared = %x02 object-id u64 bool - input-receiving = %x04 object-ref - ``` - """ - - def __init__(self): - raise RuntimeError("Input cannot be instantiated directly") - - # Each enum variant is a nested class of the enum itself. - class PURE: - """ - A move value serialized as BCS. - - For normal operations this is required to be a move primitive type and - not contain structs or objects. - """ - - value: "bytes" - - def __init__(self,value: "bytes"): - self.value = value - - def __str__(self): - return "Input.PURE(value={})".format(self.value) - - def __eq__(self, other): - if not other.is_PURE(): - return False - if self.value != other.value: - return False - return True - - class IMMUTABLE_OR_OWNED: - """ - A move object that is either immutable or address owned - """ - - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"Input.IMMUTABLE_OR_OWNED{self._values!r}" - - def __eq__(self, other): - if not other.is_IMMUTABLE_OR_OWNED(): - return False - return self._values == other._values - class SHARED: - """ - A move object whose owner is "Shared" - """ - - object_id: "ObjectId" - initial_shared_version: "int" - mutable: "bool" - """ - Controls whether the caller asks for a mutable reference to the - shared object. - """ - - - def __init__(self,object_id: "ObjectId", initial_shared_version: "int", mutable: "bool"): - self.object_id = object_id - self.initial_shared_version = initial_shared_version - self.mutable = mutable - - def __str__(self): - return "Input.SHARED(object_id={}, initial_shared_version={}, mutable={})".format(self.object_id, self.initial_shared_version, self.mutable) - - def __eq__(self, other): - if not other.is_SHARED(): - return False - if self.object_id != other.object_id: - return False - if self.initial_shared_version != other.initial_shared_version: - return False - if self.mutable != other.mutable: - return False - return True - - class RECEIVING: - """ - A move object that is attempted to be received in this transaction. - """ - - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"Input.RECEIVING{self._values!r}" - - def __eq__(self, other): - if not other.is_RECEIVING(): - return False - return self._values == other._values - - - # For each variant, we have `is_NAME` and `is_name` methods for easily checking - # whether an instance is that variant. - def is_PURE(self) -> bool: - return isinstance(self, Input.PURE) - def is_pure(self) -> bool: - return isinstance(self, Input.PURE) - def is_IMMUTABLE_OR_OWNED(self) -> bool: - return isinstance(self, Input.IMMUTABLE_OR_OWNED) - def is_immutable_or_owned(self) -> bool: - return isinstance(self, Input.IMMUTABLE_OR_OWNED) - def is_SHARED(self) -> bool: - return isinstance(self, Input.SHARED) - def is_shared(self) -> bool: - return isinstance(self, Input.SHARED) - def is_RECEIVING(self) -> bool: - return isinstance(self, Input.RECEIVING) - def is_receiving(self) -> bool: - return isinstance(self, Input.RECEIVING) - - -# 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. -Input.PURE = type("Input.PURE", (Input.PURE, Input,), {}) # type: ignore -Input.IMMUTABLE_OR_OWNED = type("Input.IMMUTABLE_OR_OWNED", (Input.IMMUTABLE_OR_OWNED, Input,), {}) # type: ignore -Input.SHARED = type("Input.SHARED", (Input.SHARED, Input,), {}) # type: ignore -Input.RECEIVING = type("Input.RECEIVING", (Input.RECEIVING, Input,), {}) # type: ignore - - - - -class _UniffiConverterTypeInput(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return Input.PURE( - _UniffiConverterBytes.read(buf), - ) - if variant == 2: - return Input.IMMUTABLE_OR_OWNED( - _UniffiConverterTypeObjectReference.read(buf), - ) - if variant == 3: - return Input.SHARED( - _UniffiConverterTypeObjectId.read(buf), - _UniffiConverterUInt64.read(buf), - _UniffiConverterBool.read(buf), - ) - if variant == 4: - return Input.RECEIVING( - _UniffiConverterTypeObjectReference.read(buf), - ) - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value.is_PURE(): - _UniffiConverterBytes.check_lower(value.value) - return - if value.is_IMMUTABLE_OR_OWNED(): - _UniffiConverterTypeObjectReference.check_lower(value._values[0]) - return - if value.is_SHARED(): - _UniffiConverterTypeObjectId.check_lower(value.object_id) - _UniffiConverterUInt64.check_lower(value.initial_shared_version) - _UniffiConverterBool.check_lower(value.mutable) - return - if value.is_RECEIVING(): - _UniffiConverterTypeObjectReference.check_lower(value._values[0]) - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value.is_PURE(): - buf.write_i32(1) - _UniffiConverterBytes.write(value.value, buf) - if value.is_IMMUTABLE_OR_OWNED(): - buf.write_i32(2) - _UniffiConverterTypeObjectReference.write(value._values[0], buf) - if value.is_SHARED(): - buf.write_i32(3) - _UniffiConverterTypeObjectId.write(value.object_id, buf) - _UniffiConverterUInt64.write(value.initial_shared_version, buf) - _UniffiConverterBool.write(value.mutable, buf) - if value.is_RECEIVING(): - buf.write_i32(4) - _UniffiConverterTypeObjectReference.write(value._values[0], buf) - - - - - - - -class MultisigMemberPublicKey: - """ - Enum of valid public keys for multisig committee members - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - multisig-member-public-key = ed25519-multisig-member-public-key / - secp256k1-multisig-member-public-key / - secp256r1-multisig-member-public-key / - zklogin-multisig-member-public-key - - ed25519-multisig-member-public-key = %x00 ed25519-public-key - secp256k1-multisig-member-public-key = %x01 secp256k1-public-key - secp256r1-multisig-member-public-key = %x02 secp256r1-public-key - zklogin-multisig-member-public-key = %x03 zklogin-public-identifier - ``` - - There is also a legacy encoding for this type defined as: - - ```text - legacy-multisig-member-public-key = string ; which is valid base64 encoded - ; and the decoded bytes are defined - ; by legacy-public-key - legacy-public-key = (ed25519-flag ed25519-public-key) / - (secp256k1-flag secp256k1-public-key) / - (secp256r1-flag secp256r1-public-key) - ``` - """ - - def __init__(self): - raise RuntimeError("MultisigMemberPublicKey cannot be instantiated directly") - - # Each enum variant is a nested class of the enum itself. - class ED25519: - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"MultisigMemberPublicKey.ED25519{self._values!r}" - - def __eq__(self, other): - if not other.is_ED25519(): - return False - return self._values == other._values - class SECP256K1: - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"MultisigMemberPublicKey.SECP256K1{self._values!r}" - - def __eq__(self, other): - if not other.is_SECP256K1(): - return False - return self._values == other._values - class SECP256R1: - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"MultisigMemberPublicKey.SECP256R1{self._values!r}" - - def __eq__(self, other): - if not other.is_SECP256R1(): - return False - return self._values == other._values - class ZK_LOGIN: - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"MultisigMemberPublicKey.ZK_LOGIN{self._values!r}" - - def __eq__(self, other): - if not other.is_ZK_LOGIN(): - return False - return self._values == other._values - - - # For each variant, we have `is_NAME` and `is_name` methods for easily checking - # whether an instance is that variant. - def is_ED25519(self) -> bool: - return isinstance(self, MultisigMemberPublicKey.ED25519) - def is_ed25519(self) -> bool: - return isinstance(self, MultisigMemberPublicKey.ED25519) - def is_SECP256K1(self) -> bool: - return isinstance(self, MultisigMemberPublicKey.SECP256K1) - def is_secp256k1(self) -> bool: - return isinstance(self, MultisigMemberPublicKey.SECP256K1) - def is_SECP256R1(self) -> bool: - return isinstance(self, MultisigMemberPublicKey.SECP256R1) - def is_secp256r1(self) -> bool: - return isinstance(self, MultisigMemberPublicKey.SECP256R1) - def is_ZK_LOGIN(self) -> bool: - return isinstance(self, MultisigMemberPublicKey.ZK_LOGIN) - def is_zk_login(self) -> bool: - return isinstance(self, MultisigMemberPublicKey.ZK_LOGIN) - - -# 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. -MultisigMemberPublicKey.ED25519 = type("MultisigMemberPublicKey.ED25519", (MultisigMemberPublicKey.ED25519, MultisigMemberPublicKey,), {}) # type: ignore -MultisigMemberPublicKey.SECP256K1 = type("MultisigMemberPublicKey.SECP256K1", (MultisigMemberPublicKey.SECP256K1, MultisigMemberPublicKey,), {}) # type: ignore -MultisigMemberPublicKey.SECP256R1 = type("MultisigMemberPublicKey.SECP256R1", (MultisigMemberPublicKey.SECP256R1, MultisigMemberPublicKey,), {}) # type: ignore -MultisigMemberPublicKey.ZK_LOGIN = type("MultisigMemberPublicKey.ZK_LOGIN", (MultisigMemberPublicKey.ZK_LOGIN, MultisigMemberPublicKey,), {}) # type: ignore - - - - -class _UniffiConverterTypeMultisigMemberPublicKey(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return MultisigMemberPublicKey.ED25519( - _UniffiConverterTypeEd25519PublicKey.read(buf), - ) - if variant == 2: - return MultisigMemberPublicKey.SECP256K1( - _UniffiConverterTypeSecp256k1PublicKey.read(buf), - ) - if variant == 3: - return MultisigMemberPublicKey.SECP256R1( - _UniffiConverterTypeSecp256r1PublicKey.read(buf), - ) - if variant == 4: - return MultisigMemberPublicKey.ZK_LOGIN( - _UniffiConverterTypeZkLoginPublicIdentifier.read(buf), - ) - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value.is_ED25519(): - _UniffiConverterTypeEd25519PublicKey.check_lower(value._values[0]) - return - if value.is_SECP256K1(): - _UniffiConverterTypeSecp256k1PublicKey.check_lower(value._values[0]) - return - if value.is_SECP256R1(): - _UniffiConverterTypeSecp256r1PublicKey.check_lower(value._values[0]) - return - if value.is_ZK_LOGIN(): - _UniffiConverterTypeZkLoginPublicIdentifier.check_lower(value._values[0]) - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value.is_ED25519(): - buf.write_i32(1) - _UniffiConverterTypeEd25519PublicKey.write(value._values[0], buf) - if value.is_SECP256K1(): - buf.write_i32(2) - _UniffiConverterTypeSecp256k1PublicKey.write(value._values[0], buf) - if value.is_SECP256R1(): - buf.write_i32(3) - _UniffiConverterTypeSecp256r1PublicKey.write(value._values[0], buf) - if value.is_ZK_LOGIN(): - buf.write_i32(4) - _UniffiConverterTypeZkLoginPublicIdentifier.write(value._values[0], buf) - - - - - - - -class MultisigMemberSignature: - """ - A signature from a member of a multisig committee. - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - multisig-member-signature = ed25519-multisig-member-signature / - secp256k1-multisig-member-signature / - secp256r1-multisig-member-signature / - zklogin-multisig-member-signature - - ed25519-multisig-member-signature = %x00 ed25519-signature - secp256k1-multisig-member-signature = %x01 secp256k1-signature - secp256r1-multisig-member-signature = %x02 secp256r1-signature - zklogin-multisig-member-signature = %x03 zklogin-authenticator - ``` - """ - - def __init__(self): - raise RuntimeError("MultisigMemberSignature cannot be instantiated directly") - - # Each enum variant is a nested class of the enum itself. - class ED25519: - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"MultisigMemberSignature.ED25519{self._values!r}" - - def __eq__(self, other): - if not other.is_ED25519(): - return False - return self._values == other._values - class SECP256K1: - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"MultisigMemberSignature.SECP256K1{self._values!r}" - - def __eq__(self, other): - if not other.is_SECP256K1(): - return False - return self._values == other._values - class SECP256R1: - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"MultisigMemberSignature.SECP256R1{self._values!r}" - - def __eq__(self, other): - if not other.is_SECP256R1(): - return False - return self._values == other._values - class ZK_LOGIN: - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"MultisigMemberSignature.ZK_LOGIN{self._values!r}" - - def __eq__(self, other): - if not other.is_ZK_LOGIN(): - return False - return self._values == other._values - - - # For each variant, we have `is_NAME` and `is_name` methods for easily checking - # whether an instance is that variant. - def is_ED25519(self) -> bool: - return isinstance(self, MultisigMemberSignature.ED25519) - def is_ed25519(self) -> bool: - return isinstance(self, MultisigMemberSignature.ED25519) - def is_SECP256K1(self) -> bool: - return isinstance(self, MultisigMemberSignature.SECP256K1) - def is_secp256k1(self) -> bool: - return isinstance(self, MultisigMemberSignature.SECP256K1) - def is_SECP256R1(self) -> bool: - return isinstance(self, MultisigMemberSignature.SECP256R1) - def is_secp256r1(self) -> bool: - return isinstance(self, MultisigMemberSignature.SECP256R1) - def is_ZK_LOGIN(self) -> bool: - return isinstance(self, MultisigMemberSignature.ZK_LOGIN) - def is_zk_login(self) -> bool: - return isinstance(self, MultisigMemberSignature.ZK_LOGIN) - - -# 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. -MultisigMemberSignature.ED25519 = type("MultisigMemberSignature.ED25519", (MultisigMemberSignature.ED25519, MultisigMemberSignature,), {}) # type: ignore -MultisigMemberSignature.SECP256K1 = type("MultisigMemberSignature.SECP256K1", (MultisigMemberSignature.SECP256K1, MultisigMemberSignature,), {}) # type: ignore -MultisigMemberSignature.SECP256R1 = type("MultisigMemberSignature.SECP256R1", (MultisigMemberSignature.SECP256R1, MultisigMemberSignature,), {}) # type: ignore -MultisigMemberSignature.ZK_LOGIN = type("MultisigMemberSignature.ZK_LOGIN", (MultisigMemberSignature.ZK_LOGIN, MultisigMemberSignature,), {}) # type: ignore - - - - -class _UniffiConverterTypeMultisigMemberSignature(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return MultisigMemberSignature.ED25519( - _UniffiConverterTypeEd25519Signature.read(buf), - ) - if variant == 2: - return MultisigMemberSignature.SECP256K1( - _UniffiConverterTypeSecp256k1Signature.read(buf), - ) - if variant == 3: - return MultisigMemberSignature.SECP256R1( - _UniffiConverterTypeSecp256r1Signature.read(buf), - ) - if variant == 4: - return MultisigMemberSignature.ZK_LOGIN( - _UniffiConverterTypeBoxedZkLoginAuthenticator.read(buf), - ) - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value.is_ED25519(): - _UniffiConverterTypeEd25519Signature.check_lower(value._values[0]) - return - if value.is_SECP256K1(): - _UniffiConverterTypeSecp256k1Signature.check_lower(value._values[0]) - return - if value.is_SECP256R1(): - _UniffiConverterTypeSecp256r1Signature.check_lower(value._values[0]) - return - if value.is_ZK_LOGIN(): - _UniffiConverterTypeBoxedZkLoginAuthenticator.check_lower(value._values[0]) - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value.is_ED25519(): - buf.write_i32(1) - _UniffiConverterTypeEd25519Signature.write(value._values[0], buf) - if value.is_SECP256K1(): - buf.write_i32(2) - _UniffiConverterTypeSecp256k1Signature.write(value._values[0], buf) - if value.is_SECP256R1(): - buf.write_i32(3) - _UniffiConverterTypeSecp256r1Signature.write(value._values[0], buf) - if value.is_ZK_LOGIN(): - buf.write_i32(4) - _UniffiConverterTypeBoxedZkLoginAuthenticator.write(value._values[0], buf) - - - - - - - -class ObjectData: - """ - Object data, either a package or struct - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - object-data = object-data-struct / object-data-package - - object-data-struct = %x00 object-move-struct - object-data-package = %x01 object-move-package - ``` - """ - - def __init__(self): - raise RuntimeError("ObjectData cannot be instantiated directly") - - # Each enum variant is a nested class of the enum itself. - class STRUCT: - """ - An object whose governing logic lives in a published Move module - """ - - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"ObjectData.STRUCT{self._values!r}" - - def __eq__(self, other): - if not other.is_STRUCT(): - return False - return self._values == other._values - class PACKAGE: - """ - Map from each module name to raw serialized Move module bytes - """ - - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"ObjectData.PACKAGE{self._values!r}" - - def __eq__(self, other): - if not other.is_PACKAGE(): - return False - return self._values == other._values - - - # For each variant, we have `is_NAME` and `is_name` methods for easily checking - # whether an instance is that variant. - def is_STRUCT(self) -> bool: - return isinstance(self, ObjectData.STRUCT) - def is_struct(self) -> bool: - return isinstance(self, ObjectData.STRUCT) - def is_PACKAGE(self) -> bool: - return isinstance(self, ObjectData.PACKAGE) - def is_package(self) -> bool: - return isinstance(self, ObjectData.PACKAGE) - - -# 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. -ObjectData.STRUCT = type("ObjectData.STRUCT", (ObjectData.STRUCT, ObjectData,), {}) # type: ignore -ObjectData.PACKAGE = type("ObjectData.PACKAGE", (ObjectData.PACKAGE, ObjectData,), {}) # type: ignore - - - - -class _UniffiConverterTypeObjectData(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return ObjectData.STRUCT( - _UniffiConverterTypeMoveStruct.read(buf), - ) - if variant == 2: - return ObjectData.PACKAGE( - _UniffiConverterTypeMovePackage.read(buf), - ) - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value.is_STRUCT(): - _UniffiConverterTypeMoveStruct.check_lower(value._values[0]) - return - if value.is_PACKAGE(): - _UniffiConverterTypeMovePackage.check_lower(value._values[0]) - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value.is_STRUCT(): - buf.write_i32(1) - _UniffiConverterTypeMoveStruct.write(value._values[0], buf) - if value.is_PACKAGE(): - buf.write_i32(2) - _UniffiConverterTypeMovePackage.write(value._values[0], buf) - - - - - - - -class ObjectIn: - """ - State of an object prior to execution - - If an object exists (at root-level) in the store prior to this transaction, - it should be Exist, otherwise it's NonExist, e.g. wrapped objects should be - NonExist. - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - object-in = object-in-not-exist / object-in-exist - - object-in-not-exist = %x00 - object-in-exist = %x01 u64 digest owner - ``` - """ - - def __init__(self): - raise RuntimeError("ObjectIn cannot be instantiated directly") - - # Each enum variant is a nested class of the enum itself. - class NOT_EXIST: - - def __init__(self,): - pass - - def __str__(self): - return "ObjectIn.NOT_EXIST()".format() - - def __eq__(self, other): - if not other.is_NOT_EXIST(): - return False - return True - - class EXIST: - """ - The old version, digest and owner. - """ - - version: "int" - digest: "ObjectDigest" - owner: "Owner" - - def __init__(self,version: "int", digest: "ObjectDigest", owner: "Owner"): - self.version = version - self.digest = digest - self.owner = owner - - def __str__(self): - return "ObjectIn.EXIST(version={}, digest={}, owner={})".format(self.version, self.digest, self.owner) - - def __eq__(self, other): - if not other.is_EXIST(): - return False - if self.version != other.version: - return False - if self.digest != other.digest: - return False - if self.owner != other.owner: - return False - return True - - - - # For each variant, we have `is_NAME` and `is_name` methods for easily checking - # whether an instance is that variant. - def is_NOT_EXIST(self) -> bool: - return isinstance(self, ObjectIn.NOT_EXIST) - def is_not_exist(self) -> bool: - return isinstance(self, ObjectIn.NOT_EXIST) - def is_EXIST(self) -> bool: - return isinstance(self, ObjectIn.EXIST) - def is_exist(self) -> bool: - return isinstance(self, ObjectIn.EXIST) - - -# 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. -ObjectIn.NOT_EXIST = type("ObjectIn.NOT_EXIST", (ObjectIn.NOT_EXIST, ObjectIn,), {}) # type: ignore -ObjectIn.EXIST = type("ObjectIn.EXIST", (ObjectIn.EXIST, ObjectIn,), {}) # type: ignore - - - - -class _UniffiConverterTypeObjectIn(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return ObjectIn.NOT_EXIST( - ) - if variant == 2: - return ObjectIn.EXIST( - _UniffiConverterUInt64.read(buf), - _UniffiConverterTypeObjectDigest.read(buf), - _UniffiConverterTypeOwner.read(buf), - ) - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value.is_NOT_EXIST(): - return - if value.is_EXIST(): - _UniffiConverterUInt64.check_lower(value.version) - _UniffiConverterTypeObjectDigest.check_lower(value.digest) - _UniffiConverterTypeOwner.check_lower(value.owner) - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value.is_NOT_EXIST(): - buf.write_i32(1) - if value.is_EXIST(): - buf.write_i32(2) - _UniffiConverterUInt64.write(value.version, buf) - _UniffiConverterTypeObjectDigest.write(value.digest, buf) - _UniffiConverterTypeOwner.write(value.owner, buf) - - - - - - - -class ObjectOut: - """ - State of an object after execution - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - object-out = object-out-not-exist - =/ object-out-object-write - =/ object-out-package-write - - - object-out-not-exist = %x00 - object-out-object-write = %x01 digest owner - object-out-package-write = %x02 version digest - ``` - """ - - def __init__(self): - raise RuntimeError("ObjectOut cannot be instantiated directly") - - # Each enum variant is a nested class of the enum itself. - class NOT_EXIST: - """ - Same definition as in ObjectIn. - """ - - - def __init__(self,): - pass - - def __str__(self): - return "ObjectOut.NOT_EXIST()".format() - - def __eq__(self, other): - if not other.is_NOT_EXIST(): - return False - return True - - class OBJECT_WRITE: - """ - Any written object, including all of mutated, created, unwrapped today. - """ - - digest: "ObjectDigest" - owner: "Owner" - - def __init__(self,digest: "ObjectDigest", owner: "Owner"): - self.digest = digest - self.owner = owner - - def __str__(self): - return "ObjectOut.OBJECT_WRITE(digest={}, owner={})".format(self.digest, self.owner) - - def __eq__(self, other): - if not other.is_OBJECT_WRITE(): - return False - if self.digest != other.digest: - return False - if self.owner != other.owner: - return False - return True - - class PACKAGE_WRITE: - """ - Packages writes need to be tracked separately with version because - we don't use lamport version for package publish and upgrades. - """ - - version: "int" - digest: "ObjectDigest" - - def __init__(self,version: "int", digest: "ObjectDigest"): - self.version = version - self.digest = digest - - def __str__(self): - return "ObjectOut.PACKAGE_WRITE(version={}, digest={})".format(self.version, self.digest) - - def __eq__(self, other): - if not other.is_PACKAGE_WRITE(): - return False - if self.version != other.version: - return False - if self.digest != other.digest: - return False - return True - - - - # For each variant, we have `is_NAME` and `is_name` methods for easily checking - # whether an instance is that variant. - def is_NOT_EXIST(self) -> bool: - return isinstance(self, ObjectOut.NOT_EXIST) - def is_not_exist(self) -> bool: - return isinstance(self, ObjectOut.NOT_EXIST) - def is_OBJECT_WRITE(self) -> bool: - return isinstance(self, ObjectOut.OBJECT_WRITE) - def is_object_write(self) -> bool: - return isinstance(self, ObjectOut.OBJECT_WRITE) - def is_PACKAGE_WRITE(self) -> bool: - return isinstance(self, ObjectOut.PACKAGE_WRITE) - def is_package_write(self) -> bool: - return isinstance(self, ObjectOut.PACKAGE_WRITE) - - -# 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. -ObjectOut.NOT_EXIST = type("ObjectOut.NOT_EXIST", (ObjectOut.NOT_EXIST, ObjectOut,), {}) # type: ignore -ObjectOut.OBJECT_WRITE = type("ObjectOut.OBJECT_WRITE", (ObjectOut.OBJECT_WRITE, ObjectOut,), {}) # type: ignore -ObjectOut.PACKAGE_WRITE = type("ObjectOut.PACKAGE_WRITE", (ObjectOut.PACKAGE_WRITE, ObjectOut,), {}) # type: ignore - - - - -class _UniffiConverterTypeObjectOut(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return ObjectOut.NOT_EXIST( - ) - if variant == 2: - return ObjectOut.OBJECT_WRITE( - _UniffiConverterTypeObjectDigest.read(buf), - _UniffiConverterTypeOwner.read(buf), - ) - if variant == 3: - return ObjectOut.PACKAGE_WRITE( - _UniffiConverterUInt64.read(buf), - _UniffiConverterTypeObjectDigest.read(buf), - ) - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value.is_NOT_EXIST(): - return - if value.is_OBJECT_WRITE(): - _UniffiConverterTypeObjectDigest.check_lower(value.digest) - _UniffiConverterTypeOwner.check_lower(value.owner) - return - if value.is_PACKAGE_WRITE(): - _UniffiConverterUInt64.check_lower(value.version) - _UniffiConverterTypeObjectDigest.check_lower(value.digest) - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value.is_NOT_EXIST(): - buf.write_i32(1) - if value.is_OBJECT_WRITE(): - buf.write_i32(2) - _UniffiConverterTypeObjectDigest.write(value.digest, buf) - _UniffiConverterTypeOwner.write(value.owner, buf) - if value.is_PACKAGE_WRITE(): - buf.write_i32(3) - _UniffiConverterUInt64.write(value.version, buf) - _UniffiConverterTypeObjectDigest.write(value.digest, buf) - - - - - - - -class Owner: - """ - Enum of different types of ownership for an object. - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - owner = owner-address / owner-object / owner-shared / owner-immutable - - owner-address = %x00 address - owner-object = %x01 object-id - owner-shared = %x02 u64 - owner-immutable = %x03 - ``` - """ - - def __init__(self): - raise RuntimeError("Owner cannot be instantiated directly") - - # Each enum variant is a nested class of the enum itself. - class ADDRESS: - """ - Object is exclusively owned by a single address, and is mutable. - """ - - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"Owner.ADDRESS{self._values!r}" - - def __eq__(self, other): - if not other.is_ADDRESS(): - return False - return self._values == other._values - class OBJECT: - """ - Object is exclusively owned by a single object, and is mutable. - """ - - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"Owner.OBJECT{self._values!r}" - - def __eq__(self, other): - if not other.is_OBJECT(): - return False - return self._values == other._values - class SHARED: - """ - Object is shared, can be used by any address, and is mutable. - """ - - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"Owner.SHARED{self._values!r}" - - def __eq__(self, other): - if not other.is_SHARED(): - return False - return self._values == other._values - class IMMUTABLE: - """ - Object is immutable, and hence ownership doesn't matter. - """ - - - def __init__(self,): - pass - - def __str__(self): - return "Owner.IMMUTABLE()".format() - - def __eq__(self, other): - if not other.is_IMMUTABLE(): - return False - return True - - - - # For each variant, we have `is_NAME` and `is_name` methods for easily checking - # whether an instance is that variant. - def is_ADDRESS(self) -> bool: - return isinstance(self, Owner.ADDRESS) - def is_address(self) -> bool: - return isinstance(self, Owner.ADDRESS) - def is_OBJECT(self) -> bool: - return isinstance(self, Owner.OBJECT) - def is_object(self) -> bool: - return isinstance(self, Owner.OBJECT) - def is_SHARED(self) -> bool: - return isinstance(self, Owner.SHARED) - def is_shared(self) -> bool: - return isinstance(self, Owner.SHARED) - def is_IMMUTABLE(self) -> bool: - return isinstance(self, Owner.IMMUTABLE) - def is_immutable(self) -> bool: - return isinstance(self, Owner.IMMUTABLE) - - -# 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. -Owner.ADDRESS = type("Owner.ADDRESS", (Owner.ADDRESS, Owner,), {}) # type: ignore -Owner.OBJECT = type("Owner.OBJECT", (Owner.OBJECT, Owner,), {}) # type: ignore -Owner.SHARED = type("Owner.SHARED", (Owner.SHARED, Owner,), {}) # type: ignore -Owner.IMMUTABLE = type("Owner.IMMUTABLE", (Owner.IMMUTABLE, Owner,), {}) # type: ignore - - - - -class _UniffiConverterTypeOwner(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return Owner.ADDRESS( - _UniffiConverterTypeAddress.read(buf), - ) - if variant == 2: - return Owner.OBJECT( - _UniffiConverterTypeObjectId.read(buf), - ) - if variant == 3: - return Owner.SHARED( - _UniffiConverterUInt64.read(buf), - ) - if variant == 4: - return Owner.IMMUTABLE( - ) - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value.is_ADDRESS(): - _UniffiConverterTypeAddress.check_lower(value._values[0]) - return - if value.is_OBJECT(): - _UniffiConverterTypeObjectId.check_lower(value._values[0]) - return - if value.is_SHARED(): - _UniffiConverterUInt64.check_lower(value._values[0]) - return - if value.is_IMMUTABLE(): - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value.is_ADDRESS(): - buf.write_i32(1) - _UniffiConverterTypeAddress.write(value._values[0], buf) - if value.is_OBJECT(): - buf.write_i32(2) - _UniffiConverterTypeObjectId.write(value._values[0], buf) - if value.is_SHARED(): - buf.write_i32(3) - _UniffiConverterUInt64.write(value._values[0], buf) - if value.is_IMMUTABLE(): - buf.write_i32(4) - - - - - - - -class PackageUpgradeError: - """ - An error with a upgrading a package - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - package-upgrade-error = unable-to-fetch-package / - not-a-package / - incompatible-upgrade / - digest-does-not-match / - unknown-upgrade-policy / - package-id-does-not-match - - unable-to-fetch-package = %x00 object-id - not-a-package = %x01 object-id - incompatible-upgrade = %x02 - digest-does-not-match = %x03 digest - unknown-upgrade-policy = %x04 u8 - package-id-does-not-match = %x05 object-id object-id - ``` - """ - - def __init__(self): - raise RuntimeError("PackageUpgradeError cannot be instantiated directly") - - # Each enum variant is a nested class of the enum itself. - class UNABLE_TO_FETCH_PACKAGE: - """ - Unable to fetch package - """ - - package_id: "ObjectId" - - def __init__(self,package_id: "ObjectId"): - self.package_id = package_id - - def __str__(self): - return "PackageUpgradeError.UNABLE_TO_FETCH_PACKAGE(package_id={})".format(self.package_id) - - def __eq__(self, other): - if not other.is_UNABLE_TO_FETCH_PACKAGE(): - return False - if self.package_id != other.package_id: - return False - return True - - class NOT_A_PACKAGE: - """ - Object is not a package - """ - - object_id: "ObjectId" - - def __init__(self,object_id: "ObjectId"): - self.object_id = object_id - - def __str__(self): - return "PackageUpgradeError.NOT_A_PACKAGE(object_id={})".format(self.object_id) - - def __eq__(self, other): - if not other.is_NOT_A_PACKAGE(): - return False - if self.object_id != other.object_id: - return False - return True - - class INCOMPATIBLE_UPGRADE: - """ - Package upgrade is incompatible with previous version - """ - - - def __init__(self,): - pass - - def __str__(self): - return "PackageUpgradeError.INCOMPATIBLE_UPGRADE()".format() - - def __eq__(self, other): - if not other.is_INCOMPATIBLE_UPGRADE(): - return False - return True - - class DIGEST_DOES_NOT_MATCH: - """ - Digest in upgrade ticket and computed digest differ - """ - - digest: "Digest" - - def __init__(self,digest: "Digest"): - self.digest = digest - - def __str__(self): - return "PackageUpgradeError.DIGEST_DOES_NOT_MATCH(digest={})".format(self.digest) - - def __eq__(self, other): - if not other.is_DIGEST_DOES_NOT_MATCH(): - return False - if self.digest != other.digest: - return False - return True - - class UNKNOWN_UPGRADE_POLICY: - """ - Upgrade policy is not valid - """ - - policy: "int" - - def __init__(self,policy: "int"): - self.policy = policy - - def __str__(self): - return "PackageUpgradeError.UNKNOWN_UPGRADE_POLICY(policy={})".format(self.policy) - - def __eq__(self, other): - if not other.is_UNKNOWN_UPGRADE_POLICY(): - return False - if self.policy != other.policy: - return False - return True - - class PACKAGE_ID_DOES_NOT_MATCH: - """ - PackageId does not matach PackageId in upgrade ticket - """ - - package_id: "ObjectId" - ticket_id: "ObjectId" - - def __init__(self,package_id: "ObjectId", ticket_id: "ObjectId"): - self.package_id = package_id - self.ticket_id = ticket_id - - def __str__(self): - return "PackageUpgradeError.PACKAGE_ID_DOES_NOT_MATCH(package_id={}, ticket_id={})".format(self.package_id, self.ticket_id) - - def __eq__(self, other): - if not other.is_PACKAGE_ID_DOES_NOT_MATCH(): - return False - if self.package_id != other.package_id: - return False - if self.ticket_id != other.ticket_id: - return False - return True - - - - # For each variant, we have `is_NAME` and `is_name` methods for easily checking - # whether an instance is that variant. - def is_UNABLE_TO_FETCH_PACKAGE(self) -> bool: - return isinstance(self, PackageUpgradeError.UNABLE_TO_FETCH_PACKAGE) - def is_unable_to_fetch_package(self) -> bool: - return isinstance(self, PackageUpgradeError.UNABLE_TO_FETCH_PACKAGE) - def is_NOT_A_PACKAGE(self) -> bool: - return isinstance(self, PackageUpgradeError.NOT_A_PACKAGE) - def is_not_a_package(self) -> bool: - return isinstance(self, PackageUpgradeError.NOT_A_PACKAGE) - def is_INCOMPATIBLE_UPGRADE(self) -> bool: - return isinstance(self, PackageUpgradeError.INCOMPATIBLE_UPGRADE) - def is_incompatible_upgrade(self) -> bool: - return isinstance(self, PackageUpgradeError.INCOMPATIBLE_UPGRADE) - def is_DIGEST_DOES_NOT_MATCH(self) -> bool: - return isinstance(self, PackageUpgradeError.DIGEST_DOES_NOT_MATCH) - def is_digest_does_not_match(self) -> bool: - return isinstance(self, PackageUpgradeError.DIGEST_DOES_NOT_MATCH) - def is_UNKNOWN_UPGRADE_POLICY(self) -> bool: - return isinstance(self, PackageUpgradeError.UNKNOWN_UPGRADE_POLICY) - def is_unknown_upgrade_policy(self) -> bool: - return isinstance(self, PackageUpgradeError.UNKNOWN_UPGRADE_POLICY) - def is_PACKAGE_ID_DOES_NOT_MATCH(self) -> bool: - return isinstance(self, PackageUpgradeError.PACKAGE_ID_DOES_NOT_MATCH) - def is_package_id_does_not_match(self) -> bool: - return isinstance(self, PackageUpgradeError.PACKAGE_ID_DOES_NOT_MATCH) - - -# 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. -PackageUpgradeError.UNABLE_TO_FETCH_PACKAGE = type("PackageUpgradeError.UNABLE_TO_FETCH_PACKAGE", (PackageUpgradeError.UNABLE_TO_FETCH_PACKAGE, PackageUpgradeError,), {}) # type: ignore -PackageUpgradeError.NOT_A_PACKAGE = type("PackageUpgradeError.NOT_A_PACKAGE", (PackageUpgradeError.NOT_A_PACKAGE, PackageUpgradeError,), {}) # type: ignore -PackageUpgradeError.INCOMPATIBLE_UPGRADE = type("PackageUpgradeError.INCOMPATIBLE_UPGRADE", (PackageUpgradeError.INCOMPATIBLE_UPGRADE, PackageUpgradeError,), {}) # type: ignore -PackageUpgradeError.DIGEST_DOES_NOT_MATCH = type("PackageUpgradeError.DIGEST_DOES_NOT_MATCH", (PackageUpgradeError.DIGEST_DOES_NOT_MATCH, PackageUpgradeError,), {}) # type: ignore -PackageUpgradeError.UNKNOWN_UPGRADE_POLICY = type("PackageUpgradeError.UNKNOWN_UPGRADE_POLICY", (PackageUpgradeError.UNKNOWN_UPGRADE_POLICY, PackageUpgradeError,), {}) # type: ignore -PackageUpgradeError.PACKAGE_ID_DOES_NOT_MATCH = type("PackageUpgradeError.PACKAGE_ID_DOES_NOT_MATCH", (PackageUpgradeError.PACKAGE_ID_DOES_NOT_MATCH, PackageUpgradeError,), {}) # type: ignore - - - - -class _UniffiConverterTypePackageUpgradeError(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return PackageUpgradeError.UNABLE_TO_FETCH_PACKAGE( - _UniffiConverterTypeObjectId.read(buf), - ) - if variant == 2: - return PackageUpgradeError.NOT_A_PACKAGE( - _UniffiConverterTypeObjectId.read(buf), - ) - if variant == 3: - return PackageUpgradeError.INCOMPATIBLE_UPGRADE( - ) - if variant == 4: - return PackageUpgradeError.DIGEST_DOES_NOT_MATCH( - _UniffiConverterTypeDigest.read(buf), - ) - if variant == 5: - return PackageUpgradeError.UNKNOWN_UPGRADE_POLICY( - _UniffiConverterUInt8.read(buf), - ) - if variant == 6: - return PackageUpgradeError.PACKAGE_ID_DOES_NOT_MATCH( - _UniffiConverterTypeObjectId.read(buf), - _UniffiConverterTypeObjectId.read(buf), - ) - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value.is_UNABLE_TO_FETCH_PACKAGE(): - _UniffiConverterTypeObjectId.check_lower(value.package_id) - return - if value.is_NOT_A_PACKAGE(): - _UniffiConverterTypeObjectId.check_lower(value.object_id) - return - if value.is_INCOMPATIBLE_UPGRADE(): - return - if value.is_DIGEST_DOES_NOT_MATCH(): - _UniffiConverterTypeDigest.check_lower(value.digest) - return - if value.is_UNKNOWN_UPGRADE_POLICY(): - _UniffiConverterUInt8.check_lower(value.policy) - return - if value.is_PACKAGE_ID_DOES_NOT_MATCH(): - _UniffiConverterTypeObjectId.check_lower(value.package_id) - _UniffiConverterTypeObjectId.check_lower(value.ticket_id) - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value.is_UNABLE_TO_FETCH_PACKAGE(): - buf.write_i32(1) - _UniffiConverterTypeObjectId.write(value.package_id, buf) - if value.is_NOT_A_PACKAGE(): - buf.write_i32(2) - _UniffiConverterTypeObjectId.write(value.object_id, buf) - if value.is_INCOMPATIBLE_UPGRADE(): - buf.write_i32(3) - if value.is_DIGEST_DOES_NOT_MATCH(): - buf.write_i32(4) - _UniffiConverterTypeDigest.write(value.digest, buf) - if value.is_UNKNOWN_UPGRADE_POLICY(): - buf.write_i32(5) - _UniffiConverterUInt8.write(value.policy, buf) - if value.is_PACKAGE_ID_DOES_NOT_MATCH(): - buf.write_i32(6) - _UniffiConverterTypeObjectId.write(value.package_id, buf) - _UniffiConverterTypeObjectId.write(value.ticket_id, buf) - - - - - - - -class SimpleSignature: - """ - A basic signature - - This enumeration defines the set of simple or basic signature schemes - supported by IOTA. Most signature schemes supported by IOTA end up - comprising of a at least one simple signature scheme. - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - simple-signature-bcs = bytes ; where the contents of the bytes are defined by - simple-signature = (ed25519-flag ed25519-signature ed25519-public-key) / - (secp256k1-flag secp256k1-signature secp256k1-public-key) / - (secp256r1-flag secp256r1-signature secp256r1-public-key) - ``` - - Note: Due to historical reasons, signatures are serialized slightly - different from the majority of the types in IOTA. In particular if a - signature is ever embedded in another structure it generally is serialized - as `bytes` meaning it has a length prefix that defines the length of - the completely serialized signature. - """ - - def __init__(self): - raise RuntimeError("SimpleSignature cannot be instantiated directly") - - # Each enum variant is a nested class of the enum itself. - class ED25519: - signature: "Ed25519Signature" - public_key: "Ed25519PublicKey" - - def __init__(self,signature: "Ed25519Signature", public_key: "Ed25519PublicKey"): - self.signature = signature - self.public_key = public_key - - def __str__(self): - return "SimpleSignature.ED25519(signature={}, public_key={})".format(self.signature, self.public_key) - - def __eq__(self, other): - if not other.is_ED25519(): - return False - if self.signature != other.signature: - return False - if self.public_key != other.public_key: - return False - return True - - class SECP256K1: - signature: "Secp256k1Signature" - public_key: "Secp256k1PublicKey" - - def __init__(self,signature: "Secp256k1Signature", public_key: "Secp256k1PublicKey"): - self.signature = signature - self.public_key = public_key - - def __str__(self): - return "SimpleSignature.SECP256K1(signature={}, public_key={})".format(self.signature, self.public_key) - - def __eq__(self, other): - if not other.is_SECP256K1(): - return False - if self.signature != other.signature: - return False - if self.public_key != other.public_key: - return False - return True - - class SECP256R1: - signature: "Secp256r1Signature" - public_key: "Secp256r1PublicKey" - - def __init__(self,signature: "Secp256r1Signature", public_key: "Secp256r1PublicKey"): - self.signature = signature - self.public_key = public_key - - def __str__(self): - return "SimpleSignature.SECP256R1(signature={}, public_key={})".format(self.signature, self.public_key) - - def __eq__(self, other): - if not other.is_SECP256R1(): - return False - if self.signature != other.signature: - return False - if self.public_key != other.public_key: - return False - return True - - - - # For each variant, we have `is_NAME` and `is_name` methods for easily checking - # whether an instance is that variant. - def is_ED25519(self) -> bool: - return isinstance(self, SimpleSignature.ED25519) - def is_ed25519(self) -> bool: - return isinstance(self, SimpleSignature.ED25519) - def is_SECP256K1(self) -> bool: - return isinstance(self, SimpleSignature.SECP256K1) - def is_secp256k1(self) -> bool: - return isinstance(self, SimpleSignature.SECP256K1) - def is_SECP256R1(self) -> bool: - return isinstance(self, SimpleSignature.SECP256R1) - def is_secp256r1(self) -> bool: - return isinstance(self, SimpleSignature.SECP256R1) - - -# 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. -SimpleSignature.ED25519 = type("SimpleSignature.ED25519", (SimpleSignature.ED25519, SimpleSignature,), {}) # type: ignore -SimpleSignature.SECP256K1 = type("SimpleSignature.SECP256K1", (SimpleSignature.SECP256K1, SimpleSignature,), {}) # type: ignore -SimpleSignature.SECP256R1 = type("SimpleSignature.SECP256R1", (SimpleSignature.SECP256R1, SimpleSignature,), {}) # type: ignore - - - - -class _UniffiConverterTypeSimpleSignature(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return SimpleSignature.ED25519( - _UniffiConverterTypeEd25519Signature.read(buf), - _UniffiConverterTypeEd25519PublicKey.read(buf), - ) - if variant == 2: - return SimpleSignature.SECP256K1( - _UniffiConverterTypeSecp256k1Signature.read(buf), - _UniffiConverterTypeSecp256k1PublicKey.read(buf), - ) - if variant == 3: - return SimpleSignature.SECP256R1( - _UniffiConverterTypeSecp256r1Signature.read(buf), - _UniffiConverterTypeSecp256r1PublicKey.read(buf), - ) - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value.is_ED25519(): - _UniffiConverterTypeEd25519Signature.check_lower(value.signature) - _UniffiConverterTypeEd25519PublicKey.check_lower(value.public_key) - return - if value.is_SECP256K1(): - _UniffiConverterTypeSecp256k1Signature.check_lower(value.signature) - _UniffiConverterTypeSecp256k1PublicKey.check_lower(value.public_key) - return - if value.is_SECP256R1(): - _UniffiConverterTypeSecp256r1Signature.check_lower(value.signature) - _UniffiConverterTypeSecp256r1PublicKey.check_lower(value.public_key) - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value.is_ED25519(): - buf.write_i32(1) - _UniffiConverterTypeEd25519Signature.write(value.signature, buf) - _UniffiConverterTypeEd25519PublicKey.write(value.public_key, buf) - if value.is_SECP256K1(): - buf.write_i32(2) - _UniffiConverterTypeSecp256k1Signature.write(value.signature, buf) - _UniffiConverterTypeSecp256k1PublicKey.write(value.public_key, buf) - if value.is_SECP256R1(): - buf.write_i32(3) - _UniffiConverterTypeSecp256r1Signature.write(value.signature, buf) - _UniffiConverterTypeSecp256r1PublicKey.write(value.public_key, buf) - - - - - - - -class TransactionEffects: - """ - The output or effects of executing a transaction - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - transaction-effects = %x00 effects-v1 - =/ %x01 effects-v2 - ``` - """ - - def __init__(self): - raise RuntimeError("TransactionEffects cannot be instantiated directly") - - # Each enum variant is a nested class of the enum itself. - class V1: - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"TransactionEffects.V1{self._values!r}" - - def __eq__(self, other): - if not other.is_V1(): - return False - return self._values == other._values - - - # For each variant, we have `is_NAME` and `is_name` methods for easily checking - # whether an instance is that variant. - def is_V1(self) -> bool: - return isinstance(self, TransactionEffects.V1) - def is_v1(self) -> bool: - return isinstance(self, TransactionEffects.V1) - - -# 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. -TransactionEffects.V1 = type("TransactionEffects.V1", (TransactionEffects.V1, TransactionEffects,), {}) # type: ignore - - - - -class _UniffiConverterTypeTransactionEffects(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return TransactionEffects.V1( - _UniffiConverterTypeBoxedTransactionEffectsV1.read(buf), - ) - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value.is_V1(): - _UniffiConverterTypeBoxedTransactionEffectsV1.check_lower(value._values[0]) - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value.is_V1(): - buf.write_i32(1) - _UniffiConverterTypeBoxedTransactionEffectsV1.write(value._values[0], buf) - - - - - - - -class TransactionExpiration: - """ - A TTL for a transaction - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - transaction-expiration = %x00 ; none - =/ %x01 u64 ; epoch - ``` - """ - - def __init__(self): - raise RuntimeError("TransactionExpiration cannot be instantiated directly") - - # Each enum variant is a nested class of the enum itself. - class NONE: - """ - The transaction has no expiration - """ - - - def __init__(self,): - pass - - def __str__(self): - return "TransactionExpiration.NONE()".format() - - def __eq__(self, other): - if not other.is_NONE(): - return False - return True - - class EPOCH: - """ - Validators wont sign a transaction unless the expiration Epoch - is greater than or equal to the current epoch - """ - - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"TransactionExpiration.EPOCH{self._values!r}" - - def __eq__(self, other): - if not other.is_EPOCH(): - return False - return self._values == other._values - - - # For each variant, we have `is_NAME` and `is_name` methods for easily checking - # whether an instance is that variant. - def is_NONE(self) -> bool: - return isinstance(self, TransactionExpiration.NONE) - def is_none(self) -> bool: - return isinstance(self, TransactionExpiration.NONE) - def is_EPOCH(self) -> bool: - return isinstance(self, TransactionExpiration.EPOCH) - def is_epoch(self) -> bool: - return isinstance(self, TransactionExpiration.EPOCH) - - -# 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. -TransactionExpiration.NONE = type("TransactionExpiration.NONE", (TransactionExpiration.NONE, TransactionExpiration,), {}) # type: ignore -TransactionExpiration.EPOCH = type("TransactionExpiration.EPOCH", (TransactionExpiration.EPOCH, TransactionExpiration,), {}) # type: ignore - - - - -class _UniffiConverterTypeTransactionExpiration(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return TransactionExpiration.NONE( - ) - if variant == 2: - return TransactionExpiration.EPOCH( - _UniffiConverterUInt64.read(buf), - ) - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value.is_NONE(): - return - if value.is_EPOCH(): - _UniffiConverterUInt64.check_lower(value._values[0]) - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value.is_NONE(): - buf.write_i32(1) - if value.is_EPOCH(): - buf.write_i32(2) - _UniffiConverterUInt64.write(value._values[0], buf) - - - - - - - -class TransactionKind: - """ - Transaction type - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - transaction-kind = %x00 ptb - =/ %x01 change-epoch - =/ %x02 genesis-transaction - =/ %x03 consensus-commit-prologue - =/ %x04 authenticator-state-update - =/ %x05 (vector end-of-epoch-transaction-kind) - =/ %x06 randomness-state-update - =/ %x07 consensus-commit-prologue-v2 - =/ %x08 consensus-commit-prologue-v3 - ``` - """ - - def __init__(self): - raise RuntimeError("TransactionKind cannot be instantiated directly") - - # Each enum variant is a nested class of the enum itself. - class PROGRAMMABLE_TRANSACTION: - """ - A user transaction comprised of a list of native commands and move calls - """ - - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"TransactionKind.PROGRAMMABLE_TRANSACTION{self._values!r}" - - def __eq__(self, other): - if not other.is_PROGRAMMABLE_TRANSACTION(): - return False - return self._values == other._values - class GENESIS: - """ - Transaction used to initialize the chain state. - - Only valid if in the genesis checkpoint (0) and if this is the very - first transaction ever executed on the chain. - """ - - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"TransactionKind.GENESIS{self._values!r}" - - def __eq__(self, other): - if not other.is_GENESIS(): - return False - return self._values == other._values - class CONSENSUS_COMMIT_PROLOGUE_V1: - """ - V1 consensus commit update - """ - - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"TransactionKind.CONSENSUS_COMMIT_PROLOGUE_V1{self._values!r}" - - def __eq__(self, other): - if not other.is_CONSENSUS_COMMIT_PROLOGUE_V1(): - return False - return self._values == other._values - class AUTHENTICATOR_STATE_UPDATE_V1: - """ - Update set of valid JWKs used for zklogin - """ - - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"TransactionKind.AUTHENTICATOR_STATE_UPDATE_V1{self._values!r}" - - def __eq__(self, other): - if not other.is_AUTHENTICATOR_STATE_UPDATE_V1(): - return False - return self._values == other._values - class END_OF_EPOCH: - """ - Set of operations to run at the end of the epoch to close out the - current epoch and start the next one. - """ - - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"TransactionKind.END_OF_EPOCH{self._values!r}" - - def __eq__(self, other): - if not other.is_END_OF_EPOCH(): - return False - return self._values == other._values - class RANDOMNESS_STATE_UPDATE: - """ - Randomness update - """ - - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"TransactionKind.RANDOMNESS_STATE_UPDATE{self._values!r}" - - def __eq__(self, other): - if not other.is_RANDOMNESS_STATE_UPDATE(): - return False - return self._values == other._values - - - # For each variant, we have `is_NAME` and `is_name` methods for easily checking - # whether an instance is that variant. - def is_PROGRAMMABLE_TRANSACTION(self) -> bool: - return isinstance(self, TransactionKind.PROGRAMMABLE_TRANSACTION) - def is_programmable_transaction(self) -> bool: - return isinstance(self, TransactionKind.PROGRAMMABLE_TRANSACTION) - def is_GENESIS(self) -> bool: - return isinstance(self, TransactionKind.GENESIS) - def is_genesis(self) -> bool: - return isinstance(self, TransactionKind.GENESIS) - def is_CONSENSUS_COMMIT_PROLOGUE_V1(self) -> bool: - return isinstance(self, TransactionKind.CONSENSUS_COMMIT_PROLOGUE_V1) - def is_consensus_commit_prologue_v1(self) -> bool: - return isinstance(self, TransactionKind.CONSENSUS_COMMIT_PROLOGUE_V1) - def is_AUTHENTICATOR_STATE_UPDATE_V1(self) -> bool: - return isinstance(self, TransactionKind.AUTHENTICATOR_STATE_UPDATE_V1) - def is_authenticator_state_update_v1(self) -> bool: - return isinstance(self, TransactionKind.AUTHENTICATOR_STATE_UPDATE_V1) - def is_END_OF_EPOCH(self) -> bool: - return isinstance(self, TransactionKind.END_OF_EPOCH) - def is_end_of_epoch(self) -> bool: - return isinstance(self, TransactionKind.END_OF_EPOCH) - def is_RANDOMNESS_STATE_UPDATE(self) -> bool: - return isinstance(self, TransactionKind.RANDOMNESS_STATE_UPDATE) - def is_randomness_state_update(self) -> bool: - return isinstance(self, TransactionKind.RANDOMNESS_STATE_UPDATE) - - -# 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. -TransactionKind.PROGRAMMABLE_TRANSACTION = type("TransactionKind.PROGRAMMABLE_TRANSACTION", (TransactionKind.PROGRAMMABLE_TRANSACTION, TransactionKind,), {}) # type: ignore -TransactionKind.GENESIS = type("TransactionKind.GENESIS", (TransactionKind.GENESIS, TransactionKind,), {}) # type: ignore -TransactionKind.CONSENSUS_COMMIT_PROLOGUE_V1 = type("TransactionKind.CONSENSUS_COMMIT_PROLOGUE_V1", (TransactionKind.CONSENSUS_COMMIT_PROLOGUE_V1, TransactionKind,), {}) # type: ignore -TransactionKind.AUTHENTICATOR_STATE_UPDATE_V1 = type("TransactionKind.AUTHENTICATOR_STATE_UPDATE_V1", (TransactionKind.AUTHENTICATOR_STATE_UPDATE_V1, TransactionKind,), {}) # type: ignore -TransactionKind.END_OF_EPOCH = type("TransactionKind.END_OF_EPOCH", (TransactionKind.END_OF_EPOCH, TransactionKind,), {}) # type: ignore -TransactionKind.RANDOMNESS_STATE_UPDATE = type("TransactionKind.RANDOMNESS_STATE_UPDATE", (TransactionKind.RANDOMNESS_STATE_UPDATE, TransactionKind,), {}) # type: ignore - - - - -class _UniffiConverterTypeTransactionKind(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return TransactionKind.PROGRAMMABLE_TRANSACTION( - _UniffiConverterTypeProgrammableTransaction.read(buf), - ) - if variant == 2: - return TransactionKind.GENESIS( - _UniffiConverterTypeGenesisTransaction.read(buf), - ) - if variant == 3: - return TransactionKind.CONSENSUS_COMMIT_PROLOGUE_V1( - _UniffiConverterTypeConsensusCommitPrologueV1.read(buf), - ) - if variant == 4: - return TransactionKind.AUTHENTICATOR_STATE_UPDATE_V1( - _UniffiConverterTypeAuthenticatorStateUpdateV1.read(buf), - ) - if variant == 5: - return TransactionKind.END_OF_EPOCH( - _UniffiConverterSequenceTypeEndOfEpochTransactionKind.read(buf), - ) - if variant == 6: - return TransactionKind.RANDOMNESS_STATE_UPDATE( - _UniffiConverterTypeRandomnessStateUpdate.read(buf), - ) - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value.is_PROGRAMMABLE_TRANSACTION(): - _UniffiConverterTypeProgrammableTransaction.check_lower(value._values[0]) - return - if value.is_GENESIS(): - _UniffiConverterTypeGenesisTransaction.check_lower(value._values[0]) - return - if value.is_CONSENSUS_COMMIT_PROLOGUE_V1(): - _UniffiConverterTypeConsensusCommitPrologueV1.check_lower(value._values[0]) - return - if value.is_AUTHENTICATOR_STATE_UPDATE_V1(): - _UniffiConverterTypeAuthenticatorStateUpdateV1.check_lower(value._values[0]) - return - if value.is_END_OF_EPOCH(): - _UniffiConverterSequenceTypeEndOfEpochTransactionKind.check_lower(value._values[0]) - return - if value.is_RANDOMNESS_STATE_UPDATE(): - _UniffiConverterTypeRandomnessStateUpdate.check_lower(value._values[0]) - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value.is_PROGRAMMABLE_TRANSACTION(): - buf.write_i32(1) - _UniffiConverterTypeProgrammableTransaction.write(value._values[0], buf) - if value.is_GENESIS(): - buf.write_i32(2) - _UniffiConverterTypeGenesisTransaction.write(value._values[0], buf) - if value.is_CONSENSUS_COMMIT_PROLOGUE_V1(): - buf.write_i32(3) - _UniffiConverterTypeConsensusCommitPrologueV1.write(value._values[0], buf) - if value.is_AUTHENTICATOR_STATE_UPDATE_V1(): - buf.write_i32(4) - _UniffiConverterTypeAuthenticatorStateUpdateV1.write(value._values[0], buf) - if value.is_END_OF_EPOCH(): - buf.write_i32(5) - _UniffiConverterSequenceTypeEndOfEpochTransactionKind.write(value._values[0], buf) - if value.is_RANDOMNESS_STATE_UPDATE(): - buf.write_i32(6) - _UniffiConverterTypeRandomnessStateUpdate.write(value._values[0], buf) - - - - - - - -class TypeArgumentError(enum.Enum): - """ - An error with a type argument - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - type-argument-error = type-not-found / constraint-not-satisfied - type-not-found = %x00 - constraint-not-satisfied = %x01 - ``` - """ - - TYPE_NOT_FOUND = 0 - """ - A type was not found in the module specified - """ - - - CONSTRAINT_NOT_SATISFIED = 1 - """ - A type provided did not match the specified constraint - """ - - - - -class _UniffiConverterTypeTypeArgumentError(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return TypeArgumentError.TYPE_NOT_FOUND - if variant == 2: - return TypeArgumentError.CONSTRAINT_NOT_SATISFIED - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value == TypeArgumentError.TYPE_NOT_FOUND: - return - if value == TypeArgumentError.CONSTRAINT_NOT_SATISFIED: - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value == TypeArgumentError.TYPE_NOT_FOUND: - buf.write_i32(1) - if value == TypeArgumentError.CONSTRAINT_NOT_SATISFIED: - buf.write_i32(2) - - - - - - - -class TypeTag: - """ - Type of a move value - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - type-tag = type-tag-u8 \ - type-tag-u16 \ - type-tag-u32 \ - type-tag-u64 \ - type-tag-u128 \ - type-tag-u256 \ - type-tag-bool \ - type-tag-address \ - type-tag-signer \ - type-tag-vector \ - type-tag-struct - - type-tag-u8 = %x01 - type-tag-u16 = %x08 - type-tag-u32 = %x09 - type-tag-u64 = %x02 - type-tag-u128 = %x03 - type-tag-u256 = %x0a - type-tag-bool = %x00 - type-tag-address = %x04 - type-tag-signer = %x05 - type-tag-vector = %x06 type-tag - type-tag-struct = %x07 struct-tag - ``` - """ - - def __init__(self): - raise RuntimeError("TypeTag cannot be instantiated directly") - - # Each enum variant is a nested class of the enum itself. - class U8: - - def __init__(self,): - pass - - def __str__(self): - return "TypeTag.U8()".format() - - def __eq__(self, other): - if not other.is_U8(): - return False - return True - - class U16: - - def __init__(self,): - pass - - def __str__(self): - return "TypeTag.U16()".format() - - def __eq__(self, other): - if not other.is_U16(): - return False - return True - - class U32: - - def __init__(self,): - pass - - def __str__(self): - return "TypeTag.U32()".format() - - def __eq__(self, other): - if not other.is_U32(): - return False - return True - - class U64: - - def __init__(self,): - pass - - def __str__(self): - return "TypeTag.U64()".format() - - def __eq__(self, other): - if not other.is_U64(): - return False - return True - - class U128: - - def __init__(self,): - pass - - def __str__(self): - return "TypeTag.U128()".format() - - def __eq__(self, other): - if not other.is_U128(): - return False - return True - - class U256: - - def __init__(self,): - pass - - def __str__(self): - return "TypeTag.U256()".format() - - def __eq__(self, other): - if not other.is_U256(): - return False - return True - - class BOOL: - - def __init__(self,): - pass - - def __str__(self): - return "TypeTag.BOOL()".format() - - def __eq__(self, other): - if not other.is_BOOL(): - return False - return True - - class ADDRESS: - - def __init__(self,): - pass - - def __str__(self): - return "TypeTag.ADDRESS()".format() - - def __eq__(self, other): - if not other.is_ADDRESS(): - return False - return True - - class SIGNER: - - def __init__(self,): - pass - - def __str__(self): - return "TypeTag.SIGNER()".format() - - def __eq__(self, other): - if not other.is_SIGNER(): - return False - return True - - class VECTOR: - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"TypeTag.VECTOR{self._values!r}" - - def __eq__(self, other): - if not other.is_VECTOR(): - return False - return self._values == other._values - class STRUCT: - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"TypeTag.STRUCT{self._values!r}" - - def __eq__(self, other): - if not other.is_STRUCT(): - return False - return self._values == other._values - - - # For each variant, we have `is_NAME` and `is_name` methods for easily checking - # whether an instance is that variant. - def is_U8(self) -> bool: - return isinstance(self, TypeTag.U8) - def is_u8(self) -> bool: - return isinstance(self, TypeTag.U8) - def is_U16(self) -> bool: - return isinstance(self, TypeTag.U16) - def is_u16(self) -> bool: - return isinstance(self, TypeTag.U16) - def is_U32(self) -> bool: - return isinstance(self, TypeTag.U32) - def is_u32(self) -> bool: - return isinstance(self, TypeTag.U32) - def is_U64(self) -> bool: - return isinstance(self, TypeTag.U64) - def is_u64(self) -> bool: - return isinstance(self, TypeTag.U64) - def is_U128(self) -> bool: - return isinstance(self, TypeTag.U128) - def is_u128(self) -> bool: - return isinstance(self, TypeTag.U128) - def is_U256(self) -> bool: - return isinstance(self, TypeTag.U256) - def is_u256(self) -> bool: - return isinstance(self, TypeTag.U256) - def is_BOOL(self) -> bool: - return isinstance(self, TypeTag.BOOL) - def is_bool(self) -> bool: - return isinstance(self, TypeTag.BOOL) - def is_ADDRESS(self) -> bool: - return isinstance(self, TypeTag.ADDRESS) - def is_address(self) -> bool: - return isinstance(self, TypeTag.ADDRESS) - def is_SIGNER(self) -> bool: - return isinstance(self, TypeTag.SIGNER) - def is_signer(self) -> bool: - return isinstance(self, TypeTag.SIGNER) - def is_VECTOR(self) -> bool: - return isinstance(self, TypeTag.VECTOR) - def is_vector(self) -> bool: - return isinstance(self, TypeTag.VECTOR) - def is_STRUCT(self) -> bool: - return isinstance(self, TypeTag.STRUCT) - def is_struct(self) -> bool: - return isinstance(self, TypeTag.STRUCT) - - -# 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. -TypeTag.U8 = type("TypeTag.U8", (TypeTag.U8, TypeTag,), {}) # type: ignore -TypeTag.U16 = type("TypeTag.U16", (TypeTag.U16, TypeTag,), {}) # type: ignore -TypeTag.U32 = type("TypeTag.U32", (TypeTag.U32, TypeTag,), {}) # type: ignore -TypeTag.U64 = type("TypeTag.U64", (TypeTag.U64, TypeTag,), {}) # type: ignore -TypeTag.U128 = type("TypeTag.U128", (TypeTag.U128, TypeTag,), {}) # type: ignore -TypeTag.U256 = type("TypeTag.U256", (TypeTag.U256, TypeTag,), {}) # type: ignore -TypeTag.BOOL = type("TypeTag.BOOL", (TypeTag.BOOL, TypeTag,), {}) # type: ignore -TypeTag.ADDRESS = type("TypeTag.ADDRESS", (TypeTag.ADDRESS, TypeTag,), {}) # type: ignore -TypeTag.SIGNER = type("TypeTag.SIGNER", (TypeTag.SIGNER, TypeTag,), {}) # type: ignore -TypeTag.VECTOR = type("TypeTag.VECTOR", (TypeTag.VECTOR, TypeTag,), {}) # type: ignore -TypeTag.STRUCT = type("TypeTag.STRUCT", (TypeTag.STRUCT, TypeTag,), {}) # type: ignore - - - - -class _UniffiConverterTypeTypeTag(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return TypeTag.U8( - ) - if variant == 2: - return TypeTag.U16( - ) - if variant == 3: - return TypeTag.U32( - ) - if variant == 4: - return TypeTag.U64( - ) - if variant == 5: - return TypeTag.U128( - ) - if variant == 6: - return TypeTag.U256( - ) - if variant == 7: - return TypeTag.BOOL( - ) - if variant == 8: - return TypeTag.ADDRESS( - ) - if variant == 9: - return TypeTag.SIGNER( - ) - if variant == 10: - return TypeTag.VECTOR( - _UniffiConverterTypeBoxedTypeTag.read(buf), - ) - if variant == 11: - return TypeTag.STRUCT( - _UniffiConverterTypeBoxedStructTag.read(buf), - ) - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value.is_U8(): - return - if value.is_U16(): - return - if value.is_U32(): - return - if value.is_U64(): - return - if value.is_U128(): - return - if value.is_U256(): - return - if value.is_BOOL(): - return - if value.is_ADDRESS(): - return - if value.is_SIGNER(): - return - if value.is_VECTOR(): - _UniffiConverterTypeBoxedTypeTag.check_lower(value._values[0]) - return - if value.is_STRUCT(): - _UniffiConverterTypeBoxedStructTag.check_lower(value._values[0]) - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value.is_U8(): - buf.write_i32(1) - if value.is_U16(): - buf.write_i32(2) - if value.is_U32(): - buf.write_i32(3) - if value.is_U64(): - buf.write_i32(4) - if value.is_U128(): - buf.write_i32(5) - if value.is_U256(): - buf.write_i32(6) - if value.is_BOOL(): - buf.write_i32(7) - if value.is_ADDRESS(): - buf.write_i32(8) - if value.is_SIGNER(): - buf.write_i32(9) - if value.is_VECTOR(): - buf.write_i32(10) - _UniffiConverterTypeBoxedTypeTag.write(value._values[0], buf) - if value.is_STRUCT(): - buf.write_i32(11) - _UniffiConverterTypeBoxedStructTag.write(value._values[0], buf) - - - - - - - -class UnchangedSharedKind: - """ - Type of unchanged shared object - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - unchanged-shared-object-kind = read-only-root - =/ mutate-deleted - =/ read-deleted - =/ cancelled - =/ per-epoch-config - - read-only-root = %x00 u64 digest - mutate-deleted = %x01 u64 - read-deleted = %x02 u64 - cancelled = %x03 u64 - per-epoch-config = %x04 - ``` - """ - - def __init__(self): - raise RuntimeError("UnchangedSharedKind cannot be instantiated directly") - - # Each enum variant is a nested class of the enum itself. - class READ_ONLY_ROOT: - """ - Read-only shared objects from the input. We don't really need - ObjectDigest for protocol correctness, but it will make it easier to - verify untrusted read. - """ - - version: "int" - digest: "ObjectDigest" - - def __init__(self,version: "int", digest: "ObjectDigest"): - self.version = version - self.digest = digest - - def __str__(self): - return "UnchangedSharedKind.READ_ONLY_ROOT(version={}, digest={})".format(self.version, self.digest) - - def __eq__(self, other): - if not other.is_READ_ONLY_ROOT(): - return False - if self.version != other.version: - return False - if self.digest != other.digest: - return False - return True - - class MUTATE_DELETED: - """ - Deleted shared objects that appear mutably/owned in the input. - """ - - version: "int" - - def __init__(self,version: "int"): - self.version = version - - def __str__(self): - return "UnchangedSharedKind.MUTATE_DELETED(version={})".format(self.version) - - def __eq__(self, other): - if not other.is_MUTATE_DELETED(): - return False - if self.version != other.version: - return False - return True - - class READ_DELETED: - """ - Deleted shared objects that appear as read-only in the input. - """ - - version: "int" - - def __init__(self,version: "int"): - self.version = version - - def __str__(self): - return "UnchangedSharedKind.READ_DELETED(version={})".format(self.version) - - def __eq__(self, other): - if not other.is_READ_DELETED(): - return False - if self.version != other.version: - return False - return True - - class CANCELLED: - """ - Shared objects in cancelled transaction. The sequence number embed - cancellation reason. - """ - - version: "int" - - def __init__(self,version: "int"): - self.version = version - - def __str__(self): - return "UnchangedSharedKind.CANCELLED(version={})".format(self.version) - - def __eq__(self, other): - if not other.is_CANCELLED(): - return False - if self.version != other.version: - return False - return True - - class PER_EPOCH_CONFIG: - """ - Read of a per-epoch config object that should remain the same during an - epoch. - """ - - - def __init__(self,): - pass - - def __str__(self): - return "UnchangedSharedKind.PER_EPOCH_CONFIG()".format() - - def __eq__(self, other): - if not other.is_PER_EPOCH_CONFIG(): - return False - return True - - - - # For each variant, we have `is_NAME` and `is_name` methods for easily checking - # whether an instance is that variant. - def is_READ_ONLY_ROOT(self) -> bool: - return isinstance(self, UnchangedSharedKind.READ_ONLY_ROOT) - def is_read_only_root(self) -> bool: - return isinstance(self, UnchangedSharedKind.READ_ONLY_ROOT) - def is_MUTATE_DELETED(self) -> bool: - return isinstance(self, UnchangedSharedKind.MUTATE_DELETED) - def is_mutate_deleted(self) -> bool: - return isinstance(self, UnchangedSharedKind.MUTATE_DELETED) - def is_READ_DELETED(self) -> bool: - return isinstance(self, UnchangedSharedKind.READ_DELETED) - def is_read_deleted(self) -> bool: - return isinstance(self, UnchangedSharedKind.READ_DELETED) - def is_CANCELLED(self) -> bool: - return isinstance(self, UnchangedSharedKind.CANCELLED) - def is_cancelled(self) -> bool: - return isinstance(self, UnchangedSharedKind.CANCELLED) - def is_PER_EPOCH_CONFIG(self) -> bool: - return isinstance(self, UnchangedSharedKind.PER_EPOCH_CONFIG) - def is_per_epoch_config(self) -> bool: - return isinstance(self, UnchangedSharedKind.PER_EPOCH_CONFIG) - - -# 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. -UnchangedSharedKind.READ_ONLY_ROOT = type("UnchangedSharedKind.READ_ONLY_ROOT", (UnchangedSharedKind.READ_ONLY_ROOT, UnchangedSharedKind,), {}) # type: ignore -UnchangedSharedKind.MUTATE_DELETED = type("UnchangedSharedKind.MUTATE_DELETED", (UnchangedSharedKind.MUTATE_DELETED, UnchangedSharedKind,), {}) # type: ignore -UnchangedSharedKind.READ_DELETED = type("UnchangedSharedKind.READ_DELETED", (UnchangedSharedKind.READ_DELETED, UnchangedSharedKind,), {}) # type: ignore -UnchangedSharedKind.CANCELLED = type("UnchangedSharedKind.CANCELLED", (UnchangedSharedKind.CANCELLED, UnchangedSharedKind,), {}) # type: ignore -UnchangedSharedKind.PER_EPOCH_CONFIG = type("UnchangedSharedKind.PER_EPOCH_CONFIG", (UnchangedSharedKind.PER_EPOCH_CONFIG, UnchangedSharedKind,), {}) # type: ignore - - - - -class _UniffiConverterTypeUnchangedSharedKind(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return UnchangedSharedKind.READ_ONLY_ROOT( - _UniffiConverterUInt64.read(buf), - _UniffiConverterTypeObjectDigest.read(buf), - ) - if variant == 2: - return UnchangedSharedKind.MUTATE_DELETED( - _UniffiConverterUInt64.read(buf), - ) - if variant == 3: - return UnchangedSharedKind.READ_DELETED( - _UniffiConverterUInt64.read(buf), - ) - if variant == 4: - return UnchangedSharedKind.CANCELLED( - _UniffiConverterUInt64.read(buf), - ) - if variant == 5: - return UnchangedSharedKind.PER_EPOCH_CONFIG( - ) - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value.is_READ_ONLY_ROOT(): - _UniffiConverterUInt64.check_lower(value.version) - _UniffiConverterTypeObjectDigest.check_lower(value.digest) - return - if value.is_MUTATE_DELETED(): - _UniffiConverterUInt64.check_lower(value.version) - return - if value.is_READ_DELETED(): - _UniffiConverterUInt64.check_lower(value.version) - return - if value.is_CANCELLED(): - _UniffiConverterUInt64.check_lower(value.version) - return - if value.is_PER_EPOCH_CONFIG(): - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value.is_READ_ONLY_ROOT(): - buf.write_i32(1) - _UniffiConverterUInt64.write(value.version, buf) - _UniffiConverterTypeObjectDigest.write(value.digest, buf) - if value.is_MUTATE_DELETED(): - buf.write_i32(2) - _UniffiConverterUInt64.write(value.version, buf) - if value.is_READ_DELETED(): - buf.write_i32(3) - _UniffiConverterUInt64.write(value.version, buf) - if value.is_CANCELLED(): - buf.write_i32(4) - _UniffiConverterUInt64.write(value.version, buf) - if value.is_PER_EPOCH_CONFIG(): - buf.write_i32(5) - - - - - - - -class UniffiExecutionTimeObservations: - def __init__(self): - raise RuntimeError("UniffiExecutionTimeObservations cannot be instantiated directly") - - # Each enum variant is a nested class of the enum itself. - class V1: - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"UniffiExecutionTimeObservations.V1{self._values!r}" - - def __eq__(self, other): - if not other.is_V1(): - return False - return self._values == other._values - - - # For each variant, we have `is_NAME` and `is_name` methods for easily checking - # whether an instance is that variant. - def is_V1(self) -> bool: - return isinstance(self, UniffiExecutionTimeObservations.V1) - def is_v1(self) -> bool: - return isinstance(self, UniffiExecutionTimeObservations.V1) - - -# 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. -UniffiExecutionTimeObservations.V1 = type("UniffiExecutionTimeObservations.V1", (UniffiExecutionTimeObservations.V1, UniffiExecutionTimeObservations,), {}) # type: ignore - - - - -class _UniffiConverterTypeUniffiExecutionTimeObservations(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return UniffiExecutionTimeObservations.V1( - _UniffiConverterSequenceTypeUniffiExecutionTimeObservation.read(buf), - ) - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value.is_V1(): - _UniffiConverterSequenceTypeUniffiExecutionTimeObservation.check_lower(value._values[0]) - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value.is_V1(): - buf.write_i32(1) - _UniffiConverterSequenceTypeUniffiExecutionTimeObservation.write(value._values[0], buf) - - - - - - - -class UserSignature: - """ - A signature from a user - - A `UserSignature` is most commonly used to authorize the execution and - inclusion of a transaction to the blockchain. - - # BCS - - The BCS serialized form for this type is defined by the following ABNF: - - ```text - user-signature-bcs = bytes ; where the contents of the bytes are defined by - user-signature = simple-signature / multisig / multisig-legacy / zklogin / passkey - ``` - - Note: Due to historical reasons, signatures are serialized slightly - different from the majority of the types in IOTA. In particular if a - signature is ever embedded in another structure it generally is serialized - as `bytes` meaning it has a length prefix that defines the length of - the completely serialized signature. - """ - - def __init__(self): - raise RuntimeError("UserSignature cannot be instantiated directly") - - # Each enum variant is a nested class of the enum itself. - class SIMPLE: - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"UserSignature.SIMPLE{self._values!r}" - - def __eq__(self, other): - if not other.is_SIMPLE(): - return False - return self._values == other._values - class MULTISIG: - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"UserSignature.MULTISIG{self._values!r}" - - def __eq__(self, other): - if not other.is_MULTISIG(): - return False - return self._values == other._values - class ZK_LOGIN: - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"UserSignature.ZK_LOGIN{self._values!r}" - - def __eq__(self, other): - if not other.is_ZK_LOGIN(): - return False - return self._values == other._values - class PASSKEY: - def __init__(self, *values): - if len(values) != 1: - raise TypeError(f"Expected 1 arguments, found {len(values)}") - self._values = values - - def __getitem__(self, index): - return self._values[index] - - def __str__(self): - return f"UserSignature.PASSKEY{self._values!r}" - - def __eq__(self, other): - if not other.is_PASSKEY(): - return False - return self._values == other._values - - - # For each variant, we have `is_NAME` and `is_name` methods for easily checking - # whether an instance is that variant. - def is_SIMPLE(self) -> bool: - return isinstance(self, UserSignature.SIMPLE) - def is_simple(self) -> bool: - return isinstance(self, UserSignature.SIMPLE) - def is_MULTISIG(self) -> bool: - return isinstance(self, UserSignature.MULTISIG) - def is_multisig(self) -> bool: - return isinstance(self, UserSignature.MULTISIG) - def is_ZK_LOGIN(self) -> bool: - return isinstance(self, UserSignature.ZK_LOGIN) - def is_zk_login(self) -> bool: - return isinstance(self, UserSignature.ZK_LOGIN) - def is_PASSKEY(self) -> bool: - return isinstance(self, UserSignature.PASSKEY) - def is_passkey(self) -> bool: - return isinstance(self, UserSignature.PASSKEY) - - -# 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. -UserSignature.SIMPLE = type("UserSignature.SIMPLE", (UserSignature.SIMPLE, UserSignature,), {}) # type: ignore -UserSignature.MULTISIG = type("UserSignature.MULTISIG", (UserSignature.MULTISIG, UserSignature,), {}) # type: ignore -UserSignature.ZK_LOGIN = type("UserSignature.ZK_LOGIN", (UserSignature.ZK_LOGIN, UserSignature,), {}) # type: ignore -UserSignature.PASSKEY = type("UserSignature.PASSKEY", (UserSignature.PASSKEY, UserSignature,), {}) # type: ignore - - - - -class _UniffiConverterTypeUserSignature(_UniffiConverterRustBuffer): - @staticmethod - def read(buf): - variant = buf.read_i32() - if variant == 1: - return UserSignature.SIMPLE( - _UniffiConverterTypeSimpleSignature.read(buf), - ) - if variant == 2: - return UserSignature.MULTISIG( - _UniffiConverterTypeMultisigAggregatedSignature.read(buf), - ) - if variant == 3: - return UserSignature.ZK_LOGIN( - _UniffiConverterTypeBoxedZkLoginAuthenticator.read(buf), - ) - if variant == 4: - return UserSignature.PASSKEY( - _UniffiConverterTypePasskeyAuthenticator.read(buf), - ) - raise InternalError("Raw enum value doesn't match any cases") - - @staticmethod - def check_lower(value): - if value.is_SIMPLE(): - _UniffiConverterTypeSimpleSignature.check_lower(value._values[0]) - return - if value.is_MULTISIG(): - _UniffiConverterTypeMultisigAggregatedSignature.check_lower(value._values[0]) - return - if value.is_ZK_LOGIN(): - _UniffiConverterTypeBoxedZkLoginAuthenticator.check_lower(value._values[0]) - return - if value.is_PASSKEY(): - _UniffiConverterTypePasskeyAuthenticator.check_lower(value._values[0]) - return - raise ValueError(value) - - @staticmethod - def write(value, buf): - if value.is_SIMPLE(): - buf.write_i32(1) - _UniffiConverterTypeSimpleSignature.write(value._values[0], buf) - if value.is_MULTISIG(): - buf.write_i32(2) - _UniffiConverterTypeMultisigAggregatedSignature.write(value._values[0], buf) - if value.is_ZK_LOGIN(): - buf.write_i32(3) - _UniffiConverterTypeBoxedZkLoginAuthenticator.write(value._values[0], buf) - if value.is_PASSKEY(): - buf.write_i32(4) - _UniffiConverterTypePasskeyAuthenticator.write(value._values[0], buf) - - - - - -class _UniffiConverterOptionalUInt32(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterUInt32.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterUInt32.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterUInt32.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalUInt64(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterUInt64.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterUInt64.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterUInt64.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeEndOfEpochData(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeEndOfEpochData.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeEndOfEpochData.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeEndOfEpochData.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeMoveLocation(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeMoveLocation.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeMoveLocation.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeMoveLocation.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeTypeTag(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeTypeTag.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeTypeTag.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeTypeTag.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeCheckpointDigest(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeCheckpointDigest.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeCheckpointDigest.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeCheckpointDigest.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeEffectsAuxiliaryDataDigest(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeEffectsAuxiliaryDataDigest.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeEffectsAuxiliaryDataDigest.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeEffectsAuxiliaryDataDigest.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeIdentifier(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeIdentifier.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeIdentifier.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeIdentifier.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterOptionalTypeTransactionEventsDigest(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - if value is not None: - _UniffiConverterTypeTransactionEventsDigest.check_lower(value) - - @classmethod - def write(cls, value, buf): - if value is None: - buf.write_u8(0) - return - - buf.write_u8(1) - _UniffiConverterTypeTransactionEventsDigest.write(value, buf) - - @classmethod - def read(cls, buf): - flag = buf.read_u8() - if flag == 0: - return None - elif flag == 1: - return _UniffiConverterTypeTransactionEventsDigest.read(buf) - else: - raise InternalError("Unexpected flag byte for optional type") - - - -class _UniffiConverterSequenceBytes(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterBytes.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterBytes.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterBytes.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeActiveJwk(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeActiveJwk.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeActiveJwk.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeActiveJwk.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeCancelledTransaction(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeCancelledTransaction.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeCancelledTransaction.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeCancelledTransaction.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeChangedObject(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeChangedObject.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeChangedObject.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeChangedObject.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeEvent(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeEvent.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeEvent.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeEvent.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeGenesisObject(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeGenesisObject.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeGenesisObject.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeGenesisObject.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeMultisigMember(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeMultisigMember.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeMultisigMember.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeMultisigMember.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeObjectReference(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeObjectReference.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeObjectReference.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeObjectReference.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeSystemPackage(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeSystemPackage.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeSystemPackage.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeSystemPackage.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeTypeOrigin(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeTypeOrigin.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeTypeOrigin.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeTypeOrigin.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeUnchangedSharedObject(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeUnchangedSharedObject.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeUnchangedSharedObject.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeUnchangedSharedObject.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeUniffiExecutionTimeObservation(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeUniffiExecutionTimeObservation.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeUniffiExecutionTimeObservation.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeUniffiExecutionTimeObservation.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeValidatorCommitteeMember(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeValidatorCommitteeMember.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeValidatorCommitteeMember.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeValidatorCommitteeMember.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeValidatorExecutionTimeObservation(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeValidatorExecutionTimeObservation.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeValidatorExecutionTimeObservation.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeValidatorExecutionTimeObservation.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeVersionAssignment(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeVersionAssignment.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeVersionAssignment.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeVersionAssignment.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeArgument(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeArgument.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeArgument.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeArgument.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeCheckpointCommitment(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeCheckpointCommitment.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeCheckpointCommitment.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeCheckpointCommitment.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeCommand(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeCommand.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeCommand.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeCommand.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeEndOfEpochTransactionKind(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeEndOfEpochTransactionKind.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeEndOfEpochTransactionKind.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeEndOfEpochTransactionKind.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeInput(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeInput.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeInput.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeInput.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeMultisigMemberSignature(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeMultisigMemberSignature.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeMultisigMemberSignature.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeMultisigMemberSignature.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeTypeTag(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeTypeTag.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeTypeTag.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeTypeTag.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeUserSignature(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeUserSignature.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeUserSignature.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeUserSignature.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceSequenceTypeBn254FieldElement(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterSequenceTypeBn254FieldElement.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterSequenceTypeBn254FieldElement.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterSequenceTypeBn254FieldElement.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeBn254FieldElement(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeBn254FieldElement.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeBn254FieldElement.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeBn254FieldElement.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeObjectId(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeObjectId.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeObjectId.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeObjectId.read(buf) for i in range(count) - ] - - - -class _UniffiConverterSequenceTypeTransactionDigest(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, value): - for item in value: - _UniffiConverterTypeTransactionDigest.check_lower(item) - - @classmethod - def write(cls, value, buf): - items = len(value) - buf.write_i32(items) - for item in value: - _UniffiConverterTypeTransactionDigest.write(item, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative sequence length") - - return [ - _UniffiConverterTypeTransactionDigest.read(buf) for i in range(count) - ] - - - -class _UniffiConverterMapTypeIdentifierBytes(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, items): - for (key, value) in items.items(): - _UniffiConverterTypeIdentifier.check_lower(key) - _UniffiConverterBytes.check_lower(value) - - @classmethod - def write(cls, items, buf): - buf.write_i32(len(items)) - for (key, value) in items.items(): - _UniffiConverterTypeIdentifier.write(key, buf) - _UniffiConverterBytes.write(value, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative map size") - - # It would be nice to use a dict comprehension, - # but in Python 3.7 and before the evaluation order is not according to spec, - # so we we're reading the value before the key. - # This loop makes the order explicit: first reading the key, then the value. - d = {} - for i in range(count): - key = _UniffiConverterTypeIdentifier.read(buf) - val = _UniffiConverterBytes.read(buf) - d[key] = val - return d - - - -class _UniffiConverterMapTypeObjectIdTypeUpgradeInfo(_UniffiConverterRustBuffer): - @classmethod - def check_lower(cls, items): - for (key, value) in items.items(): - _UniffiConverterTypeObjectId.check_lower(key) - _UniffiConverterTypeUpgradeInfo.check_lower(value) - - @classmethod - def write(cls, items, buf): - buf.write_i32(len(items)) - for (key, value) in items.items(): - _UniffiConverterTypeObjectId.write(key, buf) - _UniffiConverterTypeUpgradeInfo.write(value, buf) - - @classmethod - def read(cls, buf): - count = buf.read_i32() - if count < 0: - raise InternalError("Unexpected negative map size") - - # It would be nice to use a dict comprehension, - # but in Python 3.7 and before the evaluation order is not according to spec, - # so we we're reading the value before the key. - # This loop makes the order explicit: first reading the key, then the value. - d = {} - for i in range(count): - key = _UniffiConverterTypeObjectId.read(buf) - val = _UniffiConverterTypeUpgradeInfo.read(buf) - d[key] = val - return d - - -class _UniffiConverterTypeAddress: - @staticmethod - def write(value, buf): - _UniffiConverterBytes.write(value, buf) - - @staticmethod - def read(buf): - return _UniffiConverterBytes.read(buf) - - @staticmethod - def lift(value): - return _UniffiConverterBytes.lift(value) - - @staticmethod - def check_lower(value): - return _UniffiConverterBytes.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterBytes.lower(value) - - -class _UniffiConverterTypeBls12381PublicKey: - @staticmethod - def write(value, buf): - _UniffiConverterBytes.write(value, buf) - - @staticmethod - def read(buf): - return _UniffiConverterBytes.read(buf) - - @staticmethod - def lift(value): - return _UniffiConverterBytes.lift(value) - - @staticmethod - def check_lower(value): - return _UniffiConverterBytes.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterBytes.lower(value) - - -class _UniffiConverterTypeBn254FieldElement: - @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 check_lower(value): - return _UniffiConverterString.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterString.lower(value) - - -class _UniffiConverterTypeBoxedStructTag: - @staticmethod - def write(value, buf): - _UniffiConverterTypeStructTag.write(value, buf) - - @staticmethod - def read(buf): - return _UniffiConverterTypeStructTag.read(buf) - - @staticmethod - def lift(value): - return _UniffiConverterTypeStructTag.lift(value) - - @staticmethod - def check_lower(value): - return _UniffiConverterTypeStructTag.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterTypeStructTag.lower(value) - - -class _UniffiConverterTypeBoxedTransactionEffectsV1: - @staticmethod - def write(value, buf): - _UniffiConverterTypeTransactionEffectsV1.write(value, buf) - - @staticmethod - def read(buf): - return _UniffiConverterTypeTransactionEffectsV1.read(buf) - - @staticmethod - def lift(value): - return _UniffiConverterTypeTransactionEffectsV1.lift(value) - - @staticmethod - def check_lower(value): - return _UniffiConverterTypeTransactionEffectsV1.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterTypeTransactionEffectsV1.lower(value) - - -class _UniffiConverterTypeBoxedTypeTag: - @staticmethod - def write(value, buf): - _UniffiConverterTypeTypeTag.write(value, buf) - - @staticmethod - def read(buf): - return _UniffiConverterTypeTypeTag.read(buf) - - @staticmethod - def lift(value): - return _UniffiConverterTypeTypeTag.lift(value) - - @staticmethod - def check_lower(value): - return _UniffiConverterTypeTypeTag.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterTypeTypeTag.lower(value) - - -class _UniffiConverterTypeBoxedZkLoginAuthenticator: - @staticmethod - def write(value, buf): - _UniffiConverterTypeZkLoginAuthenticator.write(value, buf) - - @staticmethod - def read(buf): - return _UniffiConverterTypeZkLoginAuthenticator.read(buf) - - @staticmethod - def lift(value): - return _UniffiConverterTypeZkLoginAuthenticator.lift(value) - - @staticmethod - def check_lower(value): - return _UniffiConverterTypeZkLoginAuthenticator.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterTypeZkLoginAuthenticator.lower(value) - - -class _UniffiConverterTypeCheckpointContentsDigest: - @staticmethod - def write(value, buf): - _UniffiConverterTypeDigest.write(value, buf) - - @staticmethod - def read(buf): - return _UniffiConverterTypeDigest.read(buf) - - @staticmethod - def lift(value): - return _UniffiConverterTypeDigest.lift(value) - - @staticmethod - def check_lower(value): - return _UniffiConverterTypeDigest.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterTypeDigest.lower(value) - - -class _UniffiConverterTypeCheckpointDigest: - @staticmethod - def write(value, buf): - _UniffiConverterTypeDigest.write(value, buf) - - @staticmethod - def read(buf): - return _UniffiConverterTypeDigest.read(buf) - - @staticmethod - def lift(value): - return _UniffiConverterTypeDigest.lift(value) - - @staticmethod - def check_lower(value): - return _UniffiConverterTypeDigest.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterTypeDigest.lower(value) - - -class _UniffiConverterTypeCircomG1: - @staticmethod - def write(value, buf): - _UniffiConverterSequenceTypeBn254FieldElement.write(value, buf) - - @staticmethod - def read(buf): - return _UniffiConverterSequenceTypeBn254FieldElement.read(buf) - - @staticmethod - def lift(value): - return _UniffiConverterSequenceTypeBn254FieldElement.lift(value) - - @staticmethod - def check_lower(value): - return _UniffiConverterSequenceTypeBn254FieldElement.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterSequenceTypeBn254FieldElement.lower(value) - - -class _UniffiConverterTypeCircomG2: - @staticmethod - def write(value, buf): - _UniffiConverterSequenceSequenceTypeBn254FieldElement.write(value, buf) - - @staticmethod - def read(buf): - return _UniffiConverterSequenceSequenceTypeBn254FieldElement.read(buf) - - @staticmethod - def lift(value): - return _UniffiConverterSequenceSequenceTypeBn254FieldElement.lift(value) - - @staticmethod - def check_lower(value): - return _UniffiConverterSequenceSequenceTypeBn254FieldElement.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterSequenceSequenceTypeBn254FieldElement.lower(value) - - -class _UniffiConverterTypeConsensusCommitDigest: - @staticmethod - def write(value, buf): - _UniffiConverterTypeDigest.write(value, buf) - - @staticmethod - def read(buf): - return _UniffiConverterTypeDigest.read(buf) - - @staticmethod - def lift(value): - return _UniffiConverterTypeDigest.lift(value) - - @staticmethod - def check_lower(value): - return _UniffiConverterTypeDigest.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterTypeDigest.lower(value) - - -class _UniffiConverterTypeDigest: - @staticmethod - def write(value, buf): - _UniffiConverterBytes.write(value, buf) - - @staticmethod - def read(buf): - return _UniffiConverterBytes.read(buf) - - @staticmethod - def lift(value): - return _UniffiConverterBytes.lift(value) - - @staticmethod - def check_lower(value): - return _UniffiConverterBytes.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterBytes.lower(value) - - -class _UniffiConverterTypeEd25519PublicKey: - @staticmethod - def write(value, buf): - _UniffiConverterBytes.write(value, buf) - - @staticmethod - def read(buf): - return _UniffiConverterBytes.read(buf) - - @staticmethod - def lift(value): - return _UniffiConverterBytes.lift(value) - - @staticmethod - def check_lower(value): - return _UniffiConverterBytes.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterBytes.lower(value) - - -class _UniffiConverterTypeEd25519Signature: - @staticmethod - def write(value, buf): - _UniffiConverterBytes.write(value, buf) - - @staticmethod - def read(buf): - return _UniffiConverterBytes.read(buf) - - @staticmethod - def lift(value): - return _UniffiConverterBytes.lift(value) - - @staticmethod - def check_lower(value): - return _UniffiConverterBytes.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterBytes.lower(value) - - -class _UniffiConverterTypeEffectsAuxiliaryDataDigest: - @staticmethod - def write(value, buf): - _UniffiConverterTypeDigest.write(value, buf) - - @staticmethod - def read(buf): - return _UniffiConverterTypeDigest.read(buf) - - @staticmethod - def lift(value): - return _UniffiConverterTypeDigest.lift(value) - - @staticmethod - def check_lower(value): - return _UniffiConverterTypeDigest.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterTypeDigest.lower(value) - - -class _UniffiConverterTypeExecutionTimeObservations: - @staticmethod - def write(value, buf): - _UniffiConverterTypeUniffiExecutionTimeObservations.write(value, buf) - - @staticmethod - def read(buf): - return _UniffiConverterTypeUniffiExecutionTimeObservations.read(buf) - - @staticmethod - def lift(value): - return _UniffiConverterTypeUniffiExecutionTimeObservations.lift(value) - - @staticmethod - def check_lower(value): - return _UniffiConverterTypeUniffiExecutionTimeObservations.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterTypeUniffiExecutionTimeObservations.lower(value) - - -class _UniffiConverterTypeIdentifier: - @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 check_lower(value): - return _UniffiConverterString.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterString.lower(value) - - -class _UniffiConverterTypeMovePackage: - @staticmethod - def write(value, buf): - _UniffiConverterTypeUniffiMovePackage.write(value, buf) - - @staticmethod - def read(buf): - return _UniffiConverterTypeUniffiMovePackage.read(buf) - - @staticmethod - def lift(value): - return _UniffiConverterTypeUniffiMovePackage.lift(value) - - @staticmethod - def check_lower(value): - return _UniffiConverterTypeUniffiMovePackage.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterTypeUniffiMovePackage.lower(value) - - -class _UniffiConverterTypeObjectDigest: - @staticmethod - def write(value, buf): - _UniffiConverterTypeDigest.write(value, buf) - - @staticmethod - def read(buf): - return _UniffiConverterTypeDigest.read(buf) - - @staticmethod - def lift(value): - return _UniffiConverterTypeDigest.lift(value) - - @staticmethod - def check_lower(value): - return _UniffiConverterTypeDigest.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterTypeDigest.lower(value) - - -class _UniffiConverterTypeObjectId: - @staticmethod - def write(value, buf): - _UniffiConverterTypeAddress.write(value, buf) - - @staticmethod - def read(buf): - return _UniffiConverterTypeAddress.read(buf) - - @staticmethod - def lift(value): - return _UniffiConverterTypeAddress.lift(value) - - @staticmethod - def check_lower(value): - return _UniffiConverterTypeAddress.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterTypeAddress.lower(value) - - -class _UniffiConverterTypeSecp256k1PublicKey: - @staticmethod - def write(value, buf): - _UniffiConverterBytes.write(value, buf) - - @staticmethod - def read(buf): - return _UniffiConverterBytes.read(buf) - - @staticmethod - def lift(value): - return _UniffiConverterBytes.lift(value) - - @staticmethod - def check_lower(value): - return _UniffiConverterBytes.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterBytes.lower(value) - - -class _UniffiConverterTypeSecp256k1Signature: - @staticmethod - def write(value, buf): - _UniffiConverterBytes.write(value, buf) - - @staticmethod - def read(buf): - return _UniffiConverterBytes.read(buf) - - @staticmethod - def lift(value): - return _UniffiConverterBytes.lift(value) - - @staticmethod - def check_lower(value): - return _UniffiConverterBytes.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterBytes.lower(value) - - -class _UniffiConverterTypeSecp256r1PublicKey: - @staticmethod - def write(value, buf): - _UniffiConverterBytes.write(value, buf) - - @staticmethod - def read(buf): - return _UniffiConverterBytes.read(buf) - - @staticmethod - def lift(value): - return _UniffiConverterBytes.lift(value) - - @staticmethod - def check_lower(value): - return _UniffiConverterBytes.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterBytes.lower(value) - - -class _UniffiConverterTypeSecp256r1Signature: - @staticmethod - def write(value, buf): - _UniffiConverterBytes.write(value, buf) - - @staticmethod - def read(buf): - return _UniffiConverterBytes.read(buf) - - @staticmethod - def lift(value): - return _UniffiConverterBytes.lift(value) - - @staticmethod - def check_lower(value): - return _UniffiConverterBytes.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterBytes.lower(value) - - -class _UniffiConverterTypeTransactionDigest: - @staticmethod - def write(value, buf): - _UniffiConverterTypeDigest.write(value, buf) - - @staticmethod - def read(buf): - return _UniffiConverterTypeDigest.read(buf) - - @staticmethod - def lift(value): - return _UniffiConverterTypeDigest.lift(value) - - @staticmethod - def check_lower(value): - return _UniffiConverterTypeDigest.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterTypeDigest.lower(value) - - -class _UniffiConverterTypeTransactionEffectsDigest: - @staticmethod - def write(value, buf): - _UniffiConverterTypeDigest.write(value, buf) - - @staticmethod - def read(buf): - return _UniffiConverterTypeDigest.read(buf) - - @staticmethod - def lift(value): - return _UniffiConverterTypeDigest.lift(value) - - @staticmethod - def check_lower(value): - return _UniffiConverterTypeDigest.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterTypeDigest.lower(value) - - -class _UniffiConverterTypeTransactionEventsDigest: - @staticmethod - def write(value, buf): - _UniffiConverterTypeDigest.write(value, buf) - - @staticmethod - def read(buf): - return _UniffiConverterTypeDigest.read(buf) - - @staticmethod - def lift(value): - return _UniffiConverterTypeDigest.lift(value) - - @staticmethod - def check_lower(value): - return _UniffiConverterTypeDigest.check_lower(value) - - @staticmethod - def lower(value): - return _UniffiConverterTypeDigest.lower(value) - -# objects. -Address = bytes -Bls12381PublicKey = bytes -Bn254FieldElement = str -BoxedStructTag = StructTag -BoxedTransactionEffectsV1 = TransactionEffectsV1 -BoxedTypeTag = TypeTag -BoxedZkLoginAuthenticator = ZkLoginAuthenticator -Digest = bytes -CheckpointContentsDigest = Digest -CheckpointDigest = Digest -CircomG1 = typing.List[Bn254FieldElement] -CircomG2 = typing.List[typing.List[Bn254FieldElement]] -ConsensusCommitDigest = Digest -Ed25519PublicKey = bytes -Ed25519Signature = bytes -EffectsAuxiliaryDataDigest = Digest -ExecutionTimeObservations = UniffiExecutionTimeObservations -Identifier = str -MovePackage = UniffiMovePackage -ObjectDigest = Digest -ObjectId = Address -Secp256k1PublicKey = bytes -Secp256k1Signature = bytes -Secp256r1PublicKey = bytes -Secp256r1Signature = bytes -TransactionDigest = Digest -TransactionEffectsDigest = Digest -TransactionEventsDigest = Digest - -# Async support - -__all__ = [ - "InternalError", - "Argument", - "CheckpointCommitment", - "Command", - "CommandArgumentError", - "ConsensusDeterminedVersionAssignments", - "EndOfEpochTransactionKind", - "ExecutionError", - "ExecutionStatus", - "ExecutionTimeObservationKey", - "IdOperation", - "Input", - "MultisigMemberPublicKey", - "MultisigMemberSignature", - "ObjectData", - "ObjectIn", - "ObjectOut", - "Owner", - "PackageUpgradeError", - "SimpleSignature", - "TransactionEffects", - "TransactionExpiration", - "TransactionKind", - "TypeArgumentError", - "TypeTag", - "UnchangedSharedKind", - "UniffiExecutionTimeObservations", - "UserSignature", - "ActiveJwk", - "AuthenticatorStateExpire", - "AuthenticatorStateUpdateV1", - "CancelledTransaction", - "ChangeEpoch", - "ChangeEpochV2", - "ChangedObject", - "CheckpointSummary", - "Coin", - "ConsensusCommitPrologueV1", - "EndOfEpochData", - "Event", - "GasCostSummary", - "GasPayment", - "GenesisObject", - "GenesisTransaction", - "Jwk", - "JwkId", - "MakeMoveVector", - "MergeCoins", - "MoveCall", - "MoveLocation", - "MoveStruct", - "MultisigAggregatedSignature", - "MultisigCommittee", - "MultisigMember", - "Object", - "ObjectReference", - "PasskeyAuthenticator", - "ProgrammableTransaction", - "Publish", - "RandomnessStateUpdate", - "SignedTransaction", - "SplitCoins", - "StructTag", - "SystemPackage", - "Transaction", - "TransactionEffectsV1", - "TransferObjects", - "TypeOrigin", - "UnchangedSharedObject", - "UniffiExecutionTimeObservation", - "UniffiMovePackage", - "Upgrade", - "UpgradeInfo", - "ValidatorCommitteeMember", - "ValidatorExecutionTimeObservation", - "VersionAssignment", - "ZkLoginAuthenticator", - "ZkLoginClaim", - "ZkLoginInputs", - "ZkLoginProof", - "ZkLoginPublicIdentifier", -] - diff --git a/bindings/python/test.py b/bindings/python/test.py index 5bb1a3742..18d1aca58 100644 --- a/bindings/python/test.py +++ b/bindings/python/test.py @@ -1,18 +1,28 @@ -from lib.iota_graphql_client import Client, Address, PaginationFilter, Direction +from lib.iota_sdk_ffi import GraphQlClient, PaginationFilter, Address, Direction, TransactionsFilter, ObjectId, EventFilter import asyncio async def main(): - client = Client.new_devnet() + client = GraphQlClient.new_devnet() chain_id = await client.chain_id() print(chain_id) + + my_address=Address.from_hex("0xb14f13f5343641e5b52d144fd6f106a7058efe2f1ad44598df5cda73acf0101f") coins = await client.coins( - Address.fromhex("da06e01d11c8d3ef8f8e238c2f144076fdc6832378fb48b153d57027ae868b39"), - None, + my_address, PaginationFilter(direction=Direction.FORWARD, cursor=None, limit=None) ) - for coin in coins.data: - print(f'ID = 0x{coin.id.hex()} Balance = {coin.balance}') + for coin in coins.data(): + print(f'ID = 0x{coin.id().to_hex()} Balance = {coin.balance()}') + + balance = await client.balance(my_address) + + print(f'Total Balance = {balance}') + + filter=TransactionsFilter(at_checkpoint=3, input_object=ObjectId.from_hex("0xb14f13f5343641e5b52d144fd6f106a7058efe2f1ad44598df5cda73acf0101f")) + + filter=EventFilter(sender=my_address) + if __name__ == '__main__': asyncio.run(main()) diff --git a/crates/iota-graphql-client/Cargo.toml b/crates/iota-graphql-client/Cargo.toml index 320822ab9..a39c95aee 100644 --- a/crates/iota-graphql-client/Cargo.toml +++ b/crates/iota-graphql-client/Cargo.toml @@ -8,14 +8,6 @@ readme = "README.md" repository = "https://github.com/iotaledger/iota-rust-sdk/" description = "GraphQL RPC Client for the IOTA Blockchain" -[lib] -name = "iota_graphql_client" -crate-type = ["lib", "cdylib"] - -[[bin]] -name = "iota_graphql_client_bindings" -path = "uniffi-bindgen.rs" - [dependencies] anyhow = "1.0.71" async-stream = "0.3.3" @@ -32,7 +24,6 @@ serde = { version = "1.0.144" } serde_json = { version = "1.0.95" } tokio = { version = "1.36.0", features = ["time"] } tracing = "0.1.37" -uniffi = { version = "0.29", features = ["cli", "tokio"], optional = true } url = "2.5.3" [dev-dependencies] @@ -42,7 +33,3 @@ tokio = { version = "1.40.0", features = ["full"] } [build-dependencies] iota-graphql-client-build = { version = "0.0.1", path = "../iota-graphql-client-build" } - -[features] -default = [] -uniffi = ["dep:uniffi", "iota-types/uniffi"] diff --git a/crates/iota-graphql-client/src/error.rs b/crates/iota-graphql-client/src/error.rs index e34a69ed0..57c7094e0 100644 --- a/crates/iota-graphql-client/src/error.rs +++ b/crates/iota-graphql-client/src/error.rs @@ -14,7 +14,6 @@ pub type Result = std::result::Result; /// General error type for the client. It is used to wrap all the possible /// errors that can occur. #[derive(Debug)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Object))] pub struct Error { inner: Box, } @@ -33,7 +32,6 @@ struct InnerError { } #[derive(Debug, Copy, Clone)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] #[non_exhaustive] pub enum Kind { Deserialization, @@ -48,14 +46,6 @@ impl std::error::Error for Error { } } -#[cfg_attr(feature = "uniffi", uniffi::export)] -impl Error { - /// Returns the kind of error. - pub fn kind(&self) -> Kind { - self.inner.kind - } -} - impl Error { /// Original GraphQL query errors. pub fn graphql_errors(&self) -> Option<&[GraphQlError]> { diff --git a/crates/iota-graphql-client/src/faucet.rs b/crates/iota-graphql-client/src/faucet.rs index 648dc1c4e..67726220c 100644 --- a/crates/iota-graphql-client/src/faucet.rs +++ b/crates/iota-graphql-client/src/faucet.rs @@ -55,11 +55,6 @@ pub struct FaucetReceipt { pub sent: Vec, } -#[derive(Serialize, Deserialize, Debug, Clone)] -struct BatchFaucetReceipt { - pub task: String, -} - #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct CoinInfo { @@ -84,38 +79,29 @@ impl FaucetClient { /// Set to local faucet. pub fn local() -> Self { - Self { - faucet_url: Url::parse(FAUCET_LOCAL_HOST).expect("Invalid faucet URL"), - inner: reqwest::Client::new(), - } + Self::new(FAUCET_LOCAL_HOST) } /// Set to devnet faucet. pub fn devnet() -> Self { - Self { - faucet_url: Url::parse(FAUCET_DEVNET_HOST).expect("Invalid faucet URL"), - inner: reqwest::Client::new(), - } + Self::new(FAUCET_DEVNET_HOST) } /// Set to testnet faucet. pub fn testnet() -> Self { - Self { - faucet_url: Url::parse(FAUCET_TESTNET_HOST).expect("Invalid faucet URL"), - inner: reqwest::Client::new(), - } + Self::new(FAUCET_TESTNET_HOST) } /// Request gas from the faucet. Note that this will return the UUID of the /// request and not wait until the token is received. Use /// `request_and_wait` to wait for the token. - pub async fn request(&self, address: Address) -> Result, anyhow::Error> { + pub async fn request(&self, address: Address) -> anyhow::Result> { self.request_impl(address).await } /// Internal implementation of a faucet request. It returns the task Uuid as /// a String. - async fn request_impl(&self, address: Address) -> Result, anyhow::Error> { + async fn request_impl(&self, address: Address) -> anyhow::Result> { let address = address.to_string(); let json_body = json![{ "FixedAmountRequest": { @@ -175,7 +161,7 @@ impl FaucetClient { pub async fn request_and_wait( &self, address: Address, - ) -> Result, anyhow::Error> { + ) -> anyhow::Result> { let request_id = self.request(address).await?; if let Some(request_id) = request_id { let poll_response = tokio::time::timeout(FAUCET_REQUEST_TIMEOUT, async { @@ -227,10 +213,7 @@ impl FaucetClient { /// Check the faucet request status. /// /// Possible statuses are defined in: [`BatchSendStatusType`] - pub async fn request_status( - &self, - id: String, - ) -> Result, anyhow::Error> { + pub async fn request_status(&self, id: String) -> anyhow::Result> { let status_url = format!("{}v1/status/{}", self.faucet_url, id); info!("Checking status of faucet request: {status_url}"); let response = self.inner.get(&status_url).send().await?; diff --git a/crates/iota-graphql-client/src/lib.rs b/crates/iota-graphql-client/src/lib.rs index e96d34142..0cd2987b5 100644 --- a/crates/iota-graphql-client/src/lib.rs +++ b/crates/iota-graphql-client/src/lib.rs @@ -6,10 +6,9 @@ pub mod error; pub mod faucet; +pub mod pagination; pub mod query_types; pub mod streams; -#[cfg(feature = "uniffi")] -mod uniffi_helpers; use std::str::FromStr; @@ -19,7 +18,7 @@ use error::Error; use futures::Stream; use iota_types::{ Address, CheckpointContentsDigest, CheckpointSequenceNumber, CheckpointSummary, Event, - Identifier, MovePackage, Object, SignedTransaction, Transaction, TransactionDigest, + Identifier, MovePackage, Object, ObjectId, SignedTransaction, Transaction, TransactionDigest, TransactionEffects, TransactionKind, TypeTag, UserSignature, framework::Coin, }; use query_types::{ @@ -33,8 +32,8 @@ use query_types::{ NormalizedMoveFunctionQuery, NormalizedMoveFunctionQueryArgs, NormalizedMoveModuleQuery, NormalizedMoveModuleQueryArgs, ObjectFilter, ObjectQuery, ObjectQueryArgs, ObjectsQuery, ObjectsQueryArgs, PackageArgs, PackageCheckpointFilter, PackageQuery, PackageVersionsArgs, - PackageVersionsQuery, PackagesQuery, PackagesQueryArgs, PageInfo, ProtocolConfigQuery, - ProtocolConfigs, ProtocolVersionArgs, ServiceConfig, ServiceConfigQuery, TransactionBlockArgs, + PackageVersionsQuery, PackagesQuery, PackagesQueryArgs, ProtocolConfigQuery, ProtocolConfigs, + ProtocolVersionArgs, ServiceConfig, ServiceConfigQuery, TransactionBlockArgs, TransactionBlockEffectsQuery, TransactionBlockQuery, TransactionBlocksEffectsQuery, TransactionBlocksQuery, TransactionBlocksQueryArgs, TransactionMetadata, TransactionsFilter, Validator, @@ -45,14 +44,12 @@ use streams::stream_paginated_query; use crate::{ error::{Kind, Result}, + pagination::{Direction, Page, PaginationFilter, PaginationFilterResponse}, query_types::{ CheckpointTotalTxQuery, TransactionBlockWithEffectsQuery, TransactionBlocksWithEffectsQuery, }, }; -#[cfg(feature = "uniffi")] -uniffi::setup_scaffolding!(); - const DEFAULT_ITEMS_PER_PAGE: i32 = 10; const MAINNET_HOST: &str = "https://graphql.mainnet.iota.cafe"; const TESTNET_HOST: &str = "https://graphql.testnet.iota.cafe"; @@ -66,13 +63,13 @@ static USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_V /// The result of a dry run, which includes the effects of the transaction and /// any errors that may have occurred. -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct DryRunResult { pub effects: Option, pub error: Option, } -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] +#[derive(Clone, Debug)] pub struct TransactionDataEffects { pub tx: SignedTransaction, pub effects: TransactionEffects, @@ -81,7 +78,6 @@ pub struct TransactionDataEffects { /// The name part of a dynamic field, including its type, bcs, and json /// representation. #[derive(Clone, Debug)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct DynamicFieldName { /// The type name of this dynamic field name pub type_: TypeTag, @@ -93,7 +89,6 @@ pub struct DynamicFieldName { /// The value part of a dynamic field. #[derive(Clone, Debug)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct DynamicFieldValue { pub type_: TypeTag, pub bcs: Vec, @@ -102,7 +97,6 @@ pub struct DynamicFieldValue { /// The output of a dynamic field query, that includes the name, value, and /// value's json representation. #[derive(Clone, Debug)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct DynamicFieldOutput { /// The name of the dynamic field pub name: DynamicFieldName, @@ -116,85 +110,10 @@ pub struct DynamicFieldOutput { /// for the dynamic fields API. pub struct NameValue(Vec); -#[cfg(feature = "uniffi")] -uniffi::custom_type!(NameValue, Vec, { - lower: |kv| kv.0, -}); - /// Helper struct for passing a raw bcs value. #[derive(derive_more::From)] pub struct BcsName(pub Vec); -#[cfg(feature = "uniffi")] -uniffi::custom_type!(BcsName, Vec, { - lower: |kv| kv.0, -}); - -#[derive(Clone, Debug)] -/// A page of items returned by the GraphQL server. -pub struct Page { - /// Information about the page, such as the cursor and whether there are - /// more pages. - page_info: PageInfo, - /// The data returned by the server. - data: Vec, -} - -impl Page { - /// Return the page information. - pub fn page_info(&self) -> &PageInfo { - &self.page_info - } - - /// Return the data in the page. - pub fn data(&self) -> &[T] { - &self.data - } - - /// Create a new page with the provided data and page information. - pub fn new(page_info: PageInfo, data: Vec) -> Self { - Self { page_info, data } - } - - /// Check if the page has no data. - pub fn is_empty(&self) -> bool { - self.data.is_empty() - } - - /// Create a page with no data. - pub fn new_empty() -> Self { - Self::new(PageInfo::default(), vec![]) - } - - /// Return a tuple of page info and the data. - pub fn into_parts(self) -> (PageInfo, Vec) { - (self.page_info, self.data) - } -} - -/// Pagination direction. -#[derive(Clone, Debug, Default)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] -pub enum Direction { - #[default] - Forward, - Backward, -} - -/// Pagination options for querying the GraphQL server. It defaults to forward -/// pagination with the GraphQL server's max page size. -#[derive(Clone, Debug, Default)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct PaginationFilter { - /// The direction of pagination. - pub direction: Direction, - /// An opaque cursor used for pagination. - pub cursor: Option, - /// The maximum number of items to return. If this is ommitted, it will - /// lazily query the service configuration for the max page size. - pub limit: Option, -} - impl From for NameValue { fn from(value: T) -> Self { NameValue(bcs::to_bytes(&value).unwrap()) @@ -207,15 +126,6 @@ impl From for NameValue { } } -#[derive(Clone, Debug, Default)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] -pub struct PaginationFilterResponse { - after: Option, - before: Option, - first: Option, - last: Option, -} - impl DynamicFieldOutput { /// Deserialize the name of the dynamic field into the specified type. pub fn deserialize_name(&self, expected_type: &TypeTag) -> Result { @@ -248,7 +158,6 @@ impl DynamicFieldOutput { /// The GraphQL client for interacting with the IOTA blockchain. /// By default, it uses the `reqwest` crate as the HTTP client. -#[cfg_attr(feature = "uniffi", derive(uniffi::Object))] pub struct Client { /// The URL of the GraphQL server. rpc: Url, @@ -507,7 +416,7 @@ impl Client { &self, address: Address, coin_type: Option, - ) -> Result> { + ) -> Result> { let operation = BalanceQuery::build(BalanceArgs { address, coin_type: coin_type.map(|x| x.to_string()), @@ -523,20 +432,16 @@ impl Client { .map(|b| b.owner.and_then(|o| o.balance.map(|b| b.total_balance))) .ok_or_else(Error::empty_response_error)? .flatten() - .map(|x| x.0.parse::()) + .map(|x| x.0.parse::()) .transpose()?; Ok(total_balance) } -} -#[cfg_attr(feature = "uniffi", uniffi::export(async_runtime = "tokio"))] -impl Client { // =========================================================================== // Client Misc API // =========================================================================== /// Create a new GraphQL client with the provided server address. - #[cfg_attr(feature = "uniffi", uniffi::constructor)] pub fn new(server: &str) -> Result { let rpc = reqwest::Url::parse(server)?; @@ -550,28 +455,24 @@ impl Client { /// Create a new GraphQL client connected to the `mainnet` GraphQL server: /// {MAINNET_HOST}. - #[cfg_attr(feature = "uniffi", uniffi::constructor)] pub fn new_mainnet() -> Self { Self::new(MAINNET_HOST).expect("Invalid mainnet URL") } /// Create a new GraphQL client connected to the `testnet` GraphQL server: /// {TESTNET_HOST}. - #[cfg_attr(feature = "uniffi", uniffi::constructor)] pub fn new_testnet() -> Self { Self::new(TESTNET_HOST).expect("Invalid testnet URL") } /// Create a new GraphQL client connected to the `devnet` GraphQL server: /// {DEVNET_HOST}. - #[cfg_attr(feature = "uniffi", uniffi::constructor)] pub fn new_devnet() -> Self { Self::new(DEVNET_HOST).expect("Invalid devnet URL") } /// Create a new GraphQL client connected to the `localhost` GraphQL server: /// {DEFAULT_LOCAL_HOST}. - #[cfg_attr(feature = "uniffi", uniffi::constructor)] pub fn new_localhost() -> Self { Self::new(LOCAL_HOST).expect("Invalid localhost URL") } @@ -1014,8 +915,12 @@ impl Client { /// If the object does not exist (e.g., due to pruning), this will return /// `Ok(None)`. Similarly, if this is not an object but an address, it /// will return `Ok(None)`. - pub async fn object(&self, address: Address, version: Option) -> Result> { - let operation = ObjectQuery::build(ObjectQueryArgs { address, version }); + pub async fn object( + &self, + object_id: ObjectId, + version: Option, + ) -> Result> { + let operation = ObjectQuery::build(ObjectQueryArgs { object_id, version }); let response = self.run_query(&operation).await?; @@ -1105,9 +1010,9 @@ impl Client { /// Return the object's bcs content [`Vec`] based on the provided /// [`Address`]. - pub async fn object_bcs(&self, object_id: Address) -> Result>> { + pub async fn object_bcs(&self, object_id: ObjectId) -> Result>> { let operation = ObjectQuery::build(ObjectQueryArgs { - address: object_id, + object_id, version: None, }); @@ -1134,10 +1039,10 @@ impl Client { /// will return `Ok(None)`. pub async fn move_object_contents_bcs( &self, - address: Address, + object_id: ObjectId, version: Option, ) -> Result>> { - let operation = ObjectQuery::build(ObjectQueryArgs { address, version }); + let operation = ObjectQuery::build(ObjectQueryArgs { object_id, version }); let response = self.run_query(&operation).await?; @@ -1193,7 +1098,7 @@ impl Client { .transpose()? .map(|bcs| bcs::from_bytes::(&bcs)) .transpose()? - .map(|obj| obj.data.as_package())) + .map(|obj| obj.data.into_package())) } /// Fetch all versions of package at address (packages that share this @@ -1244,7 +1149,7 @@ impl Client { .collect::, base64ct::Error>>()?; let packages = bcs .iter() - .map(|b| Ok(bcs::from_bytes::(b)?.data.as_package())) + .map(|b| Ok(bcs::from_bytes::(b)?.data.into_package())) .collect::, bcs::Error>>()?; Ok(Page::new(page_info, packages)) @@ -1276,7 +1181,7 @@ impl Client { .transpose()? .map(|bcs| bcs::from_bytes::(&bcs)) .transpose()? - .map(|obj| obj.data.as_package()); + .map(|obj| obj.data.into_package()); Ok(pkg) } @@ -1332,7 +1237,7 @@ impl Client { .collect::, base64ct::Error>>()?; let packages = bcs .iter() - .map(|b| Ok(bcs::from_bytes::(b)?.data.as_package())) + .map(|b| Ok(bcs::from_bytes::(b)?.data.into_package())) .collect::, bcs::Error>>()?; Ok(Page::new(page_info, packages)) @@ -1575,7 +1480,7 @@ impl Client { /// Execute a transaction. pub async fn execute_tx( &self, - signatures: Vec, + signatures: &[UserSignature], tx: &Transaction, ) -> Result> { let operation = ExecuteTransactionQuery::build(ExecuteTransactionArgs { @@ -1638,10 +1543,10 @@ impl Client { /// will return `Ok(None)`. pub async fn move_object_contents( &self, - address: Address, + object_id: ObjectId, version: Option, ) -> Result> { - let operation = ObjectQuery::build(ObjectQueryArgs { address, version }); + let operation = ObjectQuery::build(ObjectQueryArgs { object_id, version }); let response = self.run_query(&operation).await?; @@ -1737,9 +1642,9 @@ impl Client { &self, address: Address, type_: TypeTag, - name: NameValue, + name: impl Into, ) -> Result> { - let bcs = name.0; + let bcs = name.into().0; let operation = DynamicFieldQuery::build(DynamicFieldArgs { address, name: crate::query_types::DynamicFieldName { @@ -1777,9 +1682,9 @@ impl Client { &self, address: Address, type_: TypeTag, - name: NameValue, + name: impl Into, ) -> Result> { - let bcs = name.0; + let bcs = name.into().0; let operation = DynamicObjectFieldQuery::build(DynamicFieldArgs { address, name: crate::query_types::DynamicFieldName { @@ -2345,7 +2250,7 @@ mod tests { let client = test_client(); let bcs = base64ct::Base64::decode_vec("AgAAAAAAAAA=").unwrap(); client - .dynamic_field("0x5".parse().unwrap(), TypeTag::U64, BcsName(bcs).into()) + .dynamic_field("0x5".parse().unwrap(), TypeTag::U64, BcsName(bcs)) .await .map_err(|e| { format!( @@ -2356,7 +2261,7 @@ mod tests { .unwrap(); client - .dynamic_field("0x5".parse().unwrap(), TypeTag::U64, 2u64.into()) + .dynamic_field("0x5".parse().unwrap(), TypeTag::U64, 2u64) .await .map_err(|e| { format!( diff --git a/crates/iota-graphql-client/src/pagination.rs b/crates/iota-graphql-client/src/pagination.rs new file mode 100644 index 000000000..fd92e7df2 --- /dev/null +++ b/crates/iota-graphql-client/src/pagination.rs @@ -0,0 +1,82 @@ +// Copyright (c) 2025 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +use crate::query_types::PageInfo; + +/// A page of items returned by the GraphQL server. +#[derive(Clone, Debug)] +pub struct Page { + /// Information about the page, such as the cursor and whether there are + /// more pages. + pub page_info: PageInfo, + /// The data returned by the server. + pub data: Vec, +} + +impl Page { + /// Return the page information. + pub fn page_info(&self) -> &PageInfo { + &self.page_info + } + + /// Return the data in the page. + pub fn data(&self) -> &[T] { + &self.data + } + + /// Create a new page with the provided data and page information. + pub fn new(page_info: PageInfo, data: Vec) -> Self { + Self { page_info, data } + } + + /// Check if the page has no data. + pub fn is_empty(&self) -> bool { + self.data.is_empty() + } + + /// Create a page with no data. + pub fn new_empty() -> Self { + Self::new(PageInfo::default(), vec![]) + } + + /// Return a tuple of page info and the data. + pub fn into_parts(self) -> (PageInfo, Vec) { + (self.page_info, self.data) + } + + pub fn map U, U>(self, map_fn: F) -> Page { + Page { + page_info: self.page_info, + data: self.data.into_iter().map(map_fn).collect(), + } + } +} + +/// Pagination direction. +#[derive(Clone, Debug, Default)] +pub enum Direction { + #[default] + Forward, + Backward, +} + +/// Pagination options for querying the GraphQL server. It defaults to forward +/// pagination with the GraphQL server's max page size. +#[derive(Clone, Debug, Default)] +pub struct PaginationFilter { + /// The direction of pagination. + pub direction: Direction, + /// An opaque cursor used for pagination. + pub cursor: Option, + /// The maximum number of items to return. If this is ommitted, it will + /// lazily query the service configuration for the max page size. + pub limit: Option, +} + +#[derive(Clone, Debug, Default)] +pub struct PaginationFilterResponse { + pub after: Option, + pub before: Option, + pub first: Option, + pub last: Option, +} diff --git a/crates/iota-graphql-client/src/query_types/active_validators.rs b/crates/iota-graphql-client/src/query_types/active_validators.rs index d93d12385..5a9ada771 100644 --- a/crates/iota-graphql-client/src/query_types/active_validators.rs +++ b/crates/iota-graphql-client/src/query_types/active_validators.rs @@ -2,7 +2,7 @@ // Modifications Copyright (c) 2025 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -use crate::query_types::{Address, Base64, BigInt, GQLAddress, MoveObject, PageInfo, schema}; +use crate::query_types::{Base64, BigInt, GQLAddress, MoveObject, ObjectId, PageInfo, schema}; #[derive(cynic::QueryFragment, Debug)] #[cynic( @@ -53,8 +53,7 @@ pub struct ValidatorConnection { } /// Represents a validator in the system. -#[derive(cynic::QueryFragment, Debug)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] +#[derive(cynic::QueryFragment, Debug, Clone)] #[cynic(schema = "rpc", graphql_type = "Validator")] pub struct Validator { /// The APY of this validator in basis points. @@ -107,7 +106,7 @@ pub struct Validator { /// The epoch at which this pool became active. pub staking_pool_activation_epoch: Option, /// The ID of this validator's `0x3::staking_pool::StakingPool`. - pub staking_pool_id: Address, + pub staking_pool_id: ObjectId, /// The total number of IOTA tokens in this pool. pub staking_pool_iota_balance: Option, /// The voting power of this validator in basis points (e.g., 100 = 1% @@ -116,8 +115,7 @@ pub struct Validator { } /// The credentials related fields associated with a validator. -#[derive(cynic::QueryFragment, Debug)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] +#[derive(cynic::QueryFragment, Debug, Clone)] #[cynic(schema = "rpc", graphql_type = "ValidatorCredentials")] pub struct ValidatorCredentials { pub authority_pub_key: Option, diff --git a/crates/iota-graphql-client/src/query_types/coin.rs b/crates/iota-graphql-client/src/query_types/coin.rs index 251beb26f..701fcd7e7 100644 --- a/crates/iota-graphql-client/src/query_types/coin.rs +++ b/crates/iota-graphql-client/src/query_types/coin.rs @@ -29,8 +29,7 @@ pub struct CoinMetadataArgs<'a> { use crate::query_types::{BigInt, schema}; /// The coin metadata associated with the given coin type. -#[derive(cynic::QueryFragment, Debug)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] +#[derive(Clone, cynic::QueryFragment, Debug)] #[cynic(schema = "rpc", graphql_type = "CoinMetadata")] pub struct CoinMetadata { /// The number of decimal places used to represent the token. diff --git a/crates/iota-graphql-client/src/query_types/dry_run.rs b/crates/iota-graphql-client/src/query_types/dry_run.rs index c24bbb67d..3d4705664 100644 --- a/crates/iota-graphql-client/src/query_types/dry_run.rs +++ b/crates/iota-graphql-client/src/query_types/dry_run.rs @@ -5,7 +5,7 @@ use iota_types::ObjectReference; use super::transaction::TxBlockEffects; -use crate::query_types::{Address, schema}; +use crate::query_types::{Address, ObjectId, schema}; #[derive(cynic::QueryFragment, Debug)] #[cynic(schema = "rpc", graphql_type = "Query", variables = "DryRunArgs")] @@ -28,7 +28,7 @@ pub struct DryRunArgs { pub tx_meta: Option, } -#[derive(cynic::InputObject, Debug)] +#[derive(Clone, cynic::InputObject, Debug, Default)] #[cynic(schema = "rpc", graphql_type = "TransactionMetadata")] pub struct TransactionMetadata { pub gas_budget: Option, @@ -38,19 +38,18 @@ pub struct TransactionMetadata { pub sender: Option
, } -#[derive(cynic::InputObject, Debug)] +#[derive(Clone, cynic::InputObject, Debug)] #[cynic(schema = "rpc", graphql_type = "ObjectRef")] pub struct ObjectRef { - pub address: Address, + pub address: ObjectId, pub digest: String, pub version: u64, } impl From for ObjectRef { fn from(value: ObjectReference) -> Self { - let address: Address = (*value.object_id()).into(); ObjectRef { - address, + address: *value.object_id(), version: value.version(), digest: value.digest().to_string(), } diff --git a/crates/iota-graphql-client/src/query_types/epoch.rs b/crates/iota-graphql-client/src/query_types/epoch.rs index d954194b4..7a474015a 100644 --- a/crates/iota-graphql-client/src/query_types/epoch.rs +++ b/crates/iota-graphql-client/src/query_types/epoch.rs @@ -2,7 +2,7 @@ // Modifications Copyright (c) 2025 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -use crate::query_types::{Address, BigInt, DateTime, ProtocolConfigs, schema}; +use crate::query_types::{BigInt, DateTime, ObjectId, ProtocolConfigs, schema}; // =========================================================================== // Epoch Queries @@ -49,7 +49,6 @@ pub struct EpochSummary { // =========================================================================== #[derive(cynic::QueryFragment, Debug, Clone)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] #[cynic(schema = "rpc", graphql_type = "Epoch")] pub struct Epoch { /// The epoch's id as a sequence number that starts at 0 and is incremented @@ -101,16 +100,15 @@ pub struct Epoch { } #[derive(cynic::QueryFragment, Debug, Clone)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] #[cynic(schema = "rpc", graphql_type = "ValidatorSet")] pub struct ValidatorSet { /// Object ID of the `Table` storing the inactive staking pools. - pub inactive_pools_id: Option
, + pub inactive_pools_id: Option, /// Size of the inactive pools `Table`. pub inactive_pools_size: Option, /// Object ID of the wrapped object `TableVec` storing the pending active /// validators. - pub pending_active_validators_id: Option
, + pub pending_active_validators_id: Option, /// Size of the pending active validators table. pub pending_active_validators_size: Option, /// Validators that are pending removal from the active validator set, @@ -120,7 +118,7 @@ pub struct ValidatorSet { /// the addresses of the corresponding validators. This is needed /// because a validator's address can potentially change but the object /// ID of its pool will not. - pub staking_pool_mappings_id: Option
, + pub staking_pool_mappings_id: Option, /// Size of the stake pool mappings `Table`. pub staking_pool_mappings_size: Option, /// Total amount of stake for all active validators at the beginning of the @@ -129,5 +127,5 @@ pub struct ValidatorSet { /// Size of the validator candidates `Table`. pub validator_candidates_size: Option, /// Object ID of the `Table` storing the validator candidates. - pub validator_candidates_id: Option
, + pub validator_candidates_id: Option, } diff --git a/crates/iota-graphql-client/src/query_types/events.rs b/crates/iota-graphql-client/src/query_types/events.rs index 0d14a3cbd..a3a8bdc41 100644 --- a/crates/iota-graphql-client/src/query_types/events.rs +++ b/crates/iota-graphql-client/src/query_types/events.rs @@ -42,7 +42,6 @@ pub struct EventConnection { } #[derive(Clone, cynic::InputObject, Debug)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] #[cynic(schema = "rpc", graphql_type = "EventFilter")] pub struct EventFilter { pub emitting_module: Option, diff --git a/crates/iota-graphql-client/src/query_types/mod.rs b/crates/iota-graphql-client/src/query_types/mod.rs index f6732058c..f1c17d1d8 100644 --- a/crates/iota-graphql-client/src/query_types/mod.rs +++ b/crates/iota-graphql-client/src/query_types/mod.rs @@ -31,7 +31,7 @@ pub use checkpoint::{ }; pub use coin::{CoinMetadata, CoinMetadataArgs, CoinMetadataQuery}; use cynic::impl_scalar; -pub use dry_run::{DryRunArgs, DryRunQuery, DryRunResult, TransactionMetadata}; +pub use dry_run::{DryRunArgs, DryRunQuery, DryRunResult, ObjectRef, TransactionMetadata}; pub use dynamic_fields::{ DynamicFieldArgs, DynamicFieldConnectionArgs, DynamicFieldName, DynamicFieldQuery, DynamicFieldsOwnerQuery, DynamicObjectFieldQuery, @@ -39,7 +39,7 @@ pub use dynamic_fields::{ pub use epoch::{Epoch, EpochArgs, EpochQuery, EpochSummaryQuery}; pub use events::{Event, EventConnection, EventFilter, EventsQuery, EventsQueryArgs}; pub use execute_tx::{ExecuteTransactionArgs, ExecuteTransactionQuery, ExecutionResult}; -use iota_types::Address; +use iota_types::{Address, ObjectId}; pub use normalized_move::{ MoveAbility, MoveFunction, MoveFunctionTypeParameter, MoveModule, MoveVisibility, NormalizedMoveFunctionQuery, NormalizedMoveFunctionQueryArgs, NormalizedMoveModuleQuery, @@ -57,10 +57,10 @@ pub use protocol_config::{ProtocolConfigQuery, ProtocolConfigs, ProtocolVersionA use serde_json::Value as JsonValue; pub use service_config::{Feature, ServiceConfig, ServiceConfigQuery}; pub use transaction::{ - TransactionBlock, TransactionBlockArgs, TransactionBlockEffectsQuery, TransactionBlockQuery, - TransactionBlockWithEffects, TransactionBlockWithEffectsQuery, TransactionBlocksEffectsQuery, - TransactionBlocksQuery, TransactionBlocksQueryArgs, TransactionBlocksWithEffectsQuery, - TransactionsFilter, + TransactionBlock, TransactionBlockArgs, TransactionBlockEffectsQuery, + TransactionBlockKindInput, TransactionBlockQuery, TransactionBlockWithEffects, + TransactionBlockWithEffectsQuery, TransactionBlocksEffectsQuery, TransactionBlocksQuery, + TransactionBlocksQueryArgs, TransactionBlocksWithEffectsQuery, TransactionsFilter, }; use crate::error; @@ -73,6 +73,7 @@ pub mod schema {} // =========================================================================== impl_scalar!(Address, schema::IotaAddress); +impl_scalar!(ObjectId, schema::IotaAddress); impl_scalar!(u64, schema::UInt53); impl_scalar!(JsonValue, schema::JSON); @@ -80,43 +81,25 @@ impl_scalar!(JsonValue, schema::JSON); #[cynic(graphql_type = "Base64")] pub struct Base64(pub String); -#[cfg(feature = "uniffi")] -uniffi::custom_type!(Base64, String, { - lower: |i| i.0, -}); - #[derive(cynic::Scalar, Debug, Clone, derive_more::From)] #[cynic(graphql_type = "BigInt")] pub struct BigInt(pub String); -#[cfg(feature = "uniffi")] -uniffi::custom_type!(BigInt, String, { - lower: |i| i.0, -}); - #[derive(cynic::Scalar, Debug, Clone)] #[cynic(graphql_type = "DateTime")] pub struct DateTime(pub String); -#[cfg(feature = "uniffi")] -uniffi::custom_type!(DateTime, String, { - lower: |kv| kv.0, - try_lift: |s| Ok(DateTime(s)), -}); - // =========================================================================== // Types used in several queries // =========================================================================== -#[derive(cynic::QueryFragment, Debug)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] +#[derive(cynic::QueryFragment, Debug, Clone, Copy)] #[cynic(schema = "rpc", graphql_type = "Address")] pub struct GQLAddress { pub address: Address, } -#[derive(cynic::QueryFragment, Debug)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] +#[derive(cynic::QueryFragment, Debug, Clone)] #[cynic(schema = "rpc", graphql_type = "MoveObject")] pub struct MoveObject { pub bcs: Option, @@ -146,7 +129,6 @@ pub struct MoveType { // =========================================================================== #[derive(Clone, Default, cynic::QueryFragment, Debug)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] #[cynic(schema = "rpc", graphql_type = "PageInfo")] /// Information about pagination in a connection. pub struct PageInfo { diff --git a/crates/iota-graphql-client/src/query_types/normalized_move/mod.rs b/crates/iota-graphql-client/src/query_types/normalized_move/mod.rs index b900bfde7..b72800fac 100644 --- a/crates/iota-graphql-client/src/query_types/normalized_move/mod.rs +++ b/crates/iota-graphql-client/src/query_types/normalized_move/mod.rs @@ -14,7 +14,6 @@ use crate::query_types::schema; #[derive(cynic::Enum, Clone, Copy, Debug)] #[cynic(schema = "rpc", graphql_type = "MoveAbility")] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] pub enum MoveAbility { Copy, Drop, @@ -24,7 +23,6 @@ pub enum MoveAbility { #[derive(cynic::Enum, Clone, Copy, Debug)] #[cynic(schema = "rpc", graphql_type = "MoveVisibility")] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] pub enum MoveVisibility { Public, Private, @@ -33,7 +31,6 @@ pub enum MoveVisibility { #[derive(cynic::QueryFragment, Debug)] #[cynic(schema = "rpc", graphql_type = "MoveFunction")] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct MoveFunction { pub is_entry: Option, pub name: String, @@ -46,14 +43,12 @@ pub struct MoveFunction { #[derive(cynic::QueryFragment, Debug)] #[cynic(schema = "rpc", graphql_type = "MoveFunctionTypeParameter")] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct MoveFunctionTypeParameter { pub constraints: Vec, } #[derive(cynic::QueryFragment, Debug)] #[cynic(schema = "rpc", graphql_type = "OpenMoveType")] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct OpenMoveType { pub repr: String, } diff --git a/crates/iota-graphql-client/src/query_types/normalized_move/module.rs b/crates/iota-graphql-client/src/query_types/normalized_move/module.rs index 5351adfab..12adc51f5 100644 --- a/crates/iota-graphql-client/src/query_types/normalized_move/module.rs +++ b/crates/iota-graphql-client/src/query_types/normalized_move/module.rs @@ -57,7 +57,6 @@ pub struct MovePackage { graphql_type = "MoveModule", variables = "NormalizedMoveModuleQueryArgs" )] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct MoveModule { pub file_format_version: i32, #[arguments(after: $after_enums, before:$before_enums, first: $first_enums, last: $last_enums)] @@ -72,7 +71,6 @@ pub struct MoveModule { #[derive(cynic::QueryFragment, Debug)] #[cynic(schema = "rpc", graphql_type = "MoveStructConnection")] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct MoveStructConnection { pub page_info: PageInfo, pub nodes: Vec, @@ -80,7 +78,6 @@ pub struct MoveStructConnection { #[derive(cynic::QueryFragment, Debug)] #[cynic(schema = "rpc", graphql_type = "MoveStruct")] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct MoveStruct { pub abilities: Option>, pub name: String, @@ -90,7 +87,6 @@ pub struct MoveStruct { #[derive(cynic::QueryFragment, Debug)] #[cynic(schema = "rpc", graphql_type = "MoveModuleConnection")] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct MoveModuleConnection { pub nodes: Vec, pub page_info: PageInfo, @@ -98,7 +94,6 @@ pub struct MoveModuleConnection { #[derive(cynic::QueryFragment, Debug)] #[cynic(schema = "rpc", graphql_type = "MoveModule")] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct MoveModuleQuery { pub package: MovePackageQuery, pub name: String, @@ -106,7 +101,6 @@ pub struct MoveModuleQuery { #[derive(cynic::QueryFragment, Debug)] #[cynic(schema = "rpc", graphql_type = "MoveFunctionConnection")] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct MoveFunctionConnection { pub nodes: Vec, pub page_info: PageInfo, @@ -114,7 +108,6 @@ pub struct MoveFunctionConnection { #[derive(cynic::QueryFragment, Debug)] #[cynic(schema = "rpc", graphql_type = "MoveEnumConnection")] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct MoveEnumConnection { pub nodes: Vec, pub page_info: PageInfo, @@ -122,7 +115,6 @@ pub struct MoveEnumConnection { #[derive(cynic::QueryFragment, Debug)] #[cynic(schema = "rpc", graphql_type = "MoveEnum")] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct MoveEnum { pub abilities: Option>, pub name: String, @@ -132,7 +124,6 @@ pub struct MoveEnum { #[derive(cynic::QueryFragment, Debug)] #[cynic(schema = "rpc", graphql_type = "MoveEnumVariant")] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct MoveEnumVariant { pub fields: Option>, pub name: String, @@ -140,7 +131,6 @@ pub struct MoveEnumVariant { #[derive(cynic::QueryFragment, Debug)] #[cynic(schema = "rpc", graphql_type = "MoveField")] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct MoveField { pub name: String, #[cynic(rename = "type")] @@ -149,7 +139,6 @@ pub struct MoveField { #[derive(cynic::QueryFragment, Debug)] #[cynic(schema = "rpc", graphql_type = "MoveStructTypeParameter")] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct MoveStructTypeParameter { pub constraints: Vec, pub is_phantom: bool, diff --git a/crates/iota-graphql-client/src/query_types/object.rs b/crates/iota-graphql-client/src/query_types/object.rs index d9be03895..5428b048e 100644 --- a/crates/iota-graphql-client/src/query_types/object.rs +++ b/crates/iota-graphql-client/src/query_types/object.rs @@ -2,7 +2,7 @@ // Modifications Copyright (c) 2025 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -use crate::query_types::{Address, Base64, MoveObjectContents, PageInfo, schema}; +use crate::query_types::{Address, Base64, MoveObjectContents, ObjectId, PageInfo, schema}; // =========================================================================== // Object(s) Queries @@ -11,7 +11,7 @@ use crate::query_types::{Address, Base64, MoveObjectContents, PageInfo, schema}; #[derive(cynic::QueryFragment, Debug)] #[cynic(schema = "rpc", graphql_type = "Query", variables = "ObjectQueryArgs")] pub struct ObjectQuery { - #[arguments(address: $address, version: $version)] + #[arguments(address: $object_id, version: $version)] pub object: Option, } @@ -28,7 +28,7 @@ pub struct ObjectsQuery { #[derive(cynic::QueryVariables, Debug)] pub struct ObjectQueryArgs { - pub address: Address, + pub object_id: ObjectId, pub version: Option, } @@ -54,18 +54,17 @@ pub struct Object { #[derive(Clone, Default, cynic::InputObject, Debug)] #[cynic(schema = "rpc", graphql_type = "ObjectFilter")] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct ObjectFilter { #[cynic(rename = "type")] pub type_: Option, pub owner: Option
, - pub object_ids: Option>, + pub object_ids: Option>, } #[derive(Clone, cynic::InputObject, Debug)] #[cynic(schema = "rpc", graphql_type = "ObjectKey")] pub struct ObjectKey { - pub object_id: Address, + pub object_id: ObjectId, pub version: u64, } diff --git a/crates/iota-graphql-client/src/query_types/packages.rs b/crates/iota-graphql-client/src/query_types/packages.rs index a2d9c1929..92145c367 100644 --- a/crates/iota-graphql-client/src/query_types/packages.rs +++ b/crates/iota-graphql-client/src/query_types/packages.rs @@ -35,7 +35,6 @@ pub struct PackageArgs { } #[derive(cynic::QueryFragment, Debug)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] #[cynic(schema = "rpc", graphql_type = "MovePackage")] pub struct MovePackageQuery { pub address: Address, diff --git a/crates/iota-graphql-client/src/query_types/protocol_config.rs b/crates/iota-graphql-client/src/query_types/protocol_config.rs index f989927a0..cd47f6750 100644 --- a/crates/iota-graphql-client/src/query_types/protocol_config.rs +++ b/crates/iota-graphql-client/src/query_types/protocol_config.rs @@ -37,7 +37,6 @@ pub struct ProtocolVersionArgs { /// These can only change during protocol upgrades which happen on epoch /// boundaries. #[derive(cynic::QueryFragment, Clone, Debug)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] #[cynic(schema = "rpc", graphql_type = "ProtocolConfigs")] pub struct ProtocolConfigs { /// The protocol is not required to change on every epoch boundary, so the @@ -59,7 +58,6 @@ pub struct ProtocolConfigs { /// gate features while they are in development. Once a lag has been enabled, it /// is rare for it to be disabled. #[derive(cynic::QueryFragment, Clone, Debug)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] #[cynic(schema = "rpc", graphql_type = "ProtocolConfigFeatureFlag")] pub struct ProtocolConfigFeatureFlag { pub key: String, @@ -68,7 +66,6 @@ pub struct ProtocolConfigFeatureFlag { /// A key-value protocol configuration attribute. #[derive(cynic::QueryFragment, Clone, Debug)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] #[cynic(schema = "rpc", graphql_type = "ProtocolConfigAttr")] pub struct ProtocolConfigAttr { pub key: String, diff --git a/crates/iota-graphql-client/src/query_types/service_config.rs b/crates/iota-graphql-client/src/query_types/service_config.rs index 68fb2416c..7a0b0ea22 100644 --- a/crates/iota-graphql-client/src/query_types/service_config.rs +++ b/crates/iota-graphql-client/src/query_types/service_config.rs @@ -19,8 +19,7 @@ pub struct ServiceConfigQuery { // =========================================================================== // Information about the configuration of the GraphQL service. -#[derive(cynic::QueryFragment, Debug)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] +#[derive(cynic::QueryFragment, Debug, Clone)] #[cynic(schema = "rpc", graphql_type = "ServiceConfig")] pub struct ServiceConfig { /// Default number of elements allowed on a single page of a connection. @@ -76,7 +75,6 @@ pub struct ServiceConfig { } #[derive(cynic::Enum, Clone, Copy, Debug)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] #[cynic( schema = "rpc", graphql_type = "Feature", diff --git a/crates/iota-graphql-client/src/query_types/transaction.rs b/crates/iota-graphql-client/src/query_types/transaction.rs index 59f72cd4a..10b8f0317 100644 --- a/crates/iota-graphql-client/src/query_types/transaction.rs +++ b/crates/iota-graphql-client/src/query_types/transaction.rs @@ -3,7 +3,9 @@ // SPDX-License-Identifier: Apache-2.0 use base64ct::Encoding; -use iota_types::{SenderSignedTransaction, SignedTransaction, TransactionEffects, UserSignature}; +use iota_types::{ + ObjectId, SenderSignedTransaction, SignedTransaction, TransactionEffects, UserSignature, +}; use crate::{ error, @@ -136,7 +138,6 @@ pub struct TransactionBlockEffects { graphql_type = "TransactionBlockKindInput", rename_all = "SCREAMING_SNAKE_CASE" )] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] pub enum TransactionBlockKindInput { SystemTx, ProgrammableTx, @@ -147,9 +148,8 @@ pub enum TransactionBlockKindInput { EndOfEpochTx, } -#[derive(Clone, cynic::InputObject, Debug)] +#[derive(Clone, cynic::InputObject, Debug, Default)] #[cynic(schema = "rpc", graphql_type = "TransactionBlockFilter")] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct TransactionsFilter { pub function: Option, pub kind: Option, @@ -158,9 +158,9 @@ pub struct TransactionsFilter { pub before_checkpoint: Option, pub sign_address: Option
, pub recv_address: Option
, - pub input_object: Option
, - pub changed_object: Option
, - pub wrapped_or_deleted_object: Option
, + pub input_object: Option, + pub changed_object: Option, + pub wrapped_or_deleted_object: Option, pub transaction_ids: Option>, } diff --git a/crates/iota-graphql-client/src/streams.rs b/crates/iota-graphql-client/src/streams.rs index ea09e2892..16f106cfc 100644 --- a/crates/iota-graphql-client/src/streams.rs +++ b/crates/iota-graphql-client/src/streams.rs @@ -10,7 +10,11 @@ use std::{ use futures::Stream; -use crate::{Direction, Page, PaginationFilter, error, query_types::PageInfo}; +use crate::{ + error, + pagination::{Direction, Page, PaginationFilter}, + query_types::PageInfo, +}; /// A stream that yields items from a paginated query with support for /// bidirectional pagination. diff --git a/crates/iota-graphql-client/src/uniffi_helpers.rs b/crates/iota-graphql-client/src/uniffi_helpers.rs deleted file mode 100644 index c5d83b368..000000000 --- a/crates/iota-graphql-client/src/uniffi_helpers.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2025 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -use iota_types::{ - CheckpointSummary, Event, MovePackage, Object, SignedTransaction, TransactionEffects, - framework::Coin, -}; - -use crate::{ - DynamicFieldOutput, Page, TransactionDataEffects, - query_types::{Epoch, PageInfo, Validator}, -}; - -macro_rules! define_paged { - ($id:ident, $typ:ty) => { - pub type $id = Page<$typ>; - - #[uniffi::remote(Record)] - pub struct $id { - page_info: PageInfo, - data: Vec<$typ>, - } - }; -} - -define_paged!(MovePackagePage, MovePackage); -define_paged!(ValidatorPage, Validator); -define_paged!(CoinPage, Coin); -define_paged!(CheckpointSummaryPage, CheckpointSummary); -define_paged!(EpochPage, Epoch); -define_paged!(EventPage, Event); -define_paged!(ObjectPage, Object); -define_paged!(SignedTransactionPage, SignedTransaction); -define_paged!(TransactionEffectsPage, TransactionEffects); -define_paged!(TransactionDataEffectsPage, TransactionDataEffects); -define_paged!(DynamicFieldOutputPage, DynamicFieldOutput); - -use serde_json::Value as SerdeJsonValue; - -uniffi::custom_type!(SerdeJsonValue, String, { - remote, - lower: |val| val.to_string(), - try_lift: |s| Ok(serde_json::from_str(&s)?), -}); diff --git a/crates/iota-graphql-client/uniffi-bindgen.rs b/crates/iota-graphql-client/uniffi-bindgen.rs deleted file mode 100644 index bd6939d6b..000000000 --- a/crates/iota-graphql-client/uniffi-bindgen.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) 2025 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -fn main() { - #[cfg(feature = "uniffi")] - { - uniffi::uniffi_bindgen_main() - } - #[cfg(not(feature = "uniffi"))] - { - println!("enable the `uniffi` feature to generate bindings"); - } -} diff --git a/crates/iota-sdk-ffi/Cargo.toml b/crates/iota-sdk-ffi/Cargo.toml new file mode 100644 index 000000000..49bda4680 --- /dev/null +++ b/crates/iota-sdk-ffi/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "iota-sdk-ffi" +version = "0.0.1" +edition = "2024" + +[[bin]] +name = "iota_sdk_bindings" +path = "uniffi_bindgen.rs" + +[lib] +name = "iota_sdk_ffi" +crate-type = ["lib", "cdylib"] + +[dependencies] +derive_more = { version = "2.0", features = ["from", "deref"] } +rand = "0.8" +serde_json = "1.0.95" +tokio = { version = "1.36.0", features = ["time"] } +uniffi = { version = "0.29", features = ["cli", "tokio"] } + +iota-graphql-client = { version = "0.0.1", path = "../iota-graphql-client" } +iota-types = { package = "iota-sdk-types", version = "0.0.1", path = "../iota-sdk-types", features = ["hash", "rand"] } diff --git a/crates/iota-sdk-ffi/README.md b/crates/iota-sdk-ffi/README.md new file mode 100644 index 000000000..acd716cca --- /dev/null +++ b/crates/iota-sdk-ffi/README.md @@ -0,0 +1,21 @@ +# IOTA SDK FFI + +This crate can generate bindings for various languages (Go, Kotlin, Python, etc.) using [UniFFI](https://github.com/mozilla/uniffi-rs). + +Start by building the library to generate the appropriate dylib files. + +```sh +cargo build -p iota-sdk-ffi --lib --release +``` + +Next, run the binary to generate the bindings for the desired language. + +```sh +cargo run --bin iota_sdk_bindings -- generate --library "target/release/libiota_sdk_ffi.dylib" --language python --out-dir bindings/python/lib --no-format +``` + +Finally, copy the dylib file to the output directory. + +```sh +cp target/release/libiota_sdk_ffi.dylib bindings/python/lib/ +``` diff --git a/crates/iota-sdk-ffi/src/error.rs b/crates/iota-sdk-ffi/src/error.rs new file mode 100644 index 000000000..dcc34d55b --- /dev/null +++ b/crates/iota-sdk-ffi/src/error.rs @@ -0,0 +1,38 @@ +// Copyright (c) 2025 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +use std::fmt; + +use uniffi::Error; + +pub type Result = std::result::Result; + +#[derive(Debug, Error)] +#[uniffi(flat_error)] +pub enum SdkFfiError { + Generic(String), +} + +impl SdkFfiError { + pub fn new(err: E) -> Self { + Self::Generic(err.to_string()) + } + + pub fn custom(s: impl ToString) -> Self { + Self::Generic(s.to_string()) + } +} + +impl fmt::Display for SdkFfiError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::Generic(e) => write!(f, "{e}"), + } + } +} + +impl From for SdkFfiError { + fn from(e: E) -> SdkFfiError { + Self::new(e) + } +} diff --git a/crates/iota-sdk-ffi/src/faucet.rs b/crates/iota-sdk-ffi/src/faucet.rs new file mode 100644 index 000000000..cab469927 --- /dev/null +++ b/crates/iota-sdk-ffi/src/faucet.rs @@ -0,0 +1,88 @@ +// Copyright (c) 2025 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +use std::sync::Arc; + +use crate::{ + error::{Result, SdkFfiError}, + types::address::Address, +}; + +#[derive(uniffi::Object)] +pub struct FaucetClient(iota_graphql_client::faucet::FaucetClient); + +#[uniffi::export(async_runtime = "tokio")] +impl FaucetClient { + /// Construct a new `FaucetClient` with the given faucet service URL. This + /// [`FaucetClient`] expects that the service provides two endpoints: + /// /v1/gas and /v1/status. As such, do not provide the request + /// endpoint, just the top level service endpoint. + /// + /// - /v1/gas is used to request gas + /// - /v1/status/taks-uuid is used to check the status of the request + #[uniffi::constructor] + pub fn new(faucet_url: String) -> Self { + Self(iota_graphql_client::faucet::FaucetClient::new(&faucet_url)) + } + + /// Set to local faucet. + #[uniffi::constructor] + pub fn local() -> Self { + Self(iota_graphql_client::faucet::FaucetClient::local()) + } + + /// Set to devnet faucet. + #[uniffi::constructor] + pub fn devnet() -> Self { + Self(iota_graphql_client::faucet::FaucetClient::devnet()) + } + + /// Set to testnet faucet. + #[uniffi::constructor] + pub fn testnet() -> Self { + Self(iota_graphql_client::faucet::FaucetClient::testnet()) + } + + /// Request gas from the faucet. Note that this will return the UUID of the + /// request and not wait until the token is received. Use + /// `request_and_wait` to wait for the token. + pub async fn request(&self, address: &Address) -> Result> { + self.0.request(**address).await.map_err(SdkFfiError::custom) + } + + /// Request gas from the faucet and wait until the request is completed and + /// token is transferred. Returns `FaucetReceipt` if the request is + /// successful, which contains the list of tokens transferred, and the + /// transaction digest. + /// + /// Note that the faucet is heavily rate-limited, so calling repeatedly the + /// faucet would likely result in a 429 code or 502 code. + pub async fn request_and_wait(&self, address: &Address) -> Result>> { + Ok(self + .0 + .request_and_wait(**address) + .await + .map_err(SdkFfiError::custom)? + .map(Into::into) + .map(Arc::new)) + } + + /// Check the faucet request status. + /// + /// Possible statuses are defined in: [`BatchSendStatusType`] + pub async fn request_status(&self, id: String) -> Result>> { + Ok(self + .0 + .request_status(id) + .await + .map_err(SdkFfiError::custom)? + .map(Into::into) + .map(Arc::new)) + } +} + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct FaucetReceipt(pub iota_graphql_client::faucet::FaucetReceipt); + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct BatchSendStatus(pub iota_graphql_client::faucet::BatchSendStatus); diff --git a/crates/iota-sdk-ffi/src/graphql.rs b/crates/iota-sdk-ffi/src/graphql.rs new file mode 100644 index 000000000..8a23eaaa6 --- /dev/null +++ b/crates/iota-sdk-ffi/src/graphql.rs @@ -0,0 +1,861 @@ +// Copyright (c) 2025 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +use std::sync::Arc; + +use iota_types::CheckpointSequenceNumber; +use tokio::sync::RwLock; + +use crate::{ + error::Result, + types::{ + address::Address, + checkpoint::CheckpointSummary, + digest::{CheckpointContentsDigest, CheckpointDigest, TransactionDigest}, + graphql::{ + CoinMetadata, DryRunResult, DynamicFieldOutput, Epoch, EventFilter, MoveFunction, + MoveModule, ObjectFilter, PaginationFilter, ProtocolConfigs, ServiceConfig, + TransactionDataEffects, TransactionMetadata, TransactionsFilter, + }, + object::{MovePackage, Object, ObjectId}, + signature::UserSignature, + transaction::{SignedTransaction, Transaction, TransactionEffects, TransactionKind}, + type_tag::TypeTag, + }, + uniffi_helpers::{ + CheckpointSummaryPage, CoinPage, DynamicFieldOutputPage, EpochPage, EventPage, + MovePackagePage, ObjectPage, SignedTransactionPage, TransactionDataEffectsPage, + TransactionEffectsPage, ValidatorPage, + }, +}; + +#[derive(uniffi::Object)] +pub struct GraphQLClient(RwLock); + +#[uniffi::export(async_runtime = "tokio")] +impl GraphQLClient { + // =========================================================================== + // Client Misc API + // =========================================================================== + + /// Create a new GraphQL client with the provided server address. + #[uniffi::constructor] + pub fn new(server: String) -> Result { + Ok(Self(RwLock::new(iota_graphql_client::Client::new( + &server, + )?))) + } + + /// Create a new GraphQL client connected to the `mainnet` GraphQL server: + /// {MAINNET_HOST}. + #[uniffi::constructor] + pub fn new_mainnet() -> Self { + Self(RwLock::new(iota_graphql_client::Client::new_mainnet())) + } + + /// Create a new GraphQL client connected to the `testnet` GraphQL server: + /// {TESTNET_HOST}. + #[uniffi::constructor] + pub fn new_testnet() -> Self { + Self(RwLock::new(iota_graphql_client::Client::new_testnet())) + } + + /// Create a new GraphQL client connected to the `devnet` GraphQL server: + /// {DEVNET_HOST}. + #[uniffi::constructor] + pub fn new_devnet() -> Self { + Self(RwLock::new(iota_graphql_client::Client::new_devnet())) + } + + /// Create a new GraphQL client connected to the `localhost` GraphQL server: + /// {DEFAULT_LOCAL_HOST}. + #[uniffi::constructor] + pub fn new_localhost() -> Self { + Self(RwLock::new(iota_graphql_client::Client::new_localhost())) + } + + /// Get the chain identifier. + pub async fn chain_id(&self) -> Result { + Ok(self.0.read().await.chain_id().await?) + } + + /// Lazily fetch the max page size + pub async fn max_page_size(&self) -> Result { + Ok(self.0.read().await.max_page_size().await?) + } + + // =========================================================================== + // Network info API + // =========================================================================== + + /// Get the reference gas price for the provided epoch or the last known one + /// if no epoch is provided. + /// + /// This will return `Ok(None)` if the epoch requested is not available in + /// the GraphQL service (e.g., due to pruning). + #[uniffi::method(default(epoch = None))] + pub async fn reference_gas_price(&self, epoch: Option) -> Result> { + Ok(self.0.read().await.reference_gas_price(epoch).await?) + } + + /// Get the protocol configuration. + #[uniffi::method(default(version = None))] + pub async fn protocol_config( + &self, + version: Option, + ) -> Result>> { + Ok(self + .0 + .read() + .await + .protocol_config(version) + .await? + .map(Into::into) + .map(Arc::new)) + } + + /// Get the list of active validators for the provided epoch, including + /// related metadata. If no epoch is provided, it will return the active + /// validators for the current epoch. + #[uniffi::method(default(epoch = None))] + pub async fn active_validators( + &self, + pagination_filter: PaginationFilter, + epoch: Option, + ) -> Result { + Ok(self + .0 + .read() + .await + .active_validators(epoch, pagination_filter.into()) + .await? + .map(Into::into) + .into()) + } + + /// The total number of transaction blocks in the network by the end of the + /// provided checkpoint digest. + pub async fn total_transaction_blocks_by_digest( + &self, + digest: &CheckpointContentsDigest, + ) -> Result> { + Ok(self + .0 + .read() + .await + .total_transaction_blocks_by_digest(**digest) + .await?) + } + + /// The total number of transaction blocks in the network by the end of the + /// provided checkpoint sequence number. + pub async fn total_transaction_blocks_by_seq_num(&self, seq_num: u64) -> Result> { + Ok(self + .0 + .read() + .await + .total_transaction_blocks_by_seq_num(seq_num) + .await?) + } + + /// The total number of transaction blocks in the network by the end of the + /// last known checkpoint. + pub async fn total_transaction_blocks(&self) -> Result> { + Ok(self.0.read().await.total_transaction_blocks().await?) + } + + // =========================================================================== + // Coin API + // =========================================================================== + + /// Get the list of coins for the specified address. + /// + /// If `coin_type` is not provided, it will default to `0x2::coin::Coin`, + /// which will return all coins. For IOTA coin, pass in the coin type: + /// `0x2::coin::Coin<0x2::iota::IOTA>`. + #[uniffi::method(default(coin_type = None))] + pub async fn coins( + &self, + owner: &Address, + pagination_filter: PaginationFilter, + coin_type: Option, + ) -> Result { + Ok(self + .0 + .read() + .await + .coins(**owner, coin_type, pagination_filter.into()) + .await? + .map(Into::into) + .into()) + } + + /// Get the coin metadata for the coin type. + pub async fn coin_metadata(&self, coin_type: &str) -> Result>> { + Ok(self + .0 + .read() + .await + .coin_metadata(coin_type) + .await? + .map(Into::into) + .map(Arc::new)) + } + + /// Get total supply for the coin type. + pub async fn total_supply(&self, coin_type: &str) -> Result> { + Ok(self.0.read().await.total_supply(coin_type).await?) + } + + // =========================================================================== + // Checkpoints API + // =========================================================================== + + /// Get the [`CheckpointSummary`] for a given checkpoint digest or + /// checkpoint id. If none is provided, it will use the last known + /// checkpoint id. + #[uniffi::method(default(digest = None, seq_num = None))] + pub async fn checkpoint( + &self, + digest: Option>, + seq_num: Option, + ) -> Result> { + Ok(self + .0 + .read() + .await + .checkpoint(digest.map(|d| **d), seq_num) + .await? + .map(Into::into)) + } + + /// Get a page of [`CheckpointSummary`] for the provided parameters. + pub async fn checkpoints( + &self, + pagination_filter: PaginationFilter, + ) -> Result { + Ok(self + .0 + .read() + .await + .checkpoints(pagination_filter.into()) + .await? + .map(Into::into) + .into()) + } + + /// Return the sequence number of the latest checkpoint that has been + /// executed. + pub async fn latest_checkpoint_sequence_number( + &self, + ) -> Result> { + Ok(self + .0 + .read() + .await + .latest_checkpoint_sequence_number() + .await?) + } + + // =========================================================================== + // Epoch API + // =========================================================================== + + /// Return the epoch information for the provided epoch. If no epoch is + /// provided, it will return the last known epoch. + #[uniffi::method(default(epoch = None))] + pub async fn epoch(&self, epoch: Option) -> Result>> { + Ok(self + .0 + .read() + .await + .epoch(epoch) + .await? + .map(Into::into) + .map(Arc::new)) + } + + /// Return the number of checkpoints in this epoch. This will return + /// `Ok(None)` if the epoch requested is not available in the GraphQL + /// service (e.g., due to pruning). + #[uniffi::method(default(epoch = None))] + pub async fn epoch_total_checkpoints(&self, epoch: Option) -> Result> { + Ok(self.0.read().await.epoch_total_checkpoints(epoch).await?) + } + + /// Return the number of transaction blocks in this epoch. This will return + /// `Ok(None)` if the epoch requested is not available in the GraphQL + /// service (e.g., due to pruning). + #[uniffi::method(default(epoch = None))] + pub async fn epoch_total_transaction_blocks(&self, epoch: Option) -> Result> { + Ok(self + .0 + .read() + .await + .epoch_total_transaction_blocks(epoch) + .await?) + } + + // =========================================================================== + // Events API + // =========================================================================== + + /// Return a page of tuple (event, transaction digest) based on the + /// (optional) event filter. + #[uniffi::method(default(filter = None))] + pub async fn events( + &self, + pagination_filter: PaginationFilter, + filter: Option, + ) -> Result { + Ok(self + .0 + .read() + .await + .events(filter.map(|f| f.into()), pagination_filter.into()) + .await? + .map(Into::into) + .into()) + } + + // =========================================================================== + // Objects API + // =========================================================================== + + /// Return an object based on the provided [`Address`]. + /// + /// If the object does not exist (e.g., due to pruning), this will return + /// `Ok(None)`. Similarly, if this is not an object but an address, it + /// will return `Ok(None)`. + #[uniffi::method(default(version = None))] + pub async fn object( + &self, + object_id: &ObjectId, + version: Option, + ) -> Result>> { + Ok(self + .0 + .read() + .await + .object(**object_id, version) + .await? + .map(Into::into) + .map(Arc::new)) + } + + /// Return a page of objects based on the provided parameters. + /// + /// Use this function together with the [`ObjectFilter::owner`] to get the + /// objects owned by an address. + /// + /// # Example + /// + /// ```rust,ignore + /// let filter = ObjectFilter { + /// type_: None, + /// owner: Some(Address::from_str("test").unwrap().into()), + /// object_ids: None, + /// }; + /// + /// let owned_objects = client.objects(None, None, Some(filter), None, None).await; + /// ``` + #[uniffi::method(default(filter = None))] + pub async fn objects( + &self, + pagination_filter: PaginationFilter, + filter: Option>, + ) -> Result { + Ok(self + .0 + .read() + .await + .objects(filter.map(|f| f.0.clone()), pagination_filter.into()) + .await? + .map(Into::into) + .into()) + } + + /// Return the object's bcs content [`Vec`] based on the provided + /// [`Address`]. + pub async fn object_bcs(&self, object_id: &ObjectId) -> Result>> { + Ok(self.0.read().await.object_bcs(**object_id).await?) + } + + /// Return the BCS of an object that is a Move object. + /// + /// If the object does not exist (e.g., due to pruning), this will return + /// `Ok(None)`. Similarly, if this is not an object but an address, it + /// will return `Ok(None)`. + #[uniffi::method(default(version = None))] + pub async fn move_object_contents_bcs( + &self, + object_id: &ObjectId, + version: Option, + ) -> Result>> { + Ok(self + .0 + .read() + .await + .move_object_contents_bcs(**object_id, version) + .await?) + } + + // =========================================================================== + // Package API + // =========================================================================== + + /// The package corresponding to the given address (at the optionally given + /// version). When no version is given, the package is loaded directly + /// from the address given. Otherwise, the address is translated before + /// loading to point to the package whose original ID matches + /// the package at address, but whose version is version. For non-system + /// packages, this might result in a different address than address + /// because different versions of a package, introduced by upgrades, + /// exist at distinct addresses. + /// + /// Note that this interpretation of version is different from a historical + /// object read (the interpretation of version for the object query). + #[uniffi::method(default(version = None))] + pub async fn package( + &self, + address: &Address, + version: Option, + ) -> Result>> { + Ok(self + .0 + .read() + .await + .package(**address, version) + .await? + .map(Into::into) + .map(Arc::new)) + } + + /// Fetch all versions of package at address (packages that share this + /// package's original ID), optionally bounding the versions exclusively + /// from below with afterVersion, or from above with beforeVersion. + #[uniffi::method(default(after_version = None, before_version = None))] + pub async fn package_versions( + &self, + address: &Address, + pagination_filter: PaginationFilter, + after_version: Option, + before_version: Option, + ) -> Result { + Ok(self + .0 + .read() + .await + .package_versions( + **address, + pagination_filter.into(), + after_version, + before_version, + ) + .await? + .map(Into::into) + .into()) + } + + /// Fetch the latest version of the package at address. + /// This corresponds to the package with the highest version that shares its + /// original ID with the package at address. + pub async fn package_latest(&self, address: &Address) -> Result>> { + Ok(self + .0 + .read() + .await + .package_latest(**address) + .await? + .map(Into::into) + .map(Arc::new)) + } + + /// The Move packages that exist in the network, optionally filtered to be + /// strictly before beforeCheckpoint and/or strictly after + /// afterCheckpoint. + /// + /// This query returns all versions of a given user package that appear + /// between the specified checkpoints, but only records the latest + /// versions of system packages. + #[uniffi::method(default(after_checkpoint = None, before_checkpoint = None))] + pub async fn packages( + &self, + pagination_filter: PaginationFilter, + after_checkpoint: Option, + before_checkpoint: Option, + ) -> Result { + Ok(self + .0 + .read() + .await + .packages( + pagination_filter.into(), + after_checkpoint, + before_checkpoint, + ) + .await? + .map(Into::into) + .into()) + } + + // =========================================================================== + // Transaction API + // =========================================================================== + + /// Get a transaction by its digest. + pub async fn transaction( + &self, + digest: &TransactionDigest, + ) -> Result>> { + Ok(self + .0 + .read() + .await + .transaction(**digest) + .await? + .map(Into::into) + .map(Arc::new)) + } + + /// Get a transaction's effects by its digest. + pub async fn transaction_effects( + &self, + digest: &TransactionDigest, + ) -> Result>> { + Ok(self + .0 + .read() + .await + .transaction_effects(**digest) + .await? + .map(Into::into) + .map(Arc::new)) + } + + /// Get a transaction's data and effects by its digest. + pub async fn transaction_data_effects( + &self, + digest: &TransactionDigest, + ) -> Result>> { + Ok(self + .0 + .read() + .await + .transaction_data_effects(**digest) + .await? + .map(Into::into) + .map(Arc::new)) + } + + /// Get a page of transactions based on the provided filters. + #[uniffi::method(default(filter = None))] + pub async fn transactions( + &self, + pagination_filter: PaginationFilter, + filter: Option, + ) -> Result { + Ok(self + .0 + .read() + .await + .transactions(filter.map(Into::into), pagination_filter.into()) + .await? + .map(Into::into) + .into()) + } + + /// Get a page of transactions' effects based on the provided filters. + #[uniffi::method(default(filter = None))] + pub async fn transactions_effects( + &self, + pagination_filter: PaginationFilter, + filter: Option, + ) -> Result { + Ok(self + .0 + .read() + .await + .transactions_effects(filter.map(Into::into), pagination_filter.into()) + .await? + .map(Into::into) + .into()) + } + + /// Get a page of transactions' data and effects based on the provided + /// filters. + #[uniffi::method(default(filter = None))] + pub async fn transactions_data_effects( + &self, + pagination_filter: PaginationFilter, + filter: Option, + ) -> Result { + Ok(self + .0 + .read() + .await + .transactions_data_effects(filter.map(Into::into), pagination_filter.into()) + .await? + .map(Into::into) + .into()) + } + + /// Execute a transaction. + pub async fn execute_tx( + &self, + signatures: Vec>, + tx: &Transaction, + ) -> Result>> { + Ok(self + .0 + .read() + .await + .execute_tx( + &signatures + .into_iter() + .map(|s| s.0.clone()) + .collect::>(), + &tx.0, + ) + .await? + .map(Into::into) + .map(Arc::new)) + } + + // =========================================================================== + // Normalized Move Package API + // =========================================================================== + /// Return the normalized Move function data for the provided package, + /// module, and function. + #[uniffi::method(default(version = None))] + pub async fn normalized_move_function( + &self, + package: &str, + module: &str, + function: &str, + version: Option, + ) -> Result>> { + Ok(self + .0 + .read() + .await + .normalized_move_function(package, module, function, version) + .await? + .map(Into::into) + .map(Arc::new)) + } + + /// Return the contents' JSON of an object that is a Move object. + /// + /// If the object does not exist (e.g., due to pruning), this will return + /// `Ok(None)`. Similarly, if this is not an object but an address, it + /// will return `Ok(None)`. + #[uniffi::method(default(version = None))] + pub async fn move_object_contents( + &self, + object_id: &ObjectId, + version: Option, + ) -> Result> { + Ok(self + .0 + .read() + .await + .move_object_contents(**object_id, version) + .await?) + } + + /// Return the normalized Move module data for the provided module. + // TODO: do we want to self paginate everything and return all the data, or keep pagination + // options? + #[allow(clippy::too_many_arguments)] + #[uniffi::method(default(version = None))] + pub async fn normalized_move_module( + &self, + package: &str, + module: &str, + pagination_filter_enums: PaginationFilter, + pagination_filter_friends: PaginationFilter, + pagination_filter_functions: PaginationFilter, + pagination_filter_structs: PaginationFilter, + version: Option, + ) -> Result>> { + Ok(self + .0 + .read() + .await + .normalized_move_module( + package, + module, + version, + pagination_filter_enums.into(), + pagination_filter_friends.into(), + pagination_filter_functions.into(), + pagination_filter_structs.into(), + ) + .await? + .map(Into::into) + .map(Arc::new)) + } + + // =========================================================================== + // Dynamic Field(s) API + // =========================================================================== + + /// Access a dynamic field on an object using its name. Names are arbitrary + /// Move values whose type have copy, drop, and store, and are specified + /// using their type, and their BCS contents, Base64 encoded. + /// + /// The `name` argument is a json serialized type. + /// + /// This returns [`DynamicFieldOutput`] which contains the name, the value + /// as json, and object. + /// + /// # Example + /// ```rust,ignore + /// + /// let client = iota_graphql_client::Client::new_devnet(); + /// let address = Address::from_str("0x5").unwrap(); + /// let df = client.dynamic_field_with_name(address, "u64", 2u64).await.unwrap(); + /// + /// # alternatively, pass in the bcs bytes + /// let bcs = base64ct::Base64::decode_vec("AgAAAAAAAAA=").unwrap(); + /// let df = client.dynamic_field(address, "u64", BcsName(bcs)).await.unwrap(); + /// ``` + pub async fn dynamic_field( + &self, + address: &Address, + type_: &TypeTag, + name: serde_json::Value, + ) -> Result>> { + Ok(self + .0 + .read() + .await + .dynamic_field(**address, type_.0.clone(), name) + .await? + .map(Into::into) + .map(Arc::new)) + } + + /// Access a dynamic object field on an object using its name. Names are + /// arbitrary Move values whose type have copy, drop, and store, and are + /// specified using their type, and their BCS contents, Base64 encoded. + /// + /// The `name` argument is a json serialized type. + /// + /// This returns [`DynamicFieldOutput`] which contains the name, the value + /// as json, and object. + pub async fn dynamic_object_field( + &self, + address: &Address, + type_: &TypeTag, + name: serde_json::Value, + ) -> Result>> { + Ok(self + .0 + .read() + .await + .dynamic_object_field(**address, type_.0.clone(), name) + .await? + .map(Into::into) + .map(Arc::new)) + } + + /// Get a page of dynamic fields for the provided address. Note that this + /// will also fetch dynamic fields on wrapped objects. + /// + /// This returns [`Page`] of [`DynamicFieldOutput`]s. + pub async fn dynamic_fields( + &self, + address: &Address, + pagination_filter: PaginationFilter, + ) -> Result { + Ok(self + .0 + .read() + .await + .dynamic_fields(**address, pagination_filter.into()) + .await? + .map(Into::into) + .into()) + } + + /// Set the server address for the GraphQL GraphQL client. It should be a + /// valid URL with a host and optionally a port number. + pub async fn set_rpc_server(&self, server: String) -> Result<()> { + Ok(self.0.write().await.set_rpc_server(&server)?) + } + + /// Get the GraphQL service configuration, including complexity limits, read + /// and mutation limits, supported versions, and others. + pub async fn service_config(&self) -> Result { + Ok(self.0.read().await.service_config().await?.clone().into()) + } + + // =========================================================================== + // Dry Run API + // =========================================================================== + + /// Dry run a [`Transaction`] and return the transaction effects and dry run + /// error (if any). + /// + /// `skipChecks` optional flag disables the usual verification checks that + /// prevent access to objects that are owned by addresses other than the + /// sender, and calling non-public, non-entry functions, and some other + /// checks. Defaults to false. + #[uniffi::method(default(skip_checks = None))] + pub async fn dry_run_tx( + &self, + tx: &Transaction, + skip_checks: Option, + ) -> Result { + Ok(self + .0 + .read() + .await + .dry_run_tx(&tx.0, skip_checks) + .await? + .into()) + } + + /// Dry run a [`TransactionKind`] and return the transaction effects and dry + /// run error (if any). + /// + /// `skipChecks` optional flag disables the usual verification checks that + /// prevent access to objects that are owned by addresses other than the + /// sender, and calling non-public, non-entry functions, and some other + /// checks. Defaults to false. + /// + /// `tx_meta` is the transaction metadata. + #[uniffi::method(default(skip_checks = None))] + pub async fn dry_run_tx_kind( + &self, + tx_kind: &TransactionKind, + tx_meta: TransactionMetadata, + skip_checks: Option, + ) -> Result { + Ok(self + .0 + .read() + .await + .dry_run_tx_kind(&tx_kind.0, skip_checks, tx_meta.into()) + .await? + .into()) + } + + // =========================================================================== + // Balance API + // =========================================================================== + + /// Get the balance of all the coins owned by address for the provided coin + /// type. Coin type will default to `0x2::coin::Coin<0x2::iota::IOTA>` + /// if not provided. + #[uniffi::method(default(coin_type = None))] + pub async fn balance( + &self, + address: &Address, + coin_type: Option, + ) -> Result> { + Ok(self.0.read().await.balance(**address, coin_type).await?) + } +} diff --git a/crates/iota-sdk-ffi/src/lib.rs b/crates/iota-sdk-ffi/src/lib.rs new file mode 100644 index 000000000..96cb1ebe2 --- /dev/null +++ b/crates/iota-sdk-ffi/src/lib.rs @@ -0,0 +1,115 @@ +// Copyright (c) 2025 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +//! Core type definitions for the IOTA blockchain. +//! +//! [IOTA] is a next-generation smart contract platform with high throughput, +//! low latency, and an asset-oriented programming model powered by the Move +//! programming language. This crate provides type definitions for working with +//! the data that makes up the IOTA blockchain. +//! +//! [IOTA]: https://iota.org +//! +//! # Feature flags +//! +//! This library uses a set of [feature flags] to reduce the number of +//! dependencies and amount of compiled code. By default, no features are +//! enabled which allows one to enable a subset specifically for their use case. +//! Below is a list of the available feature flags. +//! +//! - `schemars`: Enables JSON schema generation using the [schemars] library. +//! - `serde`: Enables support for serializing and deserializing types to/from +//! BCS utilizing [serde] library. +//! - `rand`: Enables support for generating random instances of a number of +//! types via the [rand] library. +//! - `hash`: Enables support for hashing, which is required for deriving +//! addresses and calculating digests for various types. +//! - `proptest`: Enables support for the [proptest] library by providing +//! implementations of [proptest::arbitrary::Arbitrary] for many types. +//! +//! [feature flags]: https://doc.rust-lang.org/cargo/reference/manifest.html#the-features-section +//! [serde]: https://docs.rs/serde +//! [rand]: https://docs.rs/rand +//! [proptest]: https://docs.rs/proptest +//! [schemars]: https://docs.rs/schemars +//! [proptest::arbitrary::Arbitrary]: https://docs.rs/proptest/latest/proptest/arbitrary/trait.Arbitrary.html +//! +//! # BCS +//! +//! [BCS] is the serialization format used to represent the state of the +//! blockchain and is used extensively throughout the IOTA ecosystem. In +//! particular the BCS format is leveraged because it _"guarantees canonical +//! serialization, meaning that for any given data type, there is a one-to-one +//! correspondence between in-memory values and valid byte representations."_ +//! One benefit of this property of having a canonical serialized representation +//! is to allow different entities in the ecosystem to all agree on how a +//! particular type should be interpreted and more importantly define a +//! deterministic representation for hashing and signing. +//! +//! This library strives to guarantee that the types defined are fully +//! BCS-compatible with the data that the network produces. The one caveat to +//! this would be that as the IOTA protocol evolves, new type variants are added +//! and older versions of this library may not support those newly +//! added variants. The expectation is that the most recent release of this +//! library will support new variants and types as they are released to IOTA's +//! `testnet` network. +//! +//! See the documentation for the various types defined by this crate for a +//! specification of their BCS serialized representation which will be defined +//! using ABNF notation as described by [RFC-5234]. In addition to the format +//! itself, some types have an extra layer of verification and may impose +//! additional restrictions on valid byte representations above and beyond those +//! already provided by BCS. In these instances the documentation for those +//! types will clearly specify these additional restrictions. +//! +//! Here are some common rules: +//! +//! ```text +//! ; --- BCS Value --- +//! bcs-value = bcs-struct / bcs-enum / bcs-length-prefixed / bcs-fixed-length +//! bcs-length-prefixed = bytes / string / vector / option +//! bcs-fixed-length = u8 / u16 / u32 / u64 / u128 / +//! i8 / i16 / i32 / i64 / i128 / +//! boolean +//! bcs-struct = *bcs-value ; Sequence of serialized fields +//! bcs-enum = uleb128-index bcs-value ; Enum index and associated value +//! +//! ; --- Length-prefixed types --- +//! bytes = uleb128 *OCTET ; Raw bytes of the specified length +//! string = uleb128 *OCTET ; valid utf8 string of the specified length +//! vector = uleb128 *bcs-value ; Length-prefixed list of values +//! option = %x00 / (%x01 bcs-value) ; optional value +//! +//! ; --- Fixed-length types --- +//! u8 = OCTET ; 1-byte unsigned integer +//! u16 = 2OCTET ; 2-byte unsigned integer, little-endian +//! u32 = 4OCTET ; 4-byte unsigned integer, little-endian +//! u64 = 8OCTET ; 8-byte unsigned integer, little-endian +//! u128 = 16OCTET ; 16-byte unsigned integer, little-endian +//! i8 = OCTET ; 1-byte signed integer +//! i16 = 2OCTET ; 2-byte signed integer, little-endian +//! i32 = 4OCTET ; 4-byte signed integer, little-endian +//! i64 = 8OCTET ; 8-byte signed integer, little-endian +//! i128 = 16OCTET ; 16-byte signed integer, little-endian +//! boolean = %x00 / %x01 ; Boolean: 0 = false, 1 = true +//! array = *(bcs-value) ; Fixed-length array +//! +//! ; --- ULEB128 definition --- +//! uleb128 = 1*5uleb128-byte ; Variable-length ULEB128 encoding +//! uleb128-byte = %x00-7F / %x80-FF ; ULEB128 continuation rules +//! uleb128-index = uleb128 ; ULEB128-encoded variant index +//! ``` +//! +//! [BCS]: https://docs.rs/bcs +//! [RFC-5234]: https://datatracker.ietf.org/doc/html/rfc5234 + +#![expect(unused)] +#![allow(clippy::wrong_self_convention)] + +mod error; +mod faucet; +mod graphql; +mod types; +mod uniffi_helpers; + +uniffi::setup_scaffolding!(); diff --git a/crates/iota-sdk-ffi/src/types/address.rs b/crates/iota-sdk-ffi/src/types/address.rs new file mode 100644 index 000000000..567a94259 --- /dev/null +++ b/crates/iota-sdk-ffi/src/types/address.rs @@ -0,0 +1,87 @@ +// Copyright (c) 2025 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +use crate::error::Result; + +/// Unique identifier for an Account on the IOTA blockchain. +/// +/// An `Address` is a 32-byte pseudonymous identifier used to uniquely identify +/// an account and asset-ownership on the IOTA blockchain. Often, human-readable +/// addresses are encoded in hexadecimal with a `0x` prefix. For example, this +/// is a valid IOTA address: +/// `0x02a212de6a9dfa3a69e22387acfbafbb1a9e591bd9d636e7895dcfc8de05f331`. +/// +/// ``` +/// use iota_types::Address; +/// +/// let hex = "0x02a212de6a9dfa3a69e22387acfbafbb1a9e591bd9d636e7895dcfc8de05f331"; +/// let address = Address::from_hex(hex).unwrap(); +/// println!("Address: {}", address); +/// assert_eq!(hex, address.to_string()); +/// ``` +/// +/// # Deriving an Address +/// +/// Addresses are cryptographically derived from a number of user account +/// authenticators, the simplest of which is an +/// [`Ed25519PublicKey`](iota_types::Ed25519PublicKey). +/// +/// Deriving an address consists of the Blake2b256 hash of the sequence of bytes +/// of its corresponding authenticator, prefixed with a domain-separator (except +/// ed25519, for compatability reasons). For each other authenticator, this +/// domain-separator is the single byte-value of its +/// [`SignatureScheme`](iota_types::SignatureScheme) flag. E.g. `hash(signature +/// schema flag || authenticator bytes)`. +/// +/// Each authenticator has a method for deriving its `Address` as well as +/// documentation for the specifics of how the derivation is done. See +/// [`Ed25519PublicKey::derive_address`] for an example. +/// +/// [`Ed25519PublicKey::derive_address`]: iota_types::Ed25519PublicKey::derive_address +/// +/// ## Relationship to ObjectIds +/// +/// [`ObjectId`]s and [`Address`]es share the same 32-byte addressable space but +/// are derived leveraging different domain-separator values to ensure that, +/// cryptographically, there won't be any overlap, e.g. there can't be a +/// valid `Object` who's `ObjectId` is equal to that of the `Address` of a user +/// account. +/// +/// [`ObjectId`]: iota_types::ObjectId +/// +/// # BCS +/// +/// An `Address`'s BCS serialized form is defined by the following: +/// +/// ```text +/// address = 32OCTET +/// ``` +#[derive(Copy, Clone, Debug, derive_more::From, derive_more::Deref, uniffi::Object)] +pub struct Address(pub iota_types::Address); + +#[uniffi::export] +impl Address { + #[uniffi::constructor] + pub fn from_bytes(bytes: Vec) -> Result { + Ok(Self(iota_types::Address::from_bytes(bytes)?)) + } + + #[uniffi::constructor] + pub fn from_hex(hex: &str) -> Result { + Ok(Self(iota_types::Address::from_hex(hex)?)) + } + + #[uniffi::constructor] + pub fn generate() -> Self { + let mut rng = rand::thread_rng(); + Self(iota_types::Address::generate(&mut rng)) + } + + pub fn to_bytes(&self) -> Vec { + self.0.as_bytes().to_vec() + } + + pub fn to_hex(&self) -> String { + self.0.to_hex() + } +} diff --git a/crates/iota-sdk-ffi/src/types/checkpoint.rs b/crates/iota-sdk-ffi/src/types/checkpoint.rs new file mode 100644 index 000000000..31270f0bf --- /dev/null +++ b/crates/iota-sdk-ffi/src/types/checkpoint.rs @@ -0,0 +1,193 @@ +// Copyright (c) 2025 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +use std::sync::Arc; + +use iota_types::GasCostSummary; + +use crate::types::{ + crypto::ValidatorCommitteeMember, + digest::{CheckpointContentsDigest, CheckpointDigest, Digest}, +}; + +/// A header for a Checkpoint on the IOTA blockchain. +/// +/// On the IOTA network, checkpoints define the history of the blockchain. They +/// are quite similar to the concept of blocks used by other blockchains like +/// Bitcoin or Ethereum. The IOTA blockchain, however, forms checkpoints after +/// transaction execution has already happened to provide a certified history of +/// the chain, instead of being formed before execution. +/// +/// Checkpoints commit to a variety of state including but not limited to: +/// - The hash of the previous checkpoint. +/// - The set of transaction digests, their corresponding effects digests, as +/// well as the set of user signatures which authorized its execution. +/// - The object's produced by a transaction. +/// - The set of live objects that make up the current state of the chain. +/// - On epoch transitions, the next validator committee. +/// +/// `CheckpointSummary`s themselves don't directly include all of the above +/// information but they are the top-level type by which all the above are +/// committed to transitively via cryptographic hashes included in the summary. +/// `CheckpointSummary`s are signed and certified by a quorum of the validator +/// committee in a given epoch in order to allow verification of the chain's +/// state. +/// +/// # BCS +/// +/// The BCS serialized form for this type is defined by the following ABNF: +/// +/// ```text +/// checkpoint-summary = u64 ; epoch +/// u64 ; sequence_number +/// u64 ; network_total_transactions +/// digest ; content_digest +/// (option digest) ; previous_digest +/// gas-cost-summary ; epoch_rolling_gas_cost_summary +/// u64 ; timestamp_ms +/// (vector checkpoint-commitment) ; checkpoint_commitments +/// (option end-of-epoch-data) ; end_of_epoch_data +/// bytes ; version_specific_data +/// ``` +#[derive(Clone, Debug, uniffi::Record)] +pub struct CheckpointSummary { + /// Epoch that this checkpoint belongs to. + pub epoch: u64, + /// The height of this checkpoint. + pub sequence_number: u64, + /// Total number of transactions committed since genesis, including those in + /// this checkpoint. + pub network_total_transactions: u64, + /// The hash of the `CheckpointContents` for this checkpoint. + pub content_digest: Arc, + /// The hash of the previous `CheckpointSummary`. + /// + /// This will be only be `None` for the first, or genesis checkpoint. + pub previous_digest: Option>, + /// The running total gas costs of all transactions included in the current + /// epoch so far until this checkpoint. + pub epoch_rolling_gas_cost_summary: GasCostSummary, + /// Timestamp of the checkpoint - number of milliseconds from the Unix epoch + /// Checkpoint timestamps are monotonic, but not strongly monotonic - + /// subsequent checkpoints can have same timestamp if they originate + /// from the same underlining consensus commit + pub timestamp_ms: u64, + /// Commitments to checkpoint-specific state. + pub checkpoint_commitments: Vec>, + /// Extra data only present in the final checkpoint of an epoch. + pub end_of_epoch_data: Option, + /// CheckpointSummary is not an evolvable structure - it must be readable by + /// any version of the code. Therefore, in order to allow extensions to + /// be added to CheckpointSummary, we allow opaque data to be added to + /// checkpoints which can be deserialized based on the current + /// protocol version. + pub version_specific_data: Vec, +} + +impl From for CheckpointSummary { + fn from(value: iota_types::CheckpointSummary) -> Self { + Self { + epoch: value.epoch, + sequence_number: value.sequence_number, + network_total_transactions: value.network_total_transactions, + content_digest: Arc::new(value.content_digest.into()), + previous_digest: value.previous_digest.map(Into::into).map(Arc::new), + epoch_rolling_gas_cost_summary: value.epoch_rolling_gas_cost_summary, + timestamp_ms: value.timestamp_ms, + checkpoint_commitments: value + .checkpoint_commitments + .into_iter() + .map(Into::into) + .map(Arc::new) + .collect(), + end_of_epoch_data: value.end_of_epoch_data.map(Into::into), + version_specific_data: value.version_specific_data, + } + } +} + +impl From for iota_types::CheckpointSummary { + fn from(value: CheckpointSummary) -> Self { + Self { + epoch: value.epoch, + sequence_number: value.sequence_number, + network_total_transactions: value.network_total_transactions, + content_digest: **value.content_digest, + previous_digest: value.previous_digest.map(|v| **v), + epoch_rolling_gas_cost_summary: value.epoch_rolling_gas_cost_summary, + timestamp_ms: value.timestamp_ms, + checkpoint_commitments: value + .checkpoint_commitments + .into_iter() + .map(|v| v.0.clone()) + .collect(), + end_of_epoch_data: value.end_of_epoch_data.map(Into::into), + version_specific_data: value.version_specific_data, + } + } +} + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct CheckpointCommitment(pub iota_types::CheckpointCommitment); + +#[uniffi::export] +impl CheckpointCommitment { + pub fn is_ecmh_live_object_set(&self) -> bool { + matches!( + self.0, + iota_types::CheckpointCommitment::EcmhLiveObjectSet { .. } + ) + } + + pub fn as_ecmh_live_object_set_digest(&self) -> Digest { + let iota_types::CheckpointCommitment::EcmhLiveObjectSet { digest } = self.0.clone(); + digest.into() + } +} + +#[derive(Clone, Debug, uniffi::Record)] +pub struct EndOfEpochData { + pub next_epoch_committee: Vec, + pub next_epoch_protocol_version: u64, + pub epoch_commitments: Vec>, + pub epoch_supply_change: i64, +} + +impl From for EndOfEpochData { + fn from(value: iota_types::EndOfEpochData) -> Self { + Self { + next_epoch_committee: value + .next_epoch_committee + .into_iter() + .map(Into::into) + .collect(), + next_epoch_protocol_version: value.next_epoch_protocol_version, + epoch_commitments: value + .epoch_commitments + .into_iter() + .map(Into::into) + .map(Arc::new) + .collect(), + epoch_supply_change: value.epoch_supply_change, + } + } +} + +impl From for iota_types::EndOfEpochData { + fn from(value: EndOfEpochData) -> Self { + Self { + next_epoch_committee: value + .next_epoch_committee + .into_iter() + .map(Into::into) + .collect(), + next_epoch_protocol_version: value.next_epoch_protocol_version, + epoch_commitments: value + .epoch_commitments + .into_iter() + .map(|v| v.0.clone()) + .collect(), + epoch_supply_change: value.epoch_supply_change, + } + } +} diff --git a/crates/iota-sdk-ffi/src/types/coin.rs b/crates/iota-sdk-ffi/src/types/coin.rs new file mode 100644 index 000000000..d361f38c7 --- /dev/null +++ b/crates/iota-sdk-ffi/src/types/coin.rs @@ -0,0 +1,33 @@ +// Copyright (c) 2025 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +use crate::{ + error::Result, + types::{ + object::{Object, ObjectId}, + type_tag::TypeTag, + }, +}; + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct Coin(pub iota_types::framework::Coin); + +#[uniffi::export] +impl Coin { + #[uniffi::constructor] + pub fn try_from_object(object: &Object) -> Result { + Ok(iota_types::framework::Coin::try_from_object(&object.0)?.into()) + } + + pub fn coin_type(&self) -> TypeTag { + self.0.coin_type().clone().into() + } + + pub fn id(&self) -> ObjectId { + (*self.0.id()).into() + } + + pub fn balance(&self) -> u64 { + self.0.balance() + } +} diff --git a/crates/iota-sdk-ffi/src/types/crypto.rs b/crates/iota-sdk-ffi/src/types/crypto.rs new file mode 100644 index 000000000..086564d47 --- /dev/null +++ b/crates/iota-sdk-ffi/src/types/crypto.rs @@ -0,0 +1,125 @@ +// Copyright (c) 2025 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +use std::sync::Arc; + +use crate::error::Result; + +/// A member of a Validator Committee +/// +/// # BCS +/// +/// The BCS serialized form for this type is defined by the following ABNF: +/// +/// ```text +/// validator-committee-member = bls-public-key +/// u64 ; stake +/// ``` +#[derive(Clone, Debug, uniffi::Record)] +pub struct ValidatorCommitteeMember { + pub public_key: Arc, + pub stake: u64, +} + +impl From for ValidatorCommitteeMember { + fn from(value: iota_types::ValidatorCommitteeMember) -> Self { + Self { + public_key: Arc::new(value.public_key.into()), + stake: value.stake, + } + } +} + +impl From for iota_types::ValidatorCommitteeMember { + fn from(value: ValidatorCommitteeMember) -> Self { + Self { + public_key: **value.public_key, + stake: value.stake, + } + } +} + +macro_rules! impl_public_key { + ($(#[$meta:meta])* $t:ident) => { + $(#[$meta])* + #[derive(Copy, Clone, Debug, derive_more::From, derive_more::Deref, uniffi::Object)] + pub struct $t(pub iota_types::$t); + + #[uniffi::export] + impl $t { + #[uniffi::constructor] + pub fn from_bytes(bytes: Vec) -> Result { + Ok(Self(iota_types::$t::from_bytes(bytes)?)) + } + + #[uniffi::constructor] + pub fn from_str(s: &str) -> Result { + Ok(Self(std::str::FromStr::from_str(s)?)) + } + + #[uniffi::constructor] + pub fn generate() -> Self { + let mut rng = rand::thread_rng(); + Self(iota_types::$t::generate(&mut rng)) + } + + pub fn to_bytes(&self) -> Vec { + self.0.as_bytes().to_vec() + } + } + }; +} + +impl_public_key!( + /// A bls12381 min-sig public key. + /// + /// # BCS + /// + /// The BCS serialized form for this type is defined by the following ABNF: + /// + /// ```text + /// bls-public-key = %x60 96OCTECT + /// ``` + /// + /// Due to historical reasons, even though a min-sig `Bls12381PublicKey` has a + /// fixed-length of 96, IOTA's binary representation of a min-sig + /// `Bls12381PublicKey` is prefixed with its length meaning its serialized + /// binary form (in bcs) is 97 bytes long vs a more compact 96 bytes. + Bls12381PublicKey +); +impl_public_key!( + /// An ed25519 public key. + /// + /// # BCS + /// + /// The BCS serialized form for this type is defined by the following ABNF: + /// + /// ```text + /// ed25519-public-key = 32OCTECT + /// ``` + Ed25519PublicKey +); +impl_public_key!( + /// A secp256k1 signature. + /// + /// # BCS + /// + /// The BCS serialized form for this type is defined by the following ABNF: + /// + /// ```text + /// secp256k1-signature = 64OCTECT + /// ``` + Secp256k1PublicKey +); +impl_public_key!( + /// A secp256r1 signature. + /// + /// # BCS + /// + /// The BCS serialized form for this type is defined by the following ABNF: + /// + /// ```text + /// secp256r1-signature = 64OCTECT + /// ``` + Secp256r1PublicKey +); diff --git a/crates/iota-sdk-ffi/src/types/digest.rs b/crates/iota-sdk-ffi/src/types/digest.rs new file mode 100644 index 000000000..7eca48319 --- /dev/null +++ b/crates/iota-sdk-ffi/src/types/digest.rs @@ -0,0 +1,83 @@ +// Copyright (c) 2025 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +use crate::error::Result; + +macro_rules! impl_digest_wrapper { + ($(#[$meta:meta])* $t:ident) => { + $(#[$meta])* + #[derive( + Copy, + Clone, + Debug, + Default, + Hash, + PartialEq, + Eq, + PartialOrd, + Ord, + derive_more::From, + derive_more::Deref, + uniffi::Object, + )] + pub struct $t(iota_types::$t); + + impl $t { + #[uniffi::constructor] + pub fn from_bytes(bytes: Vec) -> Result { + Ok(Self(iota_types::$t::from_bytes(bytes)?)) + } + + #[uniffi::constructor] + pub fn from_base58(hex: &str) -> Result { + Ok(Self(iota_types::$t::from_base58(hex)?)) + } + + #[uniffi::constructor] + pub fn generate() -> Self { + let mut rng = rand::thread_rng(); + Self(iota_types::$t::generate(&mut rng)) + } + + pub fn to_bytes(&self) -> Vec { + self.0.as_bytes().to_vec() + } + + pub fn to_base58(&self) -> String { + self.0.to_base58() + } + } + + impl From<&iota_types::$t> for $t { + fn from(value: &iota_types::$t) -> Self { + Self(*value) + } + } + }; +} + +impl_digest_wrapper!( + /// A 32-byte Blake2b256 hash output. + /// + /// # BCS + /// + /// A `Digest`'s BCS serialized form is defined by the following: + /// + /// ```text + /// digest = %x20 32OCTET + /// ``` + /// + /// Due to historical reasons, even though a `Digest` has a fixed-length of 32, + /// IOTA's binary representation of a `Digest` is prefixed with its length + /// meaning its serialized binary form (in bcs) is 33 bytes long vs a more + /// compact 32 bytes. + Digest +); +impl_digest_wrapper!(CheckpointDigest); +impl_digest_wrapper!(CheckpointContentsDigest); +impl_digest_wrapper!(TransactionDigest); +impl_digest_wrapper!(TransactionEffectsDigest); +impl_digest_wrapper!(TransactionEventsDigest); +impl_digest_wrapper!(ObjectDigest); +impl_digest_wrapper!(ConsensusCommitDigest); +impl_digest_wrapper!(EffectsAuxiliaryDataDigest); diff --git a/crates/iota-sdk-ffi/src/types/gas.rs b/crates/iota-sdk-ffi/src/types/gas.rs new file mode 100644 index 000000000..18124cbe7 --- /dev/null +++ b/crates/iota-sdk-ffi/src/types/gas.rs @@ -0,0 +1,13 @@ +// Copyright (c) 2025 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +use iota_types::GasCostSummary; + +#[uniffi::remote(Record)] +pub struct GasCostSummary { + pub computation_cost: u64, + pub computation_cost_burned: u64, + pub storage_cost: u64, + pub storage_rebate: u64, + pub non_refundable_storage_fee: u64, +} diff --git a/crates/iota-sdk-ffi/src/types/graphql.rs b/crates/iota-sdk-ffi/src/types/graphql.rs new file mode 100644 index 000000000..175c9d78b --- /dev/null +++ b/crates/iota-sdk-ffi/src/types/graphql.rs @@ -0,0 +1,319 @@ +// Copyright (c) 2025 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +use std::sync::Arc; + +use crate::types::{ + address::Address, + object::ObjectId, + transaction::{SignedTransaction, TransactionEffects}, +}; + +#[derive(Clone, Debug, uniffi::Record)] +pub struct TransactionMetadata { + #[uniffi(default = None)] + pub gas_budget: Option, + #[uniffi(default = None)] + pub gas_objects: Option>>, + #[uniffi(default = None)] + pub gas_price: Option, + #[uniffi(default = None)] + pub gas_sponsor: Option>, + #[uniffi(default = None)] + pub sender: Option>, +} + +impl From for TransactionMetadata { + fn from(value: iota_graphql_client::query_types::TransactionMetadata) -> Self { + Self { + gas_budget: value.gas_budget, + gas_objects: value + .gas_objects + .map(|v| v.into_iter().map(Into::into).map(Arc::new).collect()), + gas_price: value.gas_price, + gas_sponsor: value.gas_sponsor.map(Into::into).map(Arc::new), + sender: value.sender.map(Into::into).map(Arc::new), + } + } +} + +impl From for iota_graphql_client::query_types::TransactionMetadata { + fn from(value: TransactionMetadata) -> Self { + Self { + gas_budget: value.gas_budget, + gas_objects: value + .gas_objects + .map(|v| v.into_iter().map(|o| o.0.clone()).collect()), + gas_price: value.gas_price, + gas_sponsor: value.gas_sponsor.map(|a| **a), + sender: value.sender.map(|a| **a), + } + } +} + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct TransactionDataEffects(pub iota_graphql_client::TransactionDataEffects); + +#[uniffi::export] +impl TransactionDataEffects { + #[uniffi::constructor] + pub fn new(tx: &SignedTransaction, effects: &TransactionEffects) -> Self { + Self(iota_graphql_client::TransactionDataEffects { + tx: tx.0.clone(), + effects: effects.0.clone(), + }) + } + + pub fn tx(&self) -> SignedTransaction { + self.0.tx.clone().into() + } + + pub fn effects(&self) -> TransactionEffects { + self.0.effects.clone().into() + } +} + +#[derive(Clone, Debug, uniffi::Record)] +pub struct TransactionsFilter { + #[uniffi(default = None)] + pub function: Option, + #[uniffi(default = None)] + pub kind: Option, + #[uniffi(default = None)] + pub after_checkpoint: Option, + #[uniffi(default = None)] + pub at_checkpoint: Option, + #[uniffi(default = None)] + pub before_checkpoint: Option, + #[uniffi(default = None)] + pub sign_address: Option>, + #[uniffi(default = None)] + pub recv_address: Option>, + #[uniffi(default = None)] + pub input_object: Option>, + #[uniffi(default = None)] + pub changed_object: Option>, + #[uniffi(default = None)] + pub transaction_ids: Option>, + #[uniffi(default = None)] + pub wrapped_or_deleted_object: Option>, +} + +impl From for TransactionsFilter { + fn from(value: iota_graphql_client::query_types::TransactionsFilter) -> Self { + Self { + function: value.function, + kind: value.kind.map(Into::into), + after_checkpoint: value.after_checkpoint, + at_checkpoint: value.at_checkpoint, + before_checkpoint: value.before_checkpoint, + sign_address: value.sign_address.map(Into::into).map(Arc::new), + recv_address: value.recv_address.map(Into::into).map(Arc::new), + input_object: value.input_object.map(Into::into).map(Arc::new), + changed_object: value.changed_object.map(Into::into).map(Arc::new), + transaction_ids: value.transaction_ids, + wrapped_or_deleted_object: value + .wrapped_or_deleted_object + .map(Into::into) + .map(Arc::new), + } + } +} + +impl From for iota_graphql_client::query_types::TransactionsFilter { + fn from(value: TransactionsFilter) -> Self { + Self { + function: value.function, + kind: value.kind.map(Into::into), + after_checkpoint: value.after_checkpoint, + at_checkpoint: value.at_checkpoint, + before_checkpoint: value.before_checkpoint, + sign_address: value.sign_address.map(|v| **v), + recv_address: value.recv_address.map(|v| **v), + input_object: value.input_object.map(|v| **v), + changed_object: value.changed_object.map(|v| **v), + transaction_ids: value.transaction_ids, + wrapped_or_deleted_object: value.wrapped_or_deleted_object.map(|v| **v), + } + } +} + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct DryRunResult(pub iota_graphql_client::DryRunResult); + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct Event(pub iota_types::Event); + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct ObjectRef(pub iota_graphql_client::query_types::ObjectRef); + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct Epoch(pub iota_graphql_client::query_types::Epoch); + +#[derive(Clone, Debug, uniffi::Record)] +pub struct EventFilter { + #[uniffi(default = None)] + pub emitting_module: Option, + #[uniffi(default = None)] + pub event_type: Option, + #[uniffi(default = None)] + pub sender: Option>, + #[uniffi(default = None)] + pub transaction_digest: Option, +} + +impl From for EventFilter { + fn from(value: iota_graphql_client::query_types::EventFilter) -> Self { + Self { + emitting_module: value.emitting_module, + event_type: value.event_type, + sender: value.sender.map(Into::into).map(Arc::new), + transaction_digest: value.transaction_digest, + } + } +} + +impl From for iota_graphql_client::query_types::EventFilter { + fn from(value: EventFilter) -> Self { + Self { + emitting_module: value.emitting_module, + event_type: value.event_type, + sender: value.sender.map(|a| **a), + transaction_digest: value.transaction_digest, + } + } +} + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct ObjectFilter(pub iota_graphql_client::query_types::ObjectFilter); + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct DynamicFieldOutput(pub iota_graphql_client::DynamicFieldOutput); + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct Validator(pub iota_graphql_client::query_types::Validator); + +#[derive(Copy, Clone, Debug, uniffi::Enum)] +pub enum TransactionBlockKindInput { + SystemTx, + ProgrammableTx, + Genesis, + ConsensusCommitPrologueV1, + AuthenticatorStateUpdateV1, + RandomnessStateUpdate, + EndOfEpochTx, +} + +impl From + for TransactionBlockKindInput +{ + fn from(value: iota_graphql_client::query_types::TransactionBlockKindInput) -> Self { + use iota_graphql_client::query_types::TransactionBlockKindInput::*; + match value { + SystemTx => Self::SystemTx, + ProgrammableTx => Self::ProgrammableTx, + Genesis => Self::Genesis, + ConsensusCommitPrologueV1 => Self::ConsensusCommitPrologueV1, + AuthenticatorStateUpdateV1 => Self::AuthenticatorStateUpdateV1, + RandomnessStateUpdate => Self::RandomnessStateUpdate, + EndOfEpochTx => Self::EndOfEpochTx, + } + } +} + +impl From + for iota_graphql_client::query_types::TransactionBlockKindInput +{ + fn from(value: TransactionBlockKindInput) -> Self { + match value { + TransactionBlockKindInput::SystemTx => Self::SystemTx, + TransactionBlockKindInput::ProgrammableTx => Self::ProgrammableTx, + TransactionBlockKindInput::Genesis => Self::Genesis, + TransactionBlockKindInput::ConsensusCommitPrologueV1 => Self::ConsensusCommitPrologueV1, + TransactionBlockKindInput::AuthenticatorStateUpdateV1 => { + Self::AuthenticatorStateUpdateV1 + } + TransactionBlockKindInput::RandomnessStateUpdate => Self::RandomnessStateUpdate, + TransactionBlockKindInput::EndOfEpochTx => Self::EndOfEpochTx, + } + } +} + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct PageInfo(pub iota_graphql_client::query_types::PageInfo); + +/// Pagination options for querying the GraphQL server. It defaults to forward +/// pagination with the GraphQL server's max page size. +#[derive(Clone, Debug, Default, uniffi::Record)] +pub struct PaginationFilter { + /// The direction of pagination. + pub direction: Direction, + /// An opaque cursor used for pagination. + #[uniffi(default = None)] + pub cursor: Option, + /// The maximum number of items to return. If this is ommitted, it will + /// lazily query the service configuration for the max page size. + #[uniffi(default = None)] + pub limit: Option, +} + +impl From for PaginationFilter { + fn from(value: iota_graphql_client::pagination::PaginationFilter) -> Self { + Self { + direction: value.direction.into(), + cursor: value.cursor, + limit: value.limit, + } + } +} + +impl From for iota_graphql_client::pagination::PaginationFilter { + fn from(value: PaginationFilter) -> Self { + Self { + direction: value.direction.into(), + cursor: value.cursor, + limit: value.limit, + } + } +} + +/// Pagination direction. +#[derive(Clone, Debug, Default, uniffi::Enum)] +pub enum Direction { + #[default] + Forward, + Backward, +} + +impl From for Direction { + fn from(value: iota_graphql_client::pagination::Direction) -> Self { + match value { + iota_graphql_client::pagination::Direction::Forward => Self::Forward, + iota_graphql_client::pagination::Direction::Backward => Self::Backward, + } + } +} + +impl From for iota_graphql_client::pagination::Direction { + fn from(value: Direction) -> Self { + match value { + Direction::Forward => Self::Forward, + Direction::Backward => Self::Backward, + } + } +} + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct ProtocolConfigs(pub iota_graphql_client::query_types::ProtocolConfigs); + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct CoinMetadata(pub iota_graphql_client::query_types::CoinMetadata); + +#[derive(Debug, derive_more::From, uniffi::Object)] +pub struct MoveFunction(pub iota_graphql_client::query_types::MoveFunction); + +#[derive(Debug, derive_more::From, uniffi::Object)] +pub struct MoveModule(pub iota_graphql_client::query_types::MoveModule); + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct ServiceConfig(pub iota_graphql_client::query_types::ServiceConfig); diff --git a/crates/iota-sdk-ffi/src/types/mod.rs b/crates/iota-sdk-ffi/src/types/mod.rs new file mode 100644 index 000000000..f374c259d --- /dev/null +++ b/crates/iota-sdk-ffi/src/types/mod.rs @@ -0,0 +1,14 @@ +// Copyright (c) 2025 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +pub mod address; +pub mod checkpoint; +pub mod coin; +pub mod crypto; +pub mod digest; +pub mod gas; +pub mod graphql; +pub mod object; +pub mod signature; +pub mod transaction; +pub mod type_tag; diff --git a/crates/iota-sdk-ffi/src/types/object.rs b/crates/iota-sdk-ffi/src/types/object.rs new file mode 100644 index 000000000..80b979421 --- /dev/null +++ b/crates/iota-sdk-ffi/src/types/object.rs @@ -0,0 +1,190 @@ +// Copyright (c) 2025 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +use std::{str::FromStr, sync::Arc}; + +use iota_types::Version; + +use crate::{ + error::Result, + types::{ + address::Address, + digest::{ObjectDigest, TransactionDigest}, + }, +}; + +/// An `ObjectId` is a 32-byte identifier used to uniquely identify an object on +/// the IOTA blockchain. +/// +/// ## Relationship to Address +/// +/// [`Address`]es and [`ObjectId`]s share the same 32-byte addressable space but +/// are derived leveraging different domain-separator values to ensure, +/// cryptographically, that there won't be any overlap, e.g. there can't be a +/// valid `Object` whose `ObjectId` is equal to that of the `Address` of a user +/// account. +/// +/// # BCS +/// +/// An `ObjectId`'s BCS serialized form is defined by the following: +/// +/// ```text +/// object-id = 32*OCTET +/// ``` +#[derive(Clone, Debug, derive_more::From, derive_more::Deref, uniffi::Object)] +pub struct ObjectId(pub iota_types::ObjectId); + +#[uniffi::export] +impl ObjectId { + #[uniffi::constructor] + pub fn from_bytes(bytes: Vec) -> Result { + Ok(Self(iota_types::ObjectId::from( + iota_types::Address::from_bytes(bytes)?, + ))) + } + + #[uniffi::constructor] + pub fn from_hex(hex: &str) -> Result { + Ok(Self(iota_types::ObjectId::from_str(hex)?)) + } + + pub fn to_bytes(&self) -> Vec { + self.0.as_bytes().to_vec() + } + + pub fn to_address(&self) -> Address { + (*self.0.as_address()).into() + } + + pub fn to_hex(&self) -> String { + self.0.as_address().to_hex() + } +} + +impl From<&iota_types::ObjectId> for ObjectId { + fn from(value: &iota_types::ObjectId) -> Self { + Self(*value) + } +} + +/// Reference to an object +/// +/// Contains sufficient information to uniquely identify a specific object. +/// +/// # BCS +/// +/// The BCS serialized form for this type is defined by the following ABNF: +/// +/// ```text +/// object-ref = object-id u64 digest +/// ``` +#[derive(Clone, Debug, uniffi::Record)] +pub struct ObjectReference { + object_id: Arc, + version: u64, + digest: Arc, +} + +impl From for ObjectReference { + fn from(value: iota_types::ObjectReference) -> Self { + Self { + object_id: Arc::new(value.object_id().into()), + version: value.version(), + digest: Arc::new(value.digest().into()), + } + } +} + +impl From for iota_types::ObjectReference { + fn from(value: ObjectReference) -> Self { + Self::new(**value.object_id, value.version, **value.digest) + } +} + +/// An object on the IOTA blockchain +/// +/// # BCS +/// +/// The BCS serialized form for this type is defined by the following ABNF: +/// +/// ```text +/// object = object-data owner digest u64 +/// ``` +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct Object(pub iota_types::Object); + +#[uniffi::export] +impl Object { + #[uniffi::constructor] + pub fn new( + data: &ObjectData, + owner: &Owner, + previous_transaction: &TransactionDigest, + storage_rebate: u64, + ) -> Self { + Self(iota_types::Object::new( + data.0.clone(), + **owner, + **previous_transaction, + storage_rebate, + )) + } + + /// Return this object's id + pub fn object_id(&self) -> ObjectId { + self.0.object_id().into() + } + + /// Return this object's version + pub fn version(&self) -> Version { + self.0.version() + } + + /// Return this object's type + pub fn object_type(&self) -> ObjectType { + self.0.object_type().into() + } + + /// Try to interpret this object as a move struct + pub fn as_struct(&self) -> Option> { + self.0.as_struct().cloned().map(Into::into).map(Arc::new) + } + + /// Return this object's owner + pub fn owner(&self) -> Owner { + (*self.0.owner()).into() + } + + /// Return this object's data + pub fn data(&self) -> ObjectData { + self.0.data().clone().into() + } + + /// Return the digest of the transaction that last modified this object + pub fn previous_transaction(&self) -> TransactionDigest { + self.0.previous_transaction.into() + } + + /// Return the storage rebate locked in this object + /// + /// Storage rebates are credited to the gas coin used in a transaction that + /// deletes this object. + pub fn storage_rebate(&self) -> u64 { + self.0.storage_rebate + } +} + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct ObjectData(pub iota_types::ObjectData); + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct MovePackage(pub iota_types::MovePackage); + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct MoveStruct(pub iota_types::MoveStruct); + +#[derive(Copy, Clone, Debug, derive_more::From, derive_more::Deref, uniffi::Object)] +pub struct Owner(pub iota_types::Owner); + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct ObjectType(pub iota_types::ObjectType); diff --git a/crates/iota-sdk-ffi/src/types/signature.rs b/crates/iota-sdk-ffi/src/types/signature.rs new file mode 100644 index 000000000..e1f681c8a --- /dev/null +++ b/crates/iota-sdk-ffi/src/types/signature.rs @@ -0,0 +1,5 @@ +// Copyright (c) 2025 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct UserSignature(pub iota_types::UserSignature); diff --git a/crates/iota-sdk-ffi/src/types/transaction.rs b/crates/iota-sdk-ffi/src/types/transaction.rs new file mode 100644 index 000000000..7e9e04421 --- /dev/null +++ b/crates/iota-sdk-ffi/src/types/transaction.rs @@ -0,0 +1,277 @@ +// Copyright (c) 2025 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +use std::sync::Arc; + +use crate::types::{ + address::Address, digest::CheckpointDigest, object::ObjectReference, signature::UserSignature, +}; + +/// A transaction +/// +/// # BCS +/// +/// The BCS serialized form for this type is defined by the following ABNF: +/// +/// ```text +/// transaction = %x00 transaction-v1 +/// +/// transaction-v1 = transaction-kind address gas-payment transaction-expiration +/// ``` +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct Transaction(pub iota_types::Transaction); + +#[uniffi::export] +impl Transaction { + #[uniffi::constructor] + pub fn new( + kind: &TransactionKind, + sender: &Address, + gas_payment: GasPayment, + expiration: &TransactionExpiration, + ) -> Self { + Self(iota_types::Transaction { + kind: kind.0.clone(), + sender: **sender, + gas_payment: gas_payment.into(), + expiration: expiration.0, + }) + } + + pub fn kind(&self) -> TransactionKind { + self.0.kind.clone().into() + } + + pub fn sender(&self) -> Address { + self.0.sender.into() + } + + pub fn gas_payment(&self) -> GasPayment { + self.0.gas_payment.clone().into() + } + + pub fn expiration(&self) -> TransactionExpiration { + self.0.expiration.into() + } +} + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct SignedTransaction(pub iota_types::SignedTransaction); + +#[uniffi::export] +impl SignedTransaction { + #[uniffi::constructor] + pub fn new(transaction: &Transaction, signatures: Vec>) -> Self { + Self(iota_types::SignedTransaction { + transaction: transaction.0.clone(), + signatures: signatures.into_iter().map(|s| s.0.clone()).collect(), + }) + } + + pub fn transaction(&self) -> Transaction { + self.0.transaction.clone().into() + } + + pub fn signatures(&self) -> Vec> { + self.0 + .signatures + .iter() + .cloned() + .map(Into::into) + .map(Arc::new) + .collect() + } +} + +/// Transaction type +/// +/// # BCS +/// +/// The BCS serialized form for this type is defined by the following ABNF: +/// +/// ```text +/// transaction-kind = %x00 ptb +/// =/ %x01 change-epoch +/// =/ %x02 genesis-transaction +/// =/ %x03 consensus-commit-prologue +/// =/ %x04 authenticator-state-update +/// =/ %x05 (vector end-of-epoch-transaction-kind) +/// =/ %x06 randomness-state-update +/// =/ %x07 consensus-commit-prologue-v2 +/// =/ %x08 consensus-commit-prologue-v3 +/// ``` +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct TransactionKind(pub iota_types::TransactionKind); + +#[uniffi::export] +impl TransactionKind { + #[uniffi::constructor] + pub fn programmable_transaction(tx: &ProgrammableTransaction) -> Self { + Self(iota_types::TransactionKind::ProgrammableTransaction( + tx.0.clone(), + )) + } + + #[uniffi::constructor] + pub fn genesis(tx: &GenesisTransaction) -> Self { + Self(iota_types::TransactionKind::Genesis(tx.0.clone())) + } + + #[uniffi::constructor] + pub fn consensus_commit_prologue_v1(tx: &ConsensusCommitPrologueV1) -> Self { + Self(iota_types::TransactionKind::ConsensusCommitPrologueV1( + tx.0.clone(), + )) + } + + #[uniffi::constructor] + pub fn authenticator_state_update_v1(tx: &AuthenticatorStateUpdateV1) -> Self { + Self(iota_types::TransactionKind::AuthenticatorStateUpdateV1( + tx.0.clone(), + )) + } + + #[uniffi::constructor] + pub fn end_of_epoch(tx: Vec>) -> Self { + Self(iota_types::TransactionKind::EndOfEpoch( + tx.into_iter().map(|tx| tx.0.clone()).collect(), + )) + } + + #[uniffi::constructor] + pub fn randomness_state_update(tx: &RandomnessStateUpdate) -> Self { + Self(iota_types::TransactionKind::RandomnessStateUpdate( + tx.0.clone(), + )) + } +} + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct ProgrammableTransaction(pub iota_types::ProgrammableTransaction); + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct ConsensusCommitPrologueV1(pub iota_types::ConsensusCommitPrologueV1); + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct GenesisTransaction(pub iota_types::GenesisTransaction); + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct ChangeEpoch(pub iota_types::ChangeEpoch); + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct ChangeEpochV2(pub iota_types::ChangeEpochV2); + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct AuthenticatorStateExpire(pub iota_types::AuthenticatorStateExpire); + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct AuthenticatorStateUpdateV1(pub iota_types::AuthenticatorStateUpdateV1); + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct ExecutionTimeObservations(pub iota_types::ExecutionTimeObservations); + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct RandomnessStateUpdate(pub iota_types::RandomnessStateUpdate); + +/// Operation run at the end of an epoch +/// +/// # BCS +/// +/// The BCS serialized form for this type is defined by the following ABNF: +/// +/// ```text +/// end-of-epoch-transaction-kind = eoe-change-epoch +/// =/ eoe-authenticator-state-create +/// =/ eoe-authenticator-state-expire +/// =/ eoe-randomness-state-create +/// =/ eoe-deny-list-state-create +/// =/ eoe-bridge-state-create +/// =/ eoe-bridge-committee-init +/// =/ eoe-store-execution-time-observations +/// +/// eoe-change-epoch = %x00 change-epoch +/// eoe-authenticator-state-create = %x01 +/// eoe-authenticator-state-expire = %x02 authenticator-state-expire +/// eoe-randomness-state-create = %x03 +/// eoe-deny-list-state-create = %x04 +/// eoe-bridge-state-create = %x05 digest +/// eoe-bridge-committee-init = %x06 u64 +/// eoe-store-execution-time-observations = %x07 stored-execution-time-observations +/// ``` +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct EndOfEpochTransactionKind(pub iota_types::EndOfEpochTransactionKind); + +#[uniffi::export] +impl EndOfEpochTransactionKind { + #[uniffi::constructor] + pub fn change_epoch(tx: &ChangeEpoch) -> Self { + Self(iota_types::EndOfEpochTransactionKind::ChangeEpoch( + tx.0.clone(), + )) + } + + #[uniffi::constructor] + pub fn change_epoch_v2(tx: &ChangeEpochV2) -> Self { + Self(iota_types::EndOfEpochTransactionKind::ChangeEpochV2( + tx.0.clone(), + )) + } + + #[uniffi::constructor] + pub fn authenticator_state_create() -> Self { + Self(iota_types::EndOfEpochTransactionKind::AuthenticatorStateCreate) + } + + #[uniffi::constructor] + pub fn authenticator_state_expire(tx: &AuthenticatorStateExpire) -> Self { + Self(iota_types::EndOfEpochTransactionKind::AuthenticatorStateExpire(tx.0.clone())) + } +} + +/// Payment information for executing a transaction +/// +/// # BCS +/// +/// The BCS serialized form for this type is defined by the following ABNF: +/// +/// ```text +/// gas-payment = (vector object-ref) ; gas coin objects +/// address ; owner +/// u64 ; price +/// u64 ; budget +/// ``` +#[derive(Clone, Debug, uniffi::Record)] +pub struct GasPayment { + pub objects: Vec, + pub owner: Arc
, + pub price: u64, + pub budget: u64, +} + +impl From for GasPayment { + fn from(value: iota_types::GasPayment) -> Self { + Self { + objects: value.objects.into_iter().map(Into::into).collect(), + owner: Arc::new(value.owner.into()), + price: value.price, + budget: value.budget, + } + } +} + +impl From for iota_types::GasPayment { + fn from(value: GasPayment) -> Self { + Self { + objects: value.objects.into_iter().map(Into::into).collect(), + owner: value.owner.0, + price: value.price, + budget: value.budget, + } + } +} + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct TransactionEffects(pub iota_types::TransactionEffects); + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct TransactionExpiration(pub iota_types::TransactionExpiration); diff --git a/crates/iota-sdk-ffi/src/types/type_tag.rs b/crates/iota-sdk-ffi/src/types/type_tag.rs new file mode 100644 index 000000000..3f472c0b7 --- /dev/null +++ b/crates/iota-sdk-ffi/src/types/type_tag.rs @@ -0,0 +1,5 @@ +// Copyright (c) 2025 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +#[derive(Clone, Debug, derive_more::From, uniffi::Object)] +pub struct TypeTag(pub iota_types::TypeTag); diff --git a/crates/iota-sdk-ffi/src/uniffi_helpers.rs b/crates/iota-sdk-ffi/src/uniffi_helpers.rs new file mode 100644 index 000000000..7774bbf99 --- /dev/null +++ b/crates/iota-sdk-ffi/src/uniffi_helpers.rs @@ -0,0 +1,81 @@ +// Copyright (c) 2025 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +use iota_graphql_client::pagination::Page; +use serde_json::Value; + +use crate::types::{ + checkpoint::CheckpointSummary, + coin::Coin, + graphql::{DynamicFieldOutput, Epoch, Event, PageInfo, TransactionDataEffects, Validator}, + object::{MovePackage, Object}, + transaction::{SignedTransaction, TransactionEffects}, +}; + +macro_rules! define_paged_record { + ($id:ident, $typ:ty) => { + #[derive(uniffi::Object, derive_more::From)] + pub struct $id(Page<$typ>); + + #[uniffi::export] + impl $id { + pub fn page_info(&self) -> PageInfo { + self.0.page_info().clone().into() + } + + pub fn data(&self) -> Vec<$typ> { + self.0.data().to_vec() + } + + pub fn is_empty(&self) -> bool { + self.0.is_empty() + } + } + }; +} + +define_paged_record!(CheckpointSummaryPage, CheckpointSummary); + +macro_rules! define_paged_object { + ($id:ident, $typ:ty) => { + #[derive(uniffi::Object, derive_more::From)] + pub struct $id(Page<$typ>); + + #[uniffi::export] + impl $id { + pub fn page_info(&self) -> PageInfo { + self.0.page_info().clone().into() + } + + pub fn data(&self) -> Vec> { + self.0 + .data() + .iter() + .cloned() + .map(std::sync::Arc::new) + .collect() + } + + pub fn is_empty(&self) -> bool { + self.0.is_empty() + } + } + }; +} + +define_paged_object!(SignedTransactionPage, SignedTransaction); +define_paged_object!(TransactionDataEffectsPage, TransactionDataEffects); +define_paged_object!(EventPage, Event); +define_paged_object!(CoinPage, Coin); +define_paged_object!(ObjectPage, Object); +define_paged_object!(TransactionEffectsPage, TransactionEffects); +define_paged_object!(MovePackagePage, MovePackage); +define_paged_object!(ValidatorPage, Validator); +define_paged_object!(EpochPage, Epoch); +define_paged_object!(DynamicFieldOutputPage, DynamicFieldOutput); + +uniffi::custom_type!(Value, String, { + remote, + lower: |val| val.to_string(), + try_lift: |s| Ok(serde_json::from_str(&s)?), +}); diff --git a/crates/iota-sdk-ffi/uniffi_bindgen.rs b/crates/iota-sdk-ffi/uniffi_bindgen.rs new file mode 100644 index 000000000..4d40b0c26 --- /dev/null +++ b/crates/iota-sdk-ffi/uniffi_bindgen.rs @@ -0,0 +1,6 @@ +// Copyright (c) 2025 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +fn main() { + uniffi::uniffi_bindgen_main() +} diff --git a/crates/iota-sdk-types/Cargo.toml b/crates/iota-sdk-types/Cargo.toml index 518939506..2e5b2f565 100644 --- a/crates/iota-sdk-types/Cargo.toml +++ b/crates/iota-sdk-types/Cargo.toml @@ -37,16 +37,14 @@ schemars = ["serde", "dep:schemars", "dep:serde_json"] rand = ["dep:rand_core"] hash = ["dep:blake2"] proptest = ["dep:proptest", "dep:test-strategy", "serde"] -uniffi = ["dep:uniffi", "dep:anyhow"] [dependencies] -anyhow = { version = "1.0", optional = true } base64ct = { version = "1.6.0", features = ["alloc"] } bnum = "0.12.0" bs58 = "0.5.1" hex = "0.4.3" +paste = "1.0" roaring = { version = "0.10.9", default-features = false } -uniffi = { version = "0.29", optional = true } winnow = "0.7" # Serialization and Deserialization support diff --git a/crates/iota-sdk-types/Makefile b/crates/iota-sdk-types/Makefile index 17cb1dca9..ed563b019 100644 --- a/crates/iota-sdk-types/Makefile +++ b/crates/iota-sdk-types/Makefile @@ -15,10 +15,10 @@ test: cargo nextest run --all-features cargo test --all-features --doc -# --all-features except `uniffi` +# --all-features .PHONY: wasm wasm: - CC=clang wasm-pack test --node -F serde,schemars,rand,hash,proptest + CC=clang wasm-pack test -r --node --all-features %: $(MAKE) -C ../.. $@ diff --git a/crates/iota-sdk-types/src/address.rs b/crates/iota-sdk-types/src/address.rs index 872db308c..4ad582166 100644 --- a/crates/iota-sdk-types/src/address.rs +++ b/crates/iota-sdk-types/src/address.rs @@ -69,8 +69,6 @@ pub struct Address( [u8; Self::LENGTH], ); -crate::impl_uniffi_byte_vec_wrapper!(Address); - impl Address { pub const LENGTH: usize = 32; pub const ZERO: Self = Self([0u8; Self::LENGTH]); diff --git a/crates/iota-sdk-types/src/checkpoint.rs b/crates/iota-sdk-types/src/checkpoint.rs index b26529fde..76889e9ec 100644 --- a/crates/iota-sdk-types/src/checkpoint.rs +++ b/crates/iota-sdk-types/src/checkpoint.rs @@ -32,7 +32,6 @@ pub type ProtocolVersion = u64; schemars(tag = "type", rename_all = "snake_case") )] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] pub enum CheckpointCommitment { /// An Elliptic Curve Multiset Hash attesting to the set of Objects that /// comprise the live state of the IOTA blockchain. @@ -59,7 +58,6 @@ pub enum CheckpointCommitment { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct EndOfEpochData { /// The set of Validators that will be in the ValidatorCommittee for the /// next epoch. @@ -120,7 +118,6 @@ pub struct EndOfEpochData { #[derive(Clone, Debug, PartialEq, Eq)] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct CheckpointSummary { /// Epoch that this checkpoint belongs to. #[cfg_attr(feature = "schemars", schemars(with = "crate::_schemars::U64"))] diff --git a/crates/iota-sdk-types/src/crypto/bls12381.rs b/crates/iota-sdk-types/src/crypto/bls12381.rs index af539b8f4..937364bc7 100644 --- a/crates/iota-sdk-types/src/crypto/bls12381.rs +++ b/crates/iota-sdk-types/src/crypto/bls12381.rs @@ -36,8 +36,6 @@ pub struct Bls12381PublicKey( [u8; Self::LENGTH], ); -crate::impl_uniffi_byte_vec_wrapper!(Bls12381PublicKey); - impl Bls12381PublicKey { /// The length of an bls12381 public key in bytes. pub const LENGTH: usize = 96; diff --git a/crates/iota-sdk-types/src/crypto/ed25519.rs b/crates/iota-sdk-types/src/crypto/ed25519.rs index f9f307338..15be29266 100644 --- a/crates/iota-sdk-types/src/crypto/ed25519.rs +++ b/crates/iota-sdk-types/src/crypto/ed25519.rs @@ -29,8 +29,6 @@ pub struct Ed25519PublicKey( [u8; Self::LENGTH], ); -crate::impl_uniffi_byte_vec_wrapper!(Ed25519PublicKey); - impl Ed25519PublicKey { /// The length of an ed25519 public key in bytes. pub const LENGTH: usize = 32; @@ -141,8 +139,6 @@ pub struct Ed25519Signature( [u8; Self::LENGTH], ); -crate::impl_uniffi_byte_vec_wrapper!(Ed25519Signature); - impl Ed25519Signature { /// The length of an ed25519 signature key in bytes. pub const LENGTH: usize = 64; diff --git a/crates/iota-sdk-types/src/crypto/mod.rs b/crates/iota-sdk-types/src/crypto/mod.rs index c7f9bcd7f..87a456664 100644 --- a/crates/iota-sdk-types/src/crypto/mod.rs +++ b/crates/iota-sdk-types/src/crypto/mod.rs @@ -23,7 +23,7 @@ pub use multisig::{ pub use passkey::{PasskeyAuthenticator, PasskeyPublicKey}; pub use secp256k1::{Secp256k1PublicKey, Secp256k1Signature}; pub use secp256r1::{Secp256r1PublicKey, Secp256r1Signature}; -pub use signature::{SignatureScheme, SimpleSignature, UserSignature}; +pub use signature::{InvalidSignatureScheme, SignatureScheme, SimpleSignature, UserSignature}; pub use validator::{ ValidatorAggregatedSignature, ValidatorCommittee, ValidatorCommitteeMember, ValidatorSignature, }; diff --git a/crates/iota-sdk-types/src/crypto/multisig.rs b/crates/iota-sdk-types/src/crypto/multisig.rs index b66d97d8b..013c2a85f 100644 --- a/crates/iota-sdk-types/src/crypto/multisig.rs +++ b/crates/iota-sdk-types/src/crypto/multisig.rs @@ -46,7 +46,6 @@ const MAX_COMMITTEE_SIZE: usize = 10; /// ``` #[derive(Clone, Debug, PartialEq, Eq)] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] pub enum MultisigMemberPublicKey { Ed25519(Ed25519PublicKey), Secp256k1(Secp256k1PublicKey), @@ -78,7 +77,6 @@ pub enum MultisigMemberPublicKey { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct MultisigMember { public_key: MultisigMemberPublicKey, weight: WeightUnit, @@ -130,7 +128,6 @@ impl MultisigMember { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct MultisigCommittee { /// A list of committee members and their corresponding weight. #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=10).lift()))] @@ -224,7 +221,6 @@ impl MultisigCommittee { #[derive(Debug, Clone)] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct MultisigAggregatedSignature { /// The plain signature encoded with signature scheme. /// @@ -305,7 +301,6 @@ impl Eq for MultisigAggregatedSignature {} /// ``` #[derive(Debug, Clone, PartialEq, Eq)] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] pub enum MultisigMemberSignature { Ed25519(Ed25519Signature), Secp256k1(Secp256k1Signature), diff --git a/crates/iota-sdk-types/src/crypto/passkey.rs b/crates/iota-sdk-types/src/crypto/passkey.rs index fdd306f2d..fe4c44574 100644 --- a/crates/iota-sdk-types/src/crypto/passkey.rs +++ b/crates/iota-sdk-types/src/crypto/passkey.rs @@ -32,7 +32,6 @@ use super::{Secp256r1PublicKey, Secp256r1Signature, SimpleSignature}; /// as `bytes` meaning it has a length prefix that defines the length of /// the completely serialized signature. #[derive(Debug, Clone, PartialEq, Eq)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct PasskeyAuthenticator { /// The secp256r1 public key for this passkey. public_key: Secp256r1PublicKey, diff --git a/crates/iota-sdk-types/src/crypto/secp256k1.rs b/crates/iota-sdk-types/src/crypto/secp256k1.rs index be5a28558..03b8adcda 100644 --- a/crates/iota-sdk-types/src/crypto/secp256k1.rs +++ b/crates/iota-sdk-types/src/crypto/secp256k1.rs @@ -31,8 +31,6 @@ pub struct Secp256k1PublicKey( [u8; Self::LENGTH], ); -crate::impl_uniffi_byte_vec_wrapper!(Secp256k1PublicKey); - impl Secp256k1PublicKey { /// The length of an secp256k1 public key in bytes. pub const LENGTH: usize = 33; @@ -143,8 +141,6 @@ pub struct Secp256k1Signature( [u8; Self::LENGTH], ); -crate::impl_uniffi_byte_vec_wrapper!(Secp256k1Signature); - impl Secp256k1Signature { /// The length of an secp256k1 signature key in bytes. pub const LENGTH: usize = 64; diff --git a/crates/iota-sdk-types/src/crypto/secp256r1.rs b/crates/iota-sdk-types/src/crypto/secp256r1.rs index fac2d354f..0537702de 100644 --- a/crates/iota-sdk-types/src/crypto/secp256r1.rs +++ b/crates/iota-sdk-types/src/crypto/secp256r1.rs @@ -31,8 +31,6 @@ pub struct Secp256r1PublicKey( [u8; Self::LENGTH], ); -crate::impl_uniffi_byte_vec_wrapper!(Secp256r1PublicKey); - impl Secp256r1PublicKey { /// The length of an secp256r1 public key in bytes. pub const LENGTH: usize = 33; @@ -143,8 +141,6 @@ pub struct Secp256r1Signature( [u8; Self::LENGTH], ); -crate::impl_uniffi_byte_vec_wrapper!(Secp256r1Signature); - impl Secp256r1Signature { /// The length of an secp256r1 signature key in bytes. pub const LENGTH: usize = 64; diff --git a/crates/iota-sdk-types/src/crypto/signature.rs b/crates/iota-sdk-types/src/crypto/signature.rs index 95f81b759..305bfb237 100644 --- a/crates/iota-sdk-types/src/crypto/signature.rs +++ b/crates/iota-sdk-types/src/crypto/signature.rs @@ -37,7 +37,6 @@ use super::{ schemars(tag = "scheme", rename_all = "lowercase") )] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] pub enum SimpleSignature { Ed25519 { signature: Ed25519Signature, @@ -193,7 +192,6 @@ impl std::fmt::Display for InvalidSignatureScheme { /// the completely serialized signature. #[derive(Clone, Debug, PartialEq, Eq)] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] pub enum UserSignature { Simple(SimpleSignature), Multisig(MultisigAggregatedSignature), diff --git a/crates/iota-sdk-types/src/crypto/validator.rs b/crates/iota-sdk-types/src/crypto/validator.rs index d517801bd..1ea4b08f7 100644 --- a/crates/iota-sdk-types/src/crypto/validator.rs +++ b/crates/iota-sdk-types/src/crypto/validator.rs @@ -46,7 +46,6 @@ pub struct ValidatorCommittee { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct ValidatorCommitteeMember { #[cfg_attr(feature = "serde", serde(with = "ValidatorPublicKeySerialization"))] #[cfg_attr(feature = "schemars", schemars(with = "Bls12381PublicKey"))] diff --git a/crates/iota-sdk-types/src/crypto/zklogin.rs b/crates/iota-sdk-types/src/crypto/zklogin.rs index 813888ac9..137ce3160 100644 --- a/crates/iota-sdk-types/src/crypto/zklogin.rs +++ b/crates/iota-sdk-types/src/crypto/zklogin.rs @@ -2,9 +2,6 @@ // Modifications Copyright (c) 2025 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -#[cfg(feature = "uniffi")] -use anyhow::anyhow; - use super::SimpleSignature; use crate::{checkpoint::EpochId, u256::U256}; @@ -30,7 +27,6 @@ use crate::{checkpoint::EpochId, u256::U256}; #[derive(Debug, Clone, PartialEq, Eq)] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct ZkLoginAuthenticator { /// Zklogin proof and inputs required to perform proof verification. pub inputs: ZkLoginInputs, @@ -43,15 +39,6 @@ pub struct ZkLoginAuthenticator { pub signature: SimpleSignature, } -#[cfg(feature = "uniffi")] -pub type BoxedZkLoginAuthenticator = Box; - -#[cfg(feature = "uniffi")] -uniffi::custom_type!(BoxedZkLoginAuthenticator, ZkLoginAuthenticator, { - lower: |btt| *btt, - try_lift: |tt| Ok(Box::new(tt)), -}); - /// A zklogin groth16 proof and the required inputs to perform proof /// verification. /// @@ -72,7 +59,6 @@ uniffi::custom_type!(BoxedZkLoginAuthenticator, ZkLoginAuthenticator, { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct ZkLoginInputs { pub proof_points: ZkLoginProof, pub iss_base64_details: ZkLoginClaim, @@ -96,7 +82,6 @@ pub struct ZkLoginInputs { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct ZkLoginClaim { pub value: String, pub index_mod_4: u8, @@ -118,7 +103,6 @@ pub struct ZkLoginClaim { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct ZkLoginProof { pub a: CircomG1, pub b: CircomG2, @@ -142,12 +126,6 @@ pub struct ZkLoginProof { #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] pub struct CircomG1(pub [Bn254FieldElement; 3]); -#[cfg(feature = "uniffi")] -uniffi::custom_type!(CircomG1, Vec, { - lower: |c| c.0.to_vec(), - try_lift: |v| Ok(CircomG1(v.try_into().map_err(|_| anyhow!("failed to convert vec to array"))?)), -}); - /// A G2 point /// /// This represents the canonical decimal representation of the coefficients of @@ -165,21 +143,6 @@ uniffi::custom_type!(CircomG1, Vec, { #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] pub struct CircomG2(pub [[Bn254FieldElement; 2]; 3]); -#[cfg(feature = "uniffi")] -uniffi::custom_type!(CircomG2, Vec>, { - lower: |c| c.0.into_iter().map(|v| v.to_vec()).collect(), - try_lift: |v| { - fn vec_to_array(vec: Vec) -> anyhow::Result<[T; N]> { - vec.try_into().map_err(|_| anyhow!("failed to convert vec to array")) - } - Ok(CircomG2( - vec_to_array( - v.into_iter().map(vec_to_array).collect::, _>>()? - )? - )) - }, -}); - /// Public Key equivalent for Zklogin authenticators /// /// A `ZkLoginPublicIdentifier` is the equivalent of a public key for other @@ -235,7 +198,6 @@ uniffi::custom_type!(CircomG2, Vec>, { #[derive(Clone, Debug, PartialEq, Eq)] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct ZkLoginPublicIdentifier { iss: String, address_seed: Bn254FieldElement, @@ -279,7 +241,6 @@ impl ZkLoginPublicIdentifier { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct Jwk { /// Key type parameter, pub kty: String, @@ -310,7 +271,6 @@ pub struct Jwk { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct JwkId { /// The issuer or identity of the OIDC provider. pub iss: String, @@ -339,12 +299,6 @@ pub struct Bn254FieldElement( #[cfg_attr(feature = "schemars", schemars(with = "crate::_schemars::U256"))] [u8; 32], ); -#[cfg(feature = "uniffi")] -uniffi::custom_type!(Bn254FieldElement, String, { - lower: |key| key.to_string(), - try_lift: |s| Ok(std::str::FromStr::from_str(&s)?), -}); - impl Bn254FieldElement { pub const fn new(bytes: [u8; 32]) -> Self { Self(bytes) diff --git a/crates/iota-sdk-types/src/digest.rs b/crates/iota-sdk-types/src/digest.rs index 7c81fd2f3..11d625204 100644 --- a/crates/iota-sdk-types/src/digest.rs +++ b/crates/iota-sdk-types/src/digest.rs @@ -29,8 +29,6 @@ pub struct Digest( [u8; Self::LENGTH], ); -crate::impl_uniffi_byte_vec_wrapper!(Digest); - impl Digest { /// A constant representing the length of a digest in bytes. pub const LENGTH: usize = 32; @@ -227,9 +225,6 @@ macro_rules! impl_digest { #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] pub struct $t(Digest); - #[cfg(feature = "uniffi")] - uniffi::custom_type!($t, Digest); - impl $t { pub const LENGTH: usize = Digest::LENGTH; pub const ZERO: Self = Self::new([0; Self::LENGTH]); diff --git a/crates/iota-sdk-types/src/effects/mod.rs b/crates/iota-sdk-types/src/effects/mod.rs index e6d730664..575507997 100644 --- a/crates/iota-sdk-types/src/effects/mod.rs +++ b/crates/iota-sdk-types/src/effects/mod.rs @@ -28,21 +28,11 @@ use crate::execution_status::ExecutionStatus; schemars(tag = "version") )] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] pub enum TransactionEffects { #[cfg_attr(feature = "schemars", schemars(rename = "1"))] V1(Box), } -#[cfg(feature = "uniffi")] -pub type BoxedTransactionEffectsV1 = Box; - -#[cfg(feature = "uniffi")] -uniffi::custom_type!(BoxedTransactionEffectsV1, TransactionEffectsV1, { - lower: |btt| *btt, - try_lift: |tt| Ok(Box::new(tt)), -}); - impl TransactionEffects { /// Return the status of the transaction. pub fn status(&self) -> &ExecutionStatus { diff --git a/crates/iota-sdk-types/src/effects/v1.rs b/crates/iota-sdk-types/src/effects/v1.rs index d1435eaca..792739ffd 100644 --- a/crates/iota-sdk-types/src/effects/v1.rs +++ b/crates/iota-sdk-types/src/effects/v1.rs @@ -31,7 +31,6 @@ use crate::{ #[derive(Eq, PartialEq, Clone, Debug)] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct TransactionEffectsV1 { /// The status of the execution #[cfg_attr(feature = "schemars", schemars(flatten))] @@ -96,7 +95,6 @@ pub struct TransactionEffectsV1 { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct ChangedObject { /// Id of the object pub object_id: ObjectId, @@ -129,7 +127,6 @@ pub struct ChangedObject { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct UnchangedSharedObject { pub object_id: ObjectId, pub kind: UnchangedSharedKind, @@ -161,7 +158,6 @@ pub struct UnchangedSharedObject { schemars(tag = "kind", rename_all = "snake_case") )] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] pub enum UnchangedSharedKind { /// Read-only shared objects from the input. We don't really need /// ObjectDigest for protocol correctness, but it will make it easier to @@ -216,7 +212,6 @@ pub enum UnchangedSharedKind { schemars(tag = "state", rename_all = "snake_case") )] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] pub enum ObjectIn { NotExist, @@ -252,7 +247,6 @@ pub enum ObjectIn { schemars(tag = "state", rename_all = "snake_case") )] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] pub enum ObjectOut { /// Same definition as in ObjectIn. NotExist, @@ -292,7 +286,6 @@ pub enum ObjectOut { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] pub enum IdOperation { None, Created, diff --git a/crates/iota-sdk-types/src/events.rs b/crates/iota-sdk-types/src/events.rs index bbcb455db..cdae3013b 100644 --- a/crates/iota-sdk-types/src/events.rs +++ b/crates/iota-sdk-types/src/events.rs @@ -38,7 +38,6 @@ pub struct TransactionEvents(pub Vec); )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct Event { /// Package id of the top-level function invoked by a MoveCall command which /// triggered this event to be emitted. diff --git a/crates/iota-sdk-types/src/execution_status.rs b/crates/iota-sdk-types/src/execution_status.rs index 88fe88d51..3e1f99933 100644 --- a/crates/iota-sdk-types/src/execution_status.rs +++ b/crates/iota-sdk-types/src/execution_status.rs @@ -17,7 +17,6 @@ use super::{Address, Digest, Identifier, ObjectId}; /// ``` #[derive(Eq, PartialEq, Clone, Debug)] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] pub enum ExecutionStatus { /// The Transaction successfully executed. Success, @@ -128,7 +127,6 @@ pub enum ExecutionStatus { schemars(tag = "error", rename_all = "snake_case") )] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] pub enum ExecutionError { // General transaction errors /// Insufficient Gas @@ -300,7 +298,6 @@ pub enum ExecutionError { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct MoveLocation { /// The package id pub package: ObjectId, @@ -359,7 +356,6 @@ pub struct MoveLocation { schemars(tag = "kind", rename_all = "snake_case") )] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] pub enum CommandArgumentError { /// The type of the value does not match the expected type TypeMismatch, @@ -433,7 +429,6 @@ pub enum CommandArgumentError { schemars(tag = "kind", rename_all = "snake_case") )] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] pub enum PackageUpgradeError { /// Unable to fetch package UnableToFetchPackage { package_id: ObjectId }, @@ -480,7 +475,6 @@ pub enum PackageUpgradeError { schemars(rename_all = "snake_case") )] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] pub enum TypeArgumentError { /// A type was not found in the module specified TypeNotFound, diff --git a/crates/iota-sdk-types/src/framework.rs b/crates/iota-sdk-types/src/framework.rs index 2d9b0bb97..87b65de3e 100644 --- a/crates/iota-sdk-types/src/framework.rs +++ b/crates/iota-sdk-types/src/framework.rs @@ -7,7 +7,6 @@ use super::{Object, ObjectId, TypeTag}; #[derive(Debug, Clone)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct Coin { coin_type: TypeTag, id: ObjectId, @@ -27,27 +26,47 @@ impl Coin { self.balance } - pub fn try_from_object(object: &Object) -> Option { + pub fn try_from_object(object: &Object) -> Result { match &object.data { super::ObjectData::Struct(move_struct) => { - let coin_type = move_struct.type_.is_coin()?; + let coin_type = move_struct + .type_ + .coin_type_opt() + .ok_or(CoinFromObjectError::NotACoin)?; let contents = &move_struct.contents; if contents.len() != ObjectId::LENGTH + std::mem::size_of::() { - return None; + return Err(CoinFromObjectError::InvalidContentLength); } let id = ObjectId::new((&contents[..ObjectId::LENGTH]).try_into().unwrap()); let balance = u64::from_le_bytes((&contents[ObjectId::LENGTH..]).try_into().unwrap()); - Some(Self { + Ok(Self { coin_type: coin_type.clone(), id, balance, }) } - _ => None, // package + _ => Err(CoinFromObjectError::NotACoin), // package } } } + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum CoinFromObjectError { + NotACoin, + InvalidContentLength, +} + +impl std::fmt::Display for CoinFromObjectError { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + match self { + CoinFromObjectError::NotACoin => write!(f, "not a coin"), + CoinFromObjectError::InvalidContentLength => write!(f, "invalid content length"), + } + } +} + +impl std::error::Error for CoinFromObjectError {} diff --git a/crates/iota-sdk-types/src/gas.rs b/crates/iota-sdk-types/src/gas.rs index d5b622543..7794a6387 100644 --- a/crates/iota-sdk-types/src/gas.rs +++ b/crates/iota-sdk-types/src/gas.rs @@ -45,7 +45,6 @@ )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct GasCostSummary { /// Cost of computation/execution #[cfg_attr(feature = "serde", serde(with = "crate::_serde::ReadableDisplay"))] diff --git a/crates/iota-sdk-types/src/lib.rs b/crates/iota-sdk-types/src/lib.rs index b19d9f2c2..8bff6d764 100644 --- a/crates/iota-sdk-types/src/lib.rs +++ b/crates/iota-sdk-types/src/lib.rs @@ -133,8 +133,8 @@ pub use checkpoint::{ }; pub use crypto::{ Bls12381PublicKey, Bls12381Signature, Bn254FieldElement, CircomG1, CircomG2, Ed25519PublicKey, - Ed25519Signature, Intent, IntentAppId, IntentScope, IntentVersion, Jwk, JwkId, - MultisigAggregatedSignature, MultisigCommittee, MultisigMember, MultisigMemberPublicKey, + Ed25519Signature, Intent, IntentAppId, IntentScope, IntentVersion, InvalidSignatureScheme, Jwk, + JwkId, MultisigAggregatedSignature, MultisigCommittee, MultisigMember, MultisigMemberPublicKey, MultisigMemberSignature, PasskeyAuthenticator, PasskeyPublicKey, Secp256k1PublicKey, Secp256k1Signature, Secp256r1PublicKey, Secp256r1Signature, SignatureScheme, SimpleSignature, UserSignature, ValidatorAggregatedSignature, ValidatorCommittee, ValidatorCommitteeMember, @@ -155,6 +155,7 @@ pub use execution_status::{ CommandArgumentError, ExecutionError, ExecutionStatus, MoveLocation, PackageUpgradeError, TypeArgumentError, }; +pub use framework::Coin; pub use gas::GasCostSummary; pub use object::{ GenesisObject, MovePackage, MoveStruct, Object, ObjectData, ObjectReference, ObjectType, Owner, @@ -166,7 +167,7 @@ pub use object_id::ObjectId; pub(crate) use transaction::SignedTransactionWithIntentMessage; pub use transaction::{ ActiveJwk, Argument, AuthenticatorStateExpire, AuthenticatorStateUpdateV1, - CancelledTransaction, ChangeEpoch, Command, ConsensusCommitPrologueV1, + CancelledTransaction, ChangeEpoch, ChangeEpochV2, Command, ConsensusCommitPrologueV1, ConsensusDeterminedVersionAssignments, EndOfEpochTransactionKind, ExecutionTimeObservationKey, ExecutionTimeObservations, GasPayment, GenesisTransaction, Input, MakeMoveVector, MergeCoins, MoveCall, ProgrammableTransaction, Publish, RandomnessStateUpdate, SenderSignedTransaction, @@ -176,30 +177,65 @@ pub use transaction::{ }; pub use type_tag::{Identifier, StructTag, TypeParseError, TypeTag}; -#[cfg(feature = "uniffi")] -uniffi::setup_scaffolding!(); - -#[cfg(test)] +#[cfg(all(test, feature = "serde", feature = "proptest"))] mod serialization_proptests; #[derive(Clone, Debug, PartialEq, Eq)] pub struct PersonalMessage<'a>(pub std::borrow::Cow<'a, [u8]>); -#[cfg(feature = "uniffi")] #[macro_export] -macro_rules! impl_uniffi_byte_vec_wrapper { - ($id:ident) => { - uniffi::custom_type!($id, Vec, { - lower: |val| val.as_bytes().to_vec(), - try_lift: |vec| Ok($id::from_bytes(vec)?), - }); +macro_rules! def_is { + ($($variant:ident),* $(,)?) => { + paste::paste! {$( + #[inline] + pub fn [< is_ $variant:snake >](&self) -> bool { + matches!(self, Self::$variant) + } + )*} }; } -#[cfg(not(feature = "uniffi"))] #[macro_export] -macro_rules! impl_uniffi_byte_vec_wrapper { - ($id:ident) => {}; +macro_rules! def_is_as_into_opt { + ($($variant:ident => $inner:ty),* $(,)?) => { + paste::paste! {$( + #[inline] + pub fn [< is_ $variant:snake >](&self) -> bool { + matches!(self, Self::$variant(_)) + } + + #[inline] + pub fn [< as_ $variant:snake >](&self) -> &$inner { + self.[< as_ $variant:snake _opt >]().expect(&format!("not a {}", stringify!($variant))) + } + + #[inline] + pub fn [< as_ $variant:snake _opt >](&self) -> Option<&$inner> { + if let Self::$variant(inner) = self { + Some(inner) + } else { + None + } + } + + #[inline] + pub fn [< into_ $variant:snake _opt >](self) -> Option<$inner> { + if let Self::$variant(inner) = self { + Some(inner) + } else { + None + } + } + + #[inline] + pub fn [< into_ $variant:snake >](self) -> $inner { + self.[< into_ $variant:snake _opt >]().expect(&format!("not a {}", stringify!($variant))) + } + )*} + }; + ($($variant:ident),* $(,)?) => { + $crate::def_is_as_into_opt!{$($variant => $variant,)*} + }; } #[cfg(feature = "serde")] diff --git a/crates/iota-sdk-types/src/object.rs b/crates/iota-sdk-types/src/object.rs index 6c555f936..ddb358029 100644 --- a/crates/iota-sdk-types/src/object.rs +++ b/crates/iota-sdk-types/src/object.rs @@ -26,7 +26,6 @@ pub type Version = u64; )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct ObjectReference { /// The object id of this object. object_id: ObjectId, @@ -101,7 +100,6 @@ impl ObjectReference { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] pub enum Owner { /// Object is exclusively owned by a single address, and is mutable. Address(Address), @@ -137,7 +135,6 @@ pub enum Owner { )] #[allow(clippy::large_enum_variant)] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] // TODO think about hiding this type and not exposing it pub enum ObjectData { /// An object whose governing logic lives in a published Move module @@ -148,12 +145,7 @@ pub enum ObjectData { } impl ObjectData { - pub fn as_package(self) -> MovePackage { - let Self::Package(p) = self else { - panic!("Not a package"); - }; - p - } + crate::def_is_as_into_opt!(Struct => MoveStruct, Package => MovePackage); } /// A move package @@ -221,34 +213,6 @@ pub struct MovePackage { pub linkage_table: BTreeMap, } -#[cfg(feature = "uniffi")] -#[derive(uniffi::Record)] -pub struct UniffiMovePackage { - id: ObjectId, - version: Version, - modules: std::collections::HashMap>, - type_origin_table: Vec, - linkage_table: std::collections::HashMap, -} - -#[cfg(feature = "uniffi")] -uniffi::custom_type!(MovePackage, UniffiMovePackage, { - lower: |mp| UniffiMovePackage { - id: mp.id, - version: mp.version, - modules: mp.modules.into_iter().collect(), - type_origin_table: mp.type_origin_table, - linkage_table: mp.linkage_table.into_iter().collect() - }, - try_lift: |ump| Ok(MovePackage { - id: ump.id, - version: ump.version, - modules: ump.modules.into_iter().collect(), - type_origin_table: ump.type_origin_table, - linkage_table: ump.linkage_table.into_iter().collect() - }), -}); - /// Identifies a struct and the module it was defined in /// /// # BCS @@ -265,7 +229,6 @@ uniffi::custom_type!(MovePackage, UniffiMovePackage, { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct TypeOrigin { pub module_name: Identifier, pub struct_name: Identifier, @@ -288,7 +251,6 @@ pub struct TypeOrigin { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct UpgradeInfo { /// Id of the upgraded packages pub upgraded_id: ObjectId, @@ -323,7 +285,6 @@ pub struct UpgradeInfo { derive(serde_derive::Serialize, serde_derive::Deserialize) )] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct MoveStruct { /// The type of this object #[cfg_attr( @@ -354,6 +315,12 @@ pub enum ObjectType { Struct(StructTag), } +impl ObjectType { + crate::def_is!(Package); + + crate::def_is_as_into_opt!(Struct => StructTag); +} + /// An object on the IOTA blockchain /// /// # BCS @@ -365,7 +332,6 @@ pub enum ObjectType { /// ``` #[derive(Clone, Debug, PartialEq, Eq)] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct Object { /// The meat of the object pub data: ObjectData, @@ -475,7 +441,6 @@ fn id_opt(contents: &[u8]) -> Option { /// ``` #[derive(Clone, Debug, PartialEq, Eq)] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct GenesisObject { pub data: ObjectData, pub owner: Owner, @@ -528,41 +493,6 @@ mod serialization { use super::*; use crate::TypeTag; - #[test] - fn obj() { - let o = Object { - data: ObjectData::Struct(MoveStruct { - type_: StructTag { - address: Address::TWO, - module: Identifier::new("bar").unwrap(), - name: Identifier::new("foo").unwrap(), - type_params: Vec::new(), - }, - version: 12, - contents: ObjectId::ZERO.into(), - }), - // owner: Owner::Address(Address::ZERO), - owner: Owner::Object(ObjectId::ZERO), - // owner: Owner::Immutable, - // owner: Owner::Shared { - // initial_shared_version: 14, - // }, - previous_transaction: TransactionDigest::ZERO, - storage_rebate: 100, - }; - - println!("{}", serde_json::to_string_pretty(&o).unwrap()); - println!( - "{}", - serde_json::to_string_pretty(&ObjectReference { - object_id: ObjectId::ZERO, - version: 1, - digest: ObjectDigest::ZERO, - }) - .unwrap() - ); - } - /// Wrapper around StructTag with a space-efficient representation for /// common types like coins The StructTag for a gas coin is 84 bytes, so /// using 1 byte instead is a win. The inner representation is private @@ -624,7 +554,7 @@ mod serialization { type_params, } = s; - if let Some(coin_type) = s.is_coin() { + if let Some(coin_type) = s.coin_type_opt() { if let TypeTag::Struct(s_inner) = coin_type { let StructTag { address, @@ -1048,8 +978,44 @@ mod serialization { #[cfg(target_arch = "wasm32")] use wasm_bindgen_test::wasm_bindgen_test as test; + use super::*; use crate::object::Object; + #[test] + fn obj() { + let o = Object { + data: ObjectData::Struct(MoveStruct { + type_: StructTag { + address: Address::TWO, + module: Identifier::new("bar").unwrap(), + name: Identifier::new("foo").unwrap(), + type_params: Vec::new(), + }, + version: 12, + contents: ObjectId::ZERO.into(), + }), + // owner: Owner::Address(Address::ZERO), + owner: Owner::Object(ObjectId::ZERO), + // owner: Owner::Immutable, + // owner: Owner::Shared { + // initial_shared_version: 14, + // }, + previous_transaction: TransactionDigest::ZERO, + storage_rebate: 100, + }; + + println!("{}", serde_json::to_string_pretty(&o).unwrap()); + println!( + "{}", + serde_json::to_string_pretty(&ObjectReference { + object_id: ObjectId::ZERO, + version: 1, + digest: ObjectDigest::ZERO, + }) + .unwrap() + ); + } + #[test] fn object_fixture() { const IOTA_COIN: &[u8] = &[ diff --git a/crates/iota-sdk-types/src/object_id.rs b/crates/iota-sdk-types/src/object_id.rs index 0c27f3ff9..2eaa3c554 100644 --- a/crates/iota-sdk-types/src/object_id.rs +++ b/crates/iota-sdk-types/src/object_id.rs @@ -31,9 +31,6 @@ use super::Address; #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] pub struct ObjectId(Address); -#[cfg(feature = "uniffi")] -uniffi::custom_type!(ObjectId, Address); - impl ObjectId { pub const LENGTH: usize = Address::LENGTH; pub const ZERO: Self = Self(Address::ZERO); diff --git a/crates/iota-sdk-types/src/transaction/fixtures/update-transaction-fixtures/src/main.rs b/crates/iota-sdk-types/src/transaction/fixtures/update-transaction-fixtures/src/main.rs index fe078f87e..3bde25b2b 100644 --- a/crates/iota-sdk-types/src/transaction/fixtures/update-transaction-fixtures/src/main.rs +++ b/crates/iota-sdk-types/src/transaction/fixtures/update-transaction-fixtures/src/main.rs @@ -22,7 +22,7 @@ use test_cluster::TestClusterBuilder; const BASE_PATH: &str = "../"; #[tokio::main] -async fn main() -> Result<(), anyhow::Error> { +async fn main() -> anyhow::Result<()> { let test_cluster = TestClusterBuilder::new().build().await; let client = test_cluster.wallet.get_client().await?; @@ -130,7 +130,7 @@ async fn main() -> Result<(), anyhow::Error> { // Write the tx data bytes base64 encoded to a file with the BASE_PATH before // the provided name -fn write_bs64_tx_to_file(tx_data_bytes: &[u8], name: &str) -> Result<(), anyhow::Error> { +fn write_bs64_tx_to_file(tx_data_bytes: &[u8], name: &str) -> anyhow::Result<()> { let mut f = OpenOptions::new() .create(true) .write(true) @@ -141,7 +141,7 @@ fn write_bs64_tx_to_file(tx_data_bytes: &[u8], name: &str) -> Result<(), anyhow: Ok(()) } -fn raw_tx_bytes_to_transaction_data_bytes(raw_tx_bytes: &[u8]) -> Result, anyhow::Error> { +fn raw_tx_bytes_to_transaction_data_bytes(raw_tx_bytes: &[u8]) -> anyhow::Result> { let sender_signed_data: SenderSignedData = bcs::from_bytes(raw_tx_bytes)?; let tx_data = sender_signed_data.transaction_data(); let tx_data_bytes = bcs::to_bytes(tx_data)?; diff --git a/crates/iota-sdk-types/src/transaction/mod.rs b/crates/iota-sdk-types/src/transaction/mod.rs index 8a7f83d80..ce722af18 100644 --- a/crates/iota-sdk-types/src/transaction/mod.rs +++ b/crates/iota-sdk-types/src/transaction/mod.rs @@ -28,7 +28,6 @@ pub(crate) use serialization::SignedTransactionWithIntentMessage; /// ``` #[derive(Clone, Debug, PartialEq, Eq)] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct Transaction { pub kind: TransactionKind, pub sender: Address, @@ -52,7 +51,6 @@ pub struct SenderSignedTransaction( )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct SignedTransaction { pub transaction: Transaction, pub signatures: Vec, @@ -70,7 +68,6 @@ pub struct SignedTransaction { /// ``` #[derive(Clone, Copy, Default, Debug, PartialEq, Eq, Hash)] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] pub enum TransactionExpiration { /// The transaction has no expiration #[default] @@ -100,7 +97,6 @@ pub enum TransactionExpiration { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct GasPayment { pub objects: Vec, @@ -137,7 +133,6 @@ pub struct GasPayment { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct RandomnessStateUpdate { /// Epoch of the randomness state update transaction #[cfg_attr(feature = "serde", serde(with = "crate::_serde::ReadableDisplay"))] @@ -182,7 +177,6 @@ pub struct RandomnessStateUpdate { /// ``` #[derive(Clone, Debug, PartialEq, Eq)] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] pub enum TransactionKind { /// A user transaction comprised of a list of native commands and move calls ProgrammableTransaction(ProgrammableTransaction), @@ -207,6 +201,20 @@ pub enum TransactionKind { RandomnessStateUpdate(RandomnessStateUpdate), } +impl TransactionKind { + crate::def_is_as_into_opt! { + ProgrammableTransaction, + ConsensusCommitPrologueV1, + AuthenticatorStateUpdateV1, + RandomnessStateUpdate, + } + + crate::def_is_as_into_opt! { + Genesis => GenesisTransaction, + EndOfEpoch => Vec, + } +} + /// Operation run at the end of an epoch /// /// # BCS @@ -239,7 +247,6 @@ pub enum TransactionKind { schemars(tag = "kind", rename_all = "snake_case") )] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] pub enum EndOfEpochTransactionKind { /// End the epoch and start the next one ChangeEpoch(ChangeEpoch), @@ -276,64 +283,21 @@ pub enum EndOfEpochTransactionKind { derive(serde_derive::Serialize, serde_derive::Deserialize) )] pub enum ExecutionTimeObservations { - V1( - Vec<( - ExecutionTimeObservationKey, - Vec, - )>, - ), -} - -#[cfg(feature = "uniffi")] -#[derive(uniffi::Enum)] -pub enum UniffiExecutionTimeObservations { - V1(Vec), -} - -#[cfg(feature = "uniffi")] -#[derive(uniffi::Record)] -pub struct UniffiExecutionTimeObservation { - key: ExecutionTimeObservationKey, - observations: Vec, -} - -#[cfg(feature = "uniffi")] -impl From for UniffiExecutionTimeObservations { - fn from(value: ExecutionTimeObservations) -> Self { - match value { - ExecutionTimeObservations::V1(v) => UniffiExecutionTimeObservations::V1( - v.into_iter() - .map(|v| UniffiExecutionTimeObservation { - key: v.0, - observations: v.1, - }) - .collect(), - ), - } - } + V1(Vec), } -#[cfg(feature = "uniffi")] -impl From for ExecutionTimeObservations { - fn from(value: UniffiExecutionTimeObservations) -> Self { - match value { - UniffiExecutionTimeObservations::V1(v) => ExecutionTimeObservations::V1( - v.into_iter().map(|v| (v.key, v.observations)).collect(), - ), - } - } +#[derive(Debug, Hash, PartialEq, Eq, Clone)] +#[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] +#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] +#[cfg_attr( + feature = "serde", + derive(serde_derive::Serialize, serde_derive::Deserialize) +)] +pub struct ExecutionTimeObservation { + pub key: ExecutionTimeObservationKey, + pub observations: Vec, } -#[cfg(feature = "uniffi")] -uniffi::custom_type!( - ExecutionTimeObservations, - UniffiExecutionTimeObservations, - { - lower: |ob| ob.into(), - try_lift: |ob| Ok(ob.into()), - } -); - /// An execution time observation from a particular validator /// /// # BCS @@ -352,7 +316,6 @@ uniffi::custom_type!( feature = "serde", derive(serde_derive::Serialize, serde_derive::Deserialize) )] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct ValidatorExecutionTimeObservation { pub validator: crate::Bls12381PublicKey, pub duration: std::time::Duration, @@ -382,7 +345,6 @@ pub struct ValidatorExecutionTimeObservation { feature = "serde", derive(serde_derive::Serialize, serde_derive::Deserialize) )] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] pub enum ExecutionTimeObservationKey { // Containts all the fields from `ProgrammableMoveCall` besides `arguments`. MoveEntryPoint { @@ -420,7 +382,6 @@ pub enum ExecutionTimeObservationKey { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct AuthenticatorStateExpire { /// expire JWKs that have a lower epoch than this #[cfg_attr(feature = "serde", serde(with = "crate::_serde::ReadableDisplay"))] @@ -452,7 +413,6 @@ pub struct AuthenticatorStateExpire { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct AuthenticatorStateUpdateV1 { /// Epoch of the authenticator state update transaction #[cfg_attr(feature = "serde", serde(with = "crate::_serde::ReadableDisplay"))] @@ -489,7 +449,6 @@ pub struct AuthenticatorStateUpdateV1 { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct ActiveJwk { /// Identifier used to uniquely identify a Jwk pub jwk_id: JwkId, @@ -510,7 +469,6 @@ pub struct ActiveJwk { schemars(tag = "kind", rename_all = "snake_case") )] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] pub enum ConsensusDeterminedVersionAssignments { /// Cancelled transaction version assignment. CancelledTransactions { @@ -535,7 +493,6 @@ pub enum ConsensusDeterminedVersionAssignments { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct CancelledTransaction { pub digest: TransactionDigest, #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=2).lift()))] @@ -558,7 +515,6 @@ pub struct CancelledTransaction { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct VersionAssignment { pub object_id: ObjectId, #[cfg_attr(feature = "serde", serde(with = "crate::_serde::ReadableDisplay"))] @@ -583,7 +539,6 @@ pub struct VersionAssignment { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct ConsensusCommitPrologueV1 { /// Epoch of the commit prologue transaction #[cfg_attr(feature = "serde", serde(with = "crate::_serde::ReadableDisplay"))] @@ -639,7 +594,6 @@ pub struct ConsensusCommitPrologueV1 { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct ChangeEpoch { /// The next (to become) epoch ID. #[cfg_attr(feature = "serde", serde(with = "crate::_serde::ReadableDisplay"))] @@ -704,7 +658,6 @@ pub struct ChangeEpoch { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct ChangeEpochV2 { /// The next (to become) epoch ID. #[cfg_attr(feature = "serde", serde(with = "crate::_serde::ReadableDisplay"))] @@ -755,7 +708,6 @@ pub struct ChangeEpochV2 { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct SystemPackage { #[cfg_attr(feature = "serde", serde(with = "crate::_serde::ReadableDisplay"))] #[cfg_attr(feature = "schemars", schemars(with = "crate::_schemars::U64"))] @@ -788,7 +740,6 @@ pub struct SystemPackage { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct GenesisTransaction { #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=2).lift()))] pub objects: Vec, @@ -815,7 +766,6 @@ pub struct GenesisTransaction { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct ProgrammableTransaction { /// Input objects or primitive values #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=10).lift()))] @@ -848,7 +798,6 @@ pub struct ProgrammableTransaction { schemars(tag = "type", rename_all = "snake_case") )] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] pub enum Input { /// A move value serialized as BCS. /// @@ -908,7 +857,6 @@ pub enum Input { schemars(tag = "command", rename_all = "snake_case") )] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] pub enum Command { /// A call to either an entry or a public Move function MoveCall(MoveCall), @@ -963,7 +911,6 @@ pub enum Command { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct TransferObjects { /// Set of objects to transfer #[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=2).lift()))] @@ -989,7 +936,6 @@ pub struct TransferObjects { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct SplitCoins { /// The coin to split pub coin: Argument, @@ -1015,7 +961,6 @@ pub struct SplitCoins { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct MergeCoins { /// Coin to merge coins into pub coin: Argument, @@ -1044,7 +989,6 @@ pub struct MergeCoins { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct Publish { /// The serialized move modules #[cfg_attr( @@ -1076,7 +1020,6 @@ pub struct Publish { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct MakeMoveVector { /// Type of the individual elements /// @@ -1109,7 +1052,6 @@ pub struct MakeMoveVector { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct Upgrade { /// The serialized move modules #[cfg_attr( @@ -1150,7 +1092,6 @@ pub struct Upgrade { /// ``` #[derive(Clone, Copy, Debug, PartialEq, Eq)] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] pub enum Argument { /// The gas coin. The gas coin can only be used by-ref, except for with /// `TransferObjects`, which can use it by-value. @@ -1205,7 +1146,6 @@ impl Argument { )] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] pub struct MoveCall { /// The package containing the module and function. pub package: ObjectId, diff --git a/crates/iota-sdk-types/src/type_tag/mod.rs b/crates/iota-sdk-types/src/type_tag/mod.rs index c740cc496..9b3e513b0 100644 --- a/crates/iota-sdk-types/src/type_tag/mod.rs +++ b/crates/iota-sdk-types/src/type_tag/mod.rs @@ -42,7 +42,6 @@ use super::Address; /// type-tag-struct = %x07 struct-tag /// ``` #[derive(Eq, PartialEq, PartialOrd, Ord, Debug, Clone, Hash)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] pub enum TypeTag { U8, @@ -59,23 +58,101 @@ pub enum TypeTag { Struct(Box), } -#[cfg(feature = "uniffi")] -pub type BoxedTypeTag = Box; +impl TypeTag { + crate::def_is!(U8, U16, U32, U64, U128, U256, Bool, Address, Signer); -#[cfg(feature = "uniffi")] -uniffi::custom_type!(BoxedTypeTag, TypeTag, { - lower: |btt| *btt, - try_lift: |tt| Ok(Box::new(tt)), -}); + pub fn is_vector_type(&self) -> bool { + matches!(self, Self::Vector(_)) + } + + pub fn as_vector_type_opt(&self) -> Option<&TypeTag> { + if let Self::Vector(inner) = self { + Some(inner) + } else { + None + } + } + + pub fn as_vector_type(&self) -> &TypeTag { + self.as_vector_type_opt().expect("not a Vector") + } + + pub fn into_vector_type_opt(self) -> Option { + if let Self::Vector(inner) = self { + Some(*inner) + } else { + None + } + } + + pub fn into_vector_type(self) -> TypeTag { + self.into_vector_type_opt().expect("not a Vector type") + } + + pub fn is_struct(&self) -> bool { + matches!(self, Self::Struct(_)) + } + + pub fn as_struct_tag_opt(&self) -> Option<&StructTag> { + if let Self::Struct(inner) = self { + Some(inner) + } else { + None + } + } -#[cfg(feature = "uniffi")] -pub type BoxedStructTag = Box; + pub fn as_struct_tag(&self) -> &StructTag { + self.as_struct_tag_opt().expect("not a Struct") + } -#[cfg(feature = "uniffi")] -uniffi::custom_type!(BoxedStructTag, StructTag, { - lower: |btt| *btt, - try_lift: |tt| Ok(Box::new(tt)), -}); + pub fn into_struct_tag_opt(self) -> Option { + if let Self::Struct(inner) = self { + Some(*inner) + } else { + None + } + } + + pub fn into_struct_tag(self) -> StructTag { + self.into_struct_tag_opt().expect("not a Struct") + } + + pub fn u8() -> Self { + Self::U8 + } + + pub fn u16() -> Self { + Self::U16 + } + + pub fn u32() -> Self { + Self::U32 + } + + pub fn u64() -> Self { + Self::U64 + } + + pub fn u128() -> Self { + Self::U128 + } + + pub fn u256() -> Self { + Self::U256 + } + + pub fn bool() -> Self { + Self::Bool + } + + pub fn address() -> Self { + Self::Address + } + + pub fn signer() -> Self { + Self::Signer + } +} impl std::fmt::Display for TypeTag { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { @@ -150,12 +227,6 @@ pub struct Identifier( Box, ); -#[cfg(feature = "uniffi")] -uniffi::custom_type!(Identifier, String, { - lower: |id| id.0.into(), - try_lift: |s| Ok(Identifier::new(s)?), -}); - impl Identifier { pub fn new(identifier: impl AsRef) -> Result { parse::parse_identifier(identifier.as_ref()) @@ -209,7 +280,6 @@ impl PartialEq for Identifier { /// (vector type-tag) ; type parameters /// ``` #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] -#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] #[cfg_attr(feature = "proptest", derive(test_strategy::Arbitrary))] pub struct StructTag { pub address: Address, @@ -220,17 +290,6 @@ pub struct StructTag { } impl StructTag { - pub fn gas_coin() -> Self { - let iota = Self { - address: Address::TWO, - module: Identifier::new("iota").unwrap(), - name: Identifier::new("IOTA").unwrap(), - type_params: vec![], - }; - - Self::coin(TypeTag::Struct(Box::new(iota))) - } - pub fn coin(type_tag: TypeTag) -> Self { Self { address: Address::TWO, @@ -240,17 +299,8 @@ impl StructTag { } } - pub fn staked_iota() -> Self { - Self { - address: Address::THREE, - module: Identifier::new("staking_pool").unwrap(), - name: Identifier::new("StakedIota").unwrap(), - type_params: vec![], - } - } - /// Checks if this is a Coin type - pub fn is_coin(&self) -> Option<&TypeTag> { + pub fn coin_type_opt(&self) -> Option<&crate::TypeTag> { let Self { address, module, @@ -265,6 +315,35 @@ impl StructTag { None } } + + /// Checks if this is a Coin type + pub fn coin_type(&self) -> &TypeTag { + self.coin_type_opt().expect("not a coin") + } + + pub fn gas_coin() -> Self { + let iota = Self { + address: Address::TWO, + module: Identifier::new("iota").unwrap(), + name: Identifier::new("IOTA").unwrap(), + type_params: vec![], + }; + + Self::coin(TypeTag::Struct(Box::new(iota))) + } + + pub fn staked_iota() -> Self { + Self { + address: Address::THREE, + module: Identifier::new("staking_pool").unwrap(), + name: Identifier::new("StakedIota").unwrap(), + type_params: vec![], + } + } + + pub fn address(&self) -> Address { + self.address + } } impl std::fmt::Display for StructTag { diff --git a/crates/iota-transaction-builder/src/lib.rs b/crates/iota-transaction-builder/src/lib.rs index 4a2c8ad8e..b35b6783b 100644 --- a/crates/iota-transaction-builder/src/lib.rs +++ b/crates/iota-transaction-builder/src/lib.rs @@ -481,8 +481,9 @@ mod tests { use base64ct::Encoding; use iota_crypto::{IotaSigner, ed25519::Ed25519PrivateKey}; use iota_graphql_client::{ - Client, PaginationFilter, + Client, faucet::{CoinInfo, FaucetClient}, + pagination::PaginationFilter, }; use iota_types::{ Address, ExecutionStatus, IdOperation, ObjectId, ObjectType, TransactionDigest, @@ -577,7 +578,7 @@ mod tests { let gas = coins.last().unwrap().id; // TODO when we have tx resolution, we can just pass an ObjectId - let gas_obj: Input = (&client.object(gas.into(), None).await.unwrap().unwrap()).into(); + let gas_obj: Input = (&client.object(gas, None).await.unwrap().unwrap()).into(); tx.add_gas_objects(vec![gas_obj.with_owned_kind()]); tx.set_gas_budget(500000000); tx.set_gas_price(1000); @@ -658,7 +659,7 @@ mod tests { // get the object information from the client let client = Client::new_localhost(); let first = coins.first().unwrap().id; - let coin: Input = (&client.object(first.into(), None).await.unwrap().unwrap()).into(); + let coin: Input = (&client.object(first, None).await.unwrap().unwrap()).into(); let coin_input = tx.input(coin.with_owned_kind()); let recipient = Address::generate(rand::thread_rng()); let recipient_input = tx.input(Serialized(&recipient)); @@ -667,7 +668,7 @@ mod tests { let tx = tx.finish().unwrap(); let sig = pk.sign_transaction(&tx).unwrap(); - let effects = client.execute_tx(vec![sig], &tx).await; + let effects = client.execute_tx(&[sig], &tx).await; wait_for_tx_and_check_effects_status_success(&client, tx.digest(), effects).await; // check that recipient has 1 coin @@ -697,7 +698,7 @@ mod tests { let tx = tx.finish().unwrap(); let sig = pk.sign_transaction(&tx).unwrap(); - let effects = client.execute_tx(vec![sig], &tx).await; + let effects = client.execute_tx(&[sig], &tx).await; wait_for_tx_and_check_effects_status_success(&client, tx.digest(), effects).await; } @@ -717,7 +718,7 @@ mod tests { let tx = tx.finish().unwrap(); let sig = pk.sign_transaction(&tx).unwrap(); - let effects = client.execute_tx(vec![sig], &tx).await; + let effects = client.execute_tx(&[sig], &tx).await; wait_for_tx_and_check_effects_status_success(&client, tx.digest(), effects).await; // check that recipient has 1 coin @@ -735,7 +736,7 @@ mod tests { let (_, pk, coins) = helper_setup(&mut tx, &client).await; let coin = coins.first().unwrap().id; - let coin_obj: Input = (&client.object(coin.into(), None).await.unwrap().unwrap()).into(); + let coin_obj: Input = (&client.object(coin, None).await.unwrap().unwrap()).into(); let coin_input = tx.input(coin_obj.with_owned_kind()); // transfer 1 IOTA @@ -745,7 +746,7 @@ mod tests { let tx = tx.finish().unwrap(); let sig = pk.sign_transaction(&tx).unwrap(); - let effects = client.execute_tx(vec![sig], &tx).await; + let effects = client.execute_tx(&[sig], &tx).await; assert!(effects.is_ok()); // wait for the transaction to be finalized @@ -769,13 +770,13 @@ mod tests { let (address, pk, coins) = helper_setup(&mut tx, &client).await; let coin1 = coins.first().unwrap().id; - let coin1_obj: Input = (&client.object(coin1.into(), None).await.unwrap().unwrap()).into(); + let coin1_obj: Input = (&client.object(coin1, None).await.unwrap().unwrap()).into(); let coin_to_merge = tx.input(coin1_obj.with_owned_kind()); let mut coins_to_merge = vec![]; // last coin is used for gas, first coin is the one we merge into for c in coins[1..&coins.len() - 1].iter() { - let coin: Input = (&client.object(c.id.into(), None).await.unwrap().unwrap()).into(); + let coin: Input = (&client.object(c.id, None).await.unwrap().unwrap()).into(); coins_to_merge.push(tx.input(coin.with_owned_kind())); } @@ -783,7 +784,7 @@ mod tests { let tx = tx.finish().unwrap(); let sig = pk.sign_transaction(&tx).unwrap(); - let effects = client.execute_tx(vec![sig], &tx).await; + let effects = client.execute_tx(&[sig], &tx).await; wait_for_tx_and_check_effects_status_success(&client, tx.digest(), effects).await; // check that there are two coins @@ -806,7 +807,7 @@ mod tests { let tx = tx.finish().unwrap(); let sig = pk.sign_transaction(&tx).unwrap(); - let effects = client.execute_tx(vec![sig], &tx).await; + let effects = client.execute_tx(&[sig], &tx).await; wait_for_tx_and_check_effects_status_success(&client, tx.digest(), effects).await; } @@ -822,7 +823,7 @@ mod tests { tx.transfer_objects(vec![upgrade_cap], sender); let tx = tx.finish().unwrap(); let sig = pk.sign_transaction(&tx).unwrap(); - let effects = client.execute_tx(vec![sig], &tx).await; + let effects = client.execute_tx(&[sig], &tx).await; wait_for_tx_and_check_effects_status_success(&client, tx.digest(), effects).await; } @@ -838,7 +839,7 @@ mod tests { tx.transfer_objects(vec![upgrade_cap], sender); let tx = tx.finish().unwrap(); let sig = pk.sign_transaction(&tx).unwrap(); - let effects = client.execute_tx(vec![sig], &tx).await; + let effects = client.execute_tx(&[sig], &tx).await; let mut package_id: Option = None; let mut created_objs = vec![]; if let Ok(Some(ref effects)) = effects { @@ -866,7 +867,7 @@ mod tests { let mut tx = TransactionBuilder::new(); let mut upgrade_cap = None; for o in created_objs { - let obj = client.object(*o.as_address(), None).await.unwrap().unwrap(); + let obj = client.object(o, None).await.unwrap().unwrap(); match obj.object_type() { ObjectType::Struct(x) if x.name.to_string() == "UpgradeCap" => { match obj.owner() { @@ -925,14 +926,14 @@ mod tests { ); let gas = coins.last().unwrap().id; - let gas_obj: Input = (&client.object(gas.into(), None).await.unwrap().unwrap()).into(); + let gas_obj: Input = (&client.object(gas, None).await.unwrap().unwrap()).into(); tx.add_gas_objects(vec![gas_obj.with_owned_kind()]); tx.set_gas_budget(500000000); tx.set_gas_price(1000); tx.set_sender(address); let tx = tx.finish().unwrap(); let sig = pk.sign_transaction(&tx).unwrap(); - let effects = client.execute_tx(vec![sig], &tx).await; + let effects = client.execute_tx(&[sig], &tx).await; wait_for_tx_and_check_effects_status_success(&client, tx.digest(), effects).await; } }