Skip to content

Commit

Permalink
Some feat/ts-move-calls extensions (#1509)
Browse files Browse the repository at this point in the history
Remove npm dependency @iota/iota-sdk from iota_interaction_ts package.json and use @iota/iota.js instead
  • Loading branch information
chrisgitiota authored Jan 23, 2025
1 parent 5c0bf24 commit 0176037
Show file tree
Hide file tree
Showing 21 changed files with 34 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2020-2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { Transaction } from "@iota/iota-sdk/transactions";
import { Transaction } from "@iota/iota.js/transactions";

export function create(
inner_bytes: Uint8Array,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2020-2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { ObjectRef, Transaction } from "@iota/iota-sdk/transactions";
import { ObjectRef, Transaction } from "@iota/iota.js/transactions";

export function remove(
asset: ObjectRef,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright 2020-2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { SharedObjectRef } from "@iota/iota-sdk/dist/cjs/bcs/types";
import { ObjectRef, Transaction } from "@iota/iota-sdk/transactions";
import { SharedObjectRef } from "@iota/iota.js/dist/cjs/bcs/types";
import { ObjectRef, Transaction } from "@iota/iota.js/transactions";

export function transfer(
asset: ObjectRef,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2020-2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { ObjectRef, Transaction } from "@iota/iota-sdk/transactions";
import { ObjectRef, Transaction } from "@iota/iota.js/transactions";

export function update(
asset: ObjectRef,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright 2020-2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { SharedObjectRef } from "@iota/iota-sdk/dist/cjs/bcs/types";
import { IotaObjectData } from "@iota/iota-sdk/dist/cjs/client";
import { ObjectRef, Transaction, TransactionArgument } from "@iota/iota-sdk/transactions";
import { SharedObjectRef } from "@iota/iota.js/dist/cjs/bcs/types";
import { IotaObjectData } from "@iota/iota.js/dist/cjs/client";
import { ObjectRef, Transaction, TransactionArgument } from "@iota/iota.js/transactions";
import { getControllerDelegation, putBackDelegationToken } from "../utils";

export function proposeBorrow(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright 2020-2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { SharedObjectRef } from "@iota/iota-sdk/dist/cjs/bcs/types";
import { ObjectRef, Transaction } from "@iota/iota-sdk/transactions";
import { SharedObjectRef } from "@iota/iota.js/dist/cjs/bcs/types";
import { ObjectRef, Transaction } from "@iota/iota.js/transactions";
import { getControllerDelegation, putBackDelegationToken } from "../utils";

export function proposeConfigChange(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright 2020-2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { SharedObjectRef } from "@iota/iota-sdk/dist/cjs/bcs/types";
import { ObjectRef, Transaction, TransactionArgument } from "@iota/iota-sdk/transactions";
import { SharedObjectRef } from "@iota/iota.js/dist/cjs/bcs/types";
import { ObjectRef, Transaction, TransactionArgument } from "@iota/iota.js/transactions";
import { getControllerDelegation, putBackDelegationToken } from "../utils";

export function proposeControllerExecution(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2020-2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { Transaction } from "@iota/iota-sdk/transactions";
import { Transaction } from "@iota/iota.js/transactions";
import { getClockRef } from "../utils";

export function create(didDoc: Uint8Array, packageId: string): Promise<Uint8Array> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright 2020-2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { SharedObjectRef } from "@iota/iota-sdk/dist/cjs/bcs/types";
import { ObjectRef, Transaction } from "@iota/iota-sdk/transactions";
import { SharedObjectRef } from "@iota/iota.js/dist/cjs/bcs/types";
import { ObjectRef, Transaction } from "@iota/iota.js/transactions";
import { getClockRef, getControllerDelegation, putBackDelegationToken } from "../utils";

export function proposeDeactivation(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright 2020-2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { SharedObjectRef } from "@iota/iota-sdk/dist/cjs/bcs/types";
import { ObjectRef, Transaction } from "@iota/iota-sdk/transactions";
import { SharedObjectRef } from "@iota/iota.js/dist/cjs/bcs/types";
import { ObjectRef, Transaction } from "@iota/iota.js/transactions";
import { getControllerDelegation, putBackDelegationToken } from "../utils";

export function approve(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright 2020-2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { SharedObjectRef } from "@iota/iota-sdk/dist/cjs/bcs/types";
import { ObjectRef, Transaction } from "@iota/iota-sdk/transactions";
import { SharedObjectRef } from "@iota/iota.js/dist/cjs/bcs/types";
import { ObjectRef, Transaction } from "@iota/iota.js/transactions";
import { getControllerDelegation, putBackDelegationToken } from "../utils";

export function proposeSend(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright 2020-2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { SharedObjectRef } from "@iota/iota-sdk/dist/cjs/bcs/types";
import { ObjectRef, Transaction } from "@iota/iota-sdk/transactions";
import { SharedObjectRef } from "@iota/iota.js/dist/cjs/bcs/types";
import { ObjectRef, Transaction } from "@iota/iota.js/transactions";
import { getClockRef, getControllerDelegation, putBackDelegationToken } from "../utils";

export function proposeUpdate(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright 2020-2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { SharedObjectRef } from "@iota/iota-sdk/dist/cjs/bcs/types";
import { ObjectRef, Transaction } from "@iota/iota-sdk/transactions";
import { SharedObjectRef } from "@iota/iota.js/dist/cjs/bcs/types";
import { ObjectRef, Transaction } from "@iota/iota.js/transactions";

export function proposeUpgrade(
identity: SharedObjectRef,
Expand Down
4 changes: 2 additions & 2 deletions bindings/wasm/iota_interaction_ts/lib/move_calls/migration.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright 2020-2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { SharedObjectRef } from "@iota/iota-sdk/dist/cjs/bcs/types";
import { ObjectRef, Transaction } from "@iota/iota-sdk/transactions";
import { SharedObjectRef } from "@iota/iota.js/dist/cjs/bcs/types";
import { ObjectRef, Transaction } from "@iota/iota.js/transactions";
import { getClockRef } from "./utils";

export function migrateDidOutput(
Expand Down
4 changes: 2 additions & 2 deletions bindings/wasm/iota_interaction_ts/lib/move_calls/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Transaction, TransactionArgument, TransactionResult } from "@iota/iota-sdk/transactions";
import { IOTA_CLOCK_OBJECT_ID } from "@iota/iota-sdk/utils";
import { Transaction, TransactionArgument, TransactionResult } from "@iota/iota.js/transactions";
import { IOTA_CLOCK_OBJECT_ID } from "@iota/iota.js/utils";

export function getClockRef(tx: Transaction): TransactionArgument {
return tx.sharedObjectRef({ objectId: IOTA_CLOCK_OBJECT_ID, initialSharedVersion: 1, mutable: false });
Expand Down
1 change: 1 addition & 0 deletions bindings/wasm/iota_interaction_ts/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion bindings/wasm/iota_interaction_ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
},
"dependencies": {
"@iota/iota.js": "file:../../../../iota/sdk/typescript",
"@iota/iota-sdk": "^0.4.0",
"@noble/ed25519": "^1.7.3",
"@noble/hashes": "^1.4.0",
"@types/node-fetch": "^2.6.2",
Expand Down
2 changes: 2 additions & 0 deletions bindings/wasm/iota_interaction_ts/src/identity_move_calls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ use identity_iota_interaction::rpc_types::OwnedObjectRef;
use identity_iota_interaction::types::base_types::IotaAddress;
use identity_iota_interaction::types::base_types::ObjectID;
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::BorrowIntentFnInternalT;
use identity_iota_interaction::ControllerIntentFnInternalT;
Expand Down
2 changes: 2 additions & 0 deletions bindings/wasm/iota_interaction_ts/src/migration_move_calls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use identity_iota_interaction::ident_str;
use identity_iota_interaction::rpc_types::OwnedObjectRef;
use identity_iota_interaction::types::base_types::ObjectID;
use identity_iota_interaction::types::base_types::ObjectRef;
use identity_iota_interaction::types::transaction::ObjectArg;
use identity_iota_interaction::types::IOTA_FRAMEWORK_PACKAGE_ID;
use identity_iota_interaction::MigrationMoveCalls;
use identity_iota_interaction::ProgrammableTransactionBcs;
use js_sys::Uint8Array;
Expand Down
2 changes: 1 addition & 1 deletion identity_iota_core/src/rebased/proposals/borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use super::UserDrivenTx;

cfg_if::cfg_if! {
if #[cfg(target_arch = "wasm32")] {
use iota_interaction_ts::NativeTsTransactionBuilderBindingWrapper as Ptb;
use iota_interaction_ts::NativeTsCodeBindingWrapper as Ptb;
use iota_interaction_ts::error::TsSdkError as IotaInteractionError;
/// Instances of BorrowIntentFnT can be used as user-provided function to describe how
/// a borrowed assets shall be used.
Expand Down
2 changes: 1 addition & 1 deletion identity_iota_core/src/rebased/proposals/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use super::UserDrivenTx;

cfg_if::cfg_if! {
if #[cfg(target_arch = "wasm32")] {
use iota_interaction_ts::NativeTsTransactionBuilderBindingWrapper as Ptb;
use iota_interaction_ts::NativeTsCodeBindingWrapper as Ptb;
/// Instances of ControllerIntentFnT can be used as user-provided function to describe how
/// a borrowed identity's controller capability will be used.
pub trait ControllerIntentFnT: FnOnce(&mut Ptb, &Argument) {}
Expand Down

0 comments on commit 0176037

Please sign in to comment.