Skip to main content

iota_types/account_abstraction/
account.rs

1// Copyright (c) 2026 IOTA Stiftung
2// SPDX-License-Identifier: Apache-2.0
3
4use iota_sdk_types::{Address, Identifier, StructTag};
5use serde::{Deserialize, Serialize};
6
7pub const ACCOUNT_MODULE_NAME: Identifier = Identifier::from_static("account");
8pub const AUTHENTICATOR_FUNCTION_REF_V1_KEY_STRUCT_NAME: Identifier =
9    Identifier::from_static("AuthenticatorFunctionRefV1Key");
10
11#[derive(Debug, Default, Serialize, Deserialize, Clone, Eq, PartialEq)]
12pub struct AuthenticatorFunctionRefV1Key {
13    // This field is required to make a Rust struct compatible with an empty Move one.
14    // An empty Move struct contains a 1-byte dummy bool field because empty fields are not
15    // allowed in the bytecode.
16    dummy_field: bool,
17}
18
19impl AuthenticatorFunctionRefV1Key {
20    pub fn tag() -> StructTag {
21        StructTag::new(
22            Address::FRAMEWORK,
23            ACCOUNT_MODULE_NAME,
24            AUTHENTICATOR_FUNCTION_REF_V1_KEY_STRUCT_NAME,
25            Vec::new(),
26        )
27    }
28
29    pub fn to_bcs_bytes(&self) -> Vec<u8> {
30        bcs::to_bytes(&self).unwrap()
31    }
32}