Skip to content

Commit

Permalink
Removed IntentFn adapters and fixed several issues reulting from last…
Browse files Browse the repository at this point in the history
… merged PR - identity_wasm rust toolchain set to "1.84.0"
  • Loading branch information
chrisgitiota committed Jan 16, 2025
1 parent 21978e2 commit a1c72de
Show file tree
Hide file tree
Showing 15 changed files with 783 additions and 491 deletions.
2 changes: 1 addition & 1 deletion bindings/wasm/identity_wasm/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
channel = "1.81.0"
channel = "1.84.0"
components = ["rustfmt"]
targets = ["wasm32-unknown-unknown"]
profile = "minimal"
5 changes: 0 additions & 5 deletions bindings/wasm/iota_interaction_ts/rust-toolchain.toml

This file was deleted.

43 changes: 38 additions & 5 deletions bindings/wasm/iota_interaction_ts/src/identity_move_calls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ use identity_iota_interaction::types::base_types::ObjectRef;
use identity_iota_interaction::types::base_types::SequenceNumber;
use identity_iota_interaction::types::transaction::Argument;
use identity_iota_interaction::types::TypeTag;
use identity_iota_interaction::BorrowIntentFnT;
use identity_iota_interaction::ControllerIntentFnT;
use identity_iota_interaction::BorrowIntentFnInternalT;
use identity_iota_interaction::ControllerIntentFnInternalT;
use identity_iota_interaction::IdentityMoveCalls;
use identity_iota_interaction::MoveType;
use identity_iota_interaction::ProgrammableTransactionBcs;
Expand All @@ -36,7 +36,7 @@ impl IdentityMoveCalls for IdentityMoveCallsTsSdk {
todo!()
}

fn execute_borrow<F: BorrowIntentFnT<Self::Error, Self::NativeTxBuilder>>(
fn execute_borrow<F: BorrowIntentFnInternalT<Self::NativeTxBuilder>>(
identity: OwnedObjectRef,
capability: ObjectRef,
proposal_id: ObjectID,
Expand All @@ -47,6 +47,15 @@ impl IdentityMoveCalls for IdentityMoveCallsTsSdk {
todo!()
}

fn create_and_execute_borrow<F: BorrowIntentFnInternalT<Self::NativeTxBuilder>>(
identity: OwnedObjectRef,
capability: ObjectRef,
objects: Vec<IotaObjectData>,
intent_fn: F,
expiration: Option<u64>,
package_id: ObjectID,
) -> anyhow::Result<ProgrammableTransactionBcs, Self::Error> { todo!() }

fn propose_config_change<I1, I2>(
identity: OwnedObjectRef,
controller_cap: ObjectRef,
Expand Down Expand Up @@ -83,14 +92,29 @@ impl IdentityMoveCalls for IdentityMoveCallsTsSdk {
todo!()
}

fn execute_controller_execution<F: ControllerIntentFnT<Self::Error, Self::NativeTxBuilder>>(
fn execute_controller_execution<F: ControllerIntentFnInternalT<Self::NativeTxBuilder>>(
identity: OwnedObjectRef,
capability: ObjectRef,
proposal_id: ObjectID,
borrowing_controller_cap_ref: ObjectRef,
intent_fn: F,
package: ObjectID,
) -> Result<ProgrammableTransactionBcs, Self::Error> {
) -> Result<ProgrammableTransactionBcs, Self::Error>
{
todo!()
}

fn create_and_execute_controller_execution<F>(
identity: OwnedObjectRef,
capability: ObjectRef,
expiration: Option<u64>,
borrowing_controller_cap_ref: ObjectRef,
intent_fn: F,
package_id: ObjectID,
) -> Result<ProgrammableTransactionBcs, Self::Error>
where
F: ControllerIntentFnInternalT<Self::NativeTxBuilder>
{
todo!()
}

Expand Down Expand Up @@ -144,6 +168,15 @@ impl IdentityMoveCalls for IdentityMoveCallsTsSdk {
todo!()
}

fn create_and_execute_send(
identity: OwnedObjectRef,
capability: ObjectRef,
transfer_map: Vec<(ObjectID, IotaAddress)>,
expiration: Option<u64>,
objects: Vec<(ObjectRef, TypeTag)>,
package: ObjectID,
) -> anyhow::Result<ProgrammableTransactionBcs, Self::Error> { todo!() }

fn execute_send(
identity: OwnedObjectRef,
capability: ObjectRef,
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
14 changes: 9 additions & 5 deletions bindings/wasm/iota_interaction_ts/src/transaction_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,25 @@ use crate::error::TsSdkError;
use identity_iota_interaction::ProgrammableTransactionBcs;
use identity_iota_interaction::TransactionBuilderT;

pub type NativeTsCodeBindingWrapper = ();
// TODO: When the rust type wrapping the native TS transaction-builder has been
// developed, replace the NativeTsTransactionBuilderBindingWrapper type
// with the final type name (NativeTsTransactionBuilderBindingWrapper is
// also imported in identity_iota_core/src/rebased/...)
pub type NativeTsTransactionBuilderBindingWrapper = ();

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 @@ -44,7 +48,7 @@ impl Default for TransactionBuilderTsSdk {
}

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

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

0 comments on commit a1c72de

Please sign in to comment.