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