Skip to content

Commit

Permalink
dprint
Browse files Browse the repository at this point in the history
  • Loading branch information
UMR1352 committed Jan 22, 2025
1 parent 9b6bcbd commit 01d85b9
Show file tree
Hide file tree
Showing 20 changed files with 628 additions and 620 deletions.
4 changes: 2 additions & 2 deletions bindings/wasm/iota_interaction_ts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ crate-type = ["cdylib", "rlib"]
[dependencies]
anyhow = "1.0.75"
async-trait = { version = "0.1", default-features = false }
bcs = "0.1.6"
bls12_381_plus = "0.8.17"
cfg-if = "1.0.0"
console_error_panic_hook = { version = "0.1" }
Expand All @@ -27,13 +28,12 @@ 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
thiserror.workspace = true
tsify = "0.4.5"
wasm-bindgen = { version = "=0.2.93", features = ["serde-serialize"] }
wasm-bindgen-futures = { version = "0.4", default-features = false }
zkryptium = "0.2.2"
bcs = "0.1.6"
serde_json.workspace = true

[dependencies.identity_iota_interaction]
path = "../../../identity_iota_interaction"
Expand Down
2 changes: 1 addition & 1 deletion bindings/wasm/iota_interaction_ts/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020-2025 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

export * as move_calls from './move_calls';
export * as move_calls from "./move_calls";
38 changes: 19 additions & 19 deletions bindings/wasm/iota_interaction_ts/lib/move_calls/asset/create.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
// Copyright 2020-2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { Transaction, TransactionArgument } from "@iota/iota-sdk/transactions"
import { Transaction, TransactionArgument } from "@iota/iota-sdk/transactions";

export function new_(
inner_bytes: Uint8Array,
inner_type: string,
mutable: boolean,
transferable: boolean,
deletable: boolean,
packageId: string,
inner_bytes: Uint8Array,
inner_type: string,
mutable: boolean,
transferable: boolean,
deletable: boolean,
packageId: string,
): Promise<Uint8Array> {
const tx = new Transaction();
const inner_arg = tx.pure(inner_bytes)
const mutable_arg = tx.pure.bool(mutable);
const transferable_arg = tx.pure.bool(transferable);
const deletable_arg = tx.pure.bool(deletable);
const tx = new Transaction();
const inner_arg = tx.pure(inner_bytes);
const mutable_arg = tx.pure.bool(mutable);
const transferable_arg = tx.pure.bool(transferable);
const deletable_arg = tx.pure.bool(deletable);

tx.moveCall({
target: `${packageId}::asset::new_with_config`,
typeArguments: [inner_type],
arguments: [inner_arg, mutable_arg, transferable_arg, deletable_arg]
});
tx.moveCall({
target: `${packageId}::asset::new_with_config`,
typeArguments: [inner_type],
arguments: [inner_arg, mutable_arg, transferable_arg, deletable_arg],
});

return tx.build();
}
return tx.build();
}
25 changes: 12 additions & 13 deletions bindings/wasm/iota_interaction_ts/lib/move_calls/asset/delete.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
// Copyright 2020-2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

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

export function delete_(
asset: ObjectRef,
asset_type: string,
packageId: string,
asset: ObjectRef,
asset_type: string,
packageId: string,
): Promise<Uint8Array> {
const tx = new Transaction();
const asset_arg = tx.objectRef(asset);
const tx = new Transaction();
const asset_arg = tx.objectRef(asset);

tx.moveCall({
target: `${packageId}::asset::delete`,
typeArguments: [asset_type],
arguments: [asset_arg]
});
tx.moveCall({
target: `${packageId}::asset::delete`,
typeArguments: [asset_type],
arguments: [asset_arg],
});

return tx.build();
return tx.build();
}

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

export * from './create';
export * from './update';
export * from './delete';
export * from './transfer';
export * from "./create";
export * from "./delete";
export * from "./transfer";
export * from "./update";
114 changes: 57 additions & 57 deletions bindings/wasm/iota_interaction_ts/lib/move_calls/asset/transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,79 +2,79 @@
// 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 { ObjectRef, Transaction, TransactionArgument } from "@iota/iota-sdk/transactions";

export function transfer(
asset: ObjectRef,
asset_type: string,
recipient: string,
packageId: string,
asset: ObjectRef,
asset_type: string,
recipient: string,
packageId: string,
): Promise<Uint8Array> {
const tx = new Transaction();
const asset_arg = tx.objectRef(asset);
const recipient_arg = tx.pure.address(recipient);
const tx = new Transaction();
const asset_arg = tx.objectRef(asset);
const recipient_arg = tx.pure.address(recipient);

tx.moveCall({
target: `${packageId}::asset::transfer`,
typeArguments: [asset_type],
arguments: [asset_arg, recipient_arg]
});
tx.moveCall({
target: `${packageId}::asset::transfer`,
typeArguments: [asset_type],
arguments: [asset_arg, recipient_arg],
});

return tx.build();
return tx.build();
}

function make_tx(
proposal: SharedObjectRef,
cap: ObjectRef,
asset: ObjectRef,
asset_type: string,
packageId: string,
function_name: string,
proposal: SharedObjectRef,
cap: ObjectRef,
asset: ObjectRef,
asset_type: string,
packageId: string,
function_name: string,
): Promise<Uint8Array> {
const tx = new Transaction();
const proposal_arg = tx.sharedObjectRef(proposal);
const cap_arg = tx.objectRef(cap);
const asset_arg = tx.objectRef(asset);
const tx = new Transaction();
const proposal_arg = tx.sharedObjectRef(proposal);
const cap_arg = tx.objectRef(cap);
const asset_arg = tx.objectRef(asset);

tx.moveCall({
target: `${packageId}::asset::${function_name}`,
typeArguments: [asset_type],
arguments: [proposal_arg, cap_arg, asset_arg],
});
tx.moveCall({
target: `${packageId}::asset::${function_name}`,
typeArguments: [asset_type],
arguments: [proposal_arg, cap_arg, asset_arg],
});

return tx.build();
return tx.build();
}

export function acceptProposal(
proposal: SharedObjectRef,
recipient_cap: ObjectRef,
asset: ObjectRef,
asset_type: string,
packageId: string,
proposal: SharedObjectRef,
recipient_cap: ObjectRef,
asset: ObjectRef,
asset_type: string,
packageId: string,
): Promise<Uint8Array> {
return make_tx(
proposal,
recipient_cap,
asset,
asset_type,
packageId,
'accept',
);
return make_tx(
proposal,
recipient_cap,
asset,
asset_type,
packageId,
"accept",
);
}

export function concludeOrCancel(
proposal: SharedObjectRef,
sender_cap: ObjectRef,
asset: ObjectRef,
asset_type: string,
packageId: string,
proposal: SharedObjectRef,
sender_cap: ObjectRef,
asset: ObjectRef,
asset_type: string,
packageId: string,
): Promise<Uint8Array> {
return make_tx(
proposal,
sender_cap,
asset,
asset_type,
packageId,
'conclude_or_cancel',
);
}
return make_tx(
proposal,
sender_cap,
asset,
asset_type,
packageId,
"conclude_or_cancel",
);
}
28 changes: 14 additions & 14 deletions bindings/wasm/iota_interaction_ts/lib/move_calls/asset/update.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
// 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-sdk/transactions";

export function update(
asset: ObjectRef,
content: Uint8Array,
content_type: string,
packageId: string,
asset: ObjectRef,
content: Uint8Array,
content_type: string,
packageId: string,
): Promise<Uint8Array> {
const tx = new Transaction();
const content_arg = tx.pure(content);
const asset_arg = tx.objectRef(asset);
const tx = new Transaction();
const content_arg = tx.pure(content);
const asset_arg = tx.objectRef(asset);

tx.moveCall({
target: `${packageId}::asset::update`,
typeArguments: [content_type],
arguments: [asset_arg, content_arg]
});
tx.moveCall({
target: `${packageId}::asset::update`,
typeArguments: [content_type],
arguments: [asset_arg, content_arg],
});

return tx.build();
return tx.build();
}
Loading

0 comments on commit 01d85b9

Please sign in to comment.