Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feat/identity-rebased-alpha' int…
Browse files Browse the repository at this point in the history
…o feat/ts-move-calls
  • Loading branch information
UMR1352 committed Jan 23, 2025
2 parents e7cc1ff + ca1e3f2 commit 5c0bf24
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
4 changes: 4 additions & 0 deletions bindings/wasm/identity_wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,7 @@ empty_docs = "allow"
[features]
default = ["dummy-client"]
dummy-client = ["dep:iota_interaction_ts"]
# As identity_iota::resolver is currently not available for wasm32 this temporary flag is used
# to switch of all code depending on identity_iota::resolver
# TODO: Remove this feature flag after identity_iota::resolver is available for wasm32 platforms
wasm-resolver = []
2 changes: 2 additions & 0 deletions bindings/wasm/identity_wasm/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

use identity_iota::credential::CompoundJwtPresentationValidationError;
#[cfg(feature = "wasm-resolver")]
use identity_iota::resolver;
use identity_iota::storage::key_id_storage::KeyIdStorageError;
use identity_iota::storage::key_id_storage::KeyIdStorageErrorKind;
Expand Down Expand Up @@ -158,6 +159,7 @@ impl<'a, E: std::error::Error> Display for ErrorMessage<'a, E> {
}
}

#[cfg(feature = "wasm-resolver")]
impl From<resolver::Error> for WasmError<'_> {
fn from(error: resolver::Error) -> Self {
Self {
Expand Down
1 change: 1 addition & 0 deletions bindings/wasm/identity_wasm/src/resolver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

mod resolver_config;
mod resolver_types;
#[cfg(feature = "wasm-resolver")]
mod wasm_resolver;

pub use resolver_types::*;
2 changes: 1 addition & 1 deletion bindings/wasm/iota_interaction_ts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ js-sys = { version = "0.3.61" }
secret-storage = { git = "https://github.com/iotaledger/secret-storage.git", default-features = false, tag = "v0.1.0" }
serde = { version = "1.0", features = ["derive"] }
serde-wasm-bindgen = "0.6.5"
serde_json.workspace = true
serde_json = { version = "1.0", default-features = false }
thiserror.workspace = true
tsify = "0.4.5"
wasm-bindgen = { version = "=0.2.93", features = ["serde-serialize"] }
Expand Down
2 changes: 1 addition & 1 deletion bindings/wasm/iota_interaction_ts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ cfg_if::cfg_if! {
#[allow(unused_imports)] pub use error::TsSdkError as AdapterError;
#[allow(unused_imports)] pub use bindings::IotaTransactionBlockResponseAdapter as AdapterNativeResponse;

#[allow(unused_imports)] pub use transaction_builder::NativeTsCodeBindingWrapper;
#[allow(unused_imports)] pub use transaction_builder::NativeTsTransactionBuilderBindingWrapper;

#[allow(unused_imports)] pub use bindings::ProgrammableTransaction;
}
Expand Down
10 changes: 5 additions & 5 deletions bindings/wasm/iota_interaction_ts/src/transaction_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ use crate::error::TsSdkError;
use identity_iota_interaction::ProgrammableTransactionBcs;
use identity_iota_interaction::TransactionBuilderT;

pub type NativeTsCodeBindingWrapper = WasmTransactionBuilder;
pub type NativeTsTransactionBuilderBindingWrapper = WasmTransactionBuilder;

pub struct TransactionBuilderTsSdk {
pub(crate) builder: NativeTsCodeBindingWrapper,
pub(crate) builder: NativeTsTransactionBuilderBindingWrapper,
}

impl TransactionBuilderTsSdk {
pub fn new(builder: NativeTsCodeBindingWrapper) -> Self {
pub fn new(builder: NativeTsTransactionBuilderBindingWrapper) -> Self {
TransactionBuilderTsSdk { builder }
}
}

impl TransactionBuilderT for TransactionBuilderTsSdk {
type Error = TsSdkError;
type NativeTxBuilder = NativeTsCodeBindingWrapper;
type NativeTxBuilder = NativeTsTransactionBuilderBindingWrapper;

fn finish(self) -> Result<ProgrammableTransactionBcs, TsSdkError> {
unimplemented!();
Expand All @@ -45,7 +45,7 @@ impl Default for TransactionBuilderTsSdk {
}

impl Deref for TransactionBuilderTsSdk {
type Target = NativeTsCodeBindingWrapper;
type Target = NativeTsTransactionBuilderBindingWrapper;

fn deref(&self) -> &Self::Target {
&self.builder
Expand Down

0 comments on commit 5c0bf24

Please sign in to comment.