Skip to content

WASM32 - Redesign crate architecture to remove new generic params from IdentityClient #1441

Closed
@chrisgitiota

Description

@chrisgitiota

Context

During the WASM32-Binding development, generic parameters have been introduced on the wasm32-develop branch to abstract away platform specific adapter types used in our platform agnostic Identity code.

Example: IdentityClient<S, C: Clone, M: Send> where the generic parameter M abstracts away the platform specific AssetMoveCalls or IdentityMoveCalls.

These generic parameters have been introduced to avoid circular dependencies. The new generic parameters led to several new problems with Send and Sync trait constraints. We needed to address these problems by feature switches which increased code complexity and efforts a lot.

Task Description

The dependency structure between the Identity crates needs to be redesigned so that circular dependencies can be avoided without the need for generic parameters.

Following modules need to be located in new or existing crates:

  • identity_iota_interaction
    Formerly known as iota_sdk_abstraction. Trait definitions and a wasm32 compatible subset of code, copied from IOTA Client Rust SDK, used to replace the IOTA Client Rust SDK for wasm32 builds.

  • iota_interaction_ts
    Formerly known as ts_sdk_adapter. Imports Typescript IOTA Client SDK types using wasm-bindgen generated wasm bindings
    and implements identity_iota_interaction traits (among others, IotaClient and MoveCall traits) for wasm32 platforms.

  • iota_interaction_rust
    Formerly known as rust_sdk_adapter. Implements identity_iota_interaction traits for the NON wasm32 platforms using the IOTA Client Rust SDK

  • identity_iota_core/src/rebased
    Implements the IdentityClient for IOTA Rebased using iota_interaction_rust or iota_interaction_ts depending on the build platform

  • identity_wasm
    Exports the IdentityClient to Typescript using wasm-bindgen generated wasm bindings

Following diagram visualizes a proposed structure for the Identity crates and folders. The structure needs to be discussed before starting this task:


The folder structure to locate the above shown crates and folders, would look like this:

  • bindings
    • wasm
      • identity_wasm - Crate
        Contains the existing identity_wasm crate currently located in bindings/wasm.
      • iota_interaction_ts - Crate
  • identity_iota_interaction - Crate
    The import path inside the identity_iota_core::rebased module would be 'identity_iota::iota_interaction'.
  • identity_iota_core - Crate
    • src
      • rebased
        The import path for the iota_interaction_rust resp. iota_interaction_ts would be 'crate::iota_interaction_adapter'.
        The import path for the IOTA Client Rust SDK resp. identity_iota_interaction would be 'identity_iota::iota_interaction'.
      • iota_interaction_rust
        There would be no new crate for iota_interaction_rust.
        The folder iota_interaction_rust contains the adapter code as described above.
        The module is not accesses directly but via the iota_interaction_adapter (see below.)
      • iota_interaction_adapter.rs
        Contains platform specific compile switches, managing the import module paths for iota_interaction_rust and iota_interaction_ts.

Metadata

Metadata

Assignees

Labels

RustRelated to the core Rust code. Becomes part of the Rust changelog.WasmRelated to Wasm bindings. Becomes part of the Wasm changelog

Type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions