-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ts-sdk] Add tx.object.option for creatnig object options in transact…
…ion builder
- Loading branch information
1 parent
4a6eaad
commit 61d7b68
Showing
10 changed files
with
305 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@mysten/sui': patch | ||
--- | ||
|
||
Add tx.object.option for creatnig object options in transaction builder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
# @generated by Move, please check-in and do not edit manually. | ||
|
||
[move] | ||
version = 0 | ||
version = 3 | ||
manifest_digest = "8C8B9ADAFF8B7267E4476A3DF08A72810194D36146AC710F0545C8843B1F1075" | ||
deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082" | ||
|
||
dependencies = [ | ||
{ name = "Sui" }, | ||
{ id = "Sui", name = "Sui" }, | ||
] | ||
|
||
[[move.package]] | ||
name = "MoveStdlib" | ||
id = "MoveStdlib" | ||
source = { local = "../../../../../../crates/sui-framework/packages/move-stdlib" } | ||
|
||
[[move.package]] | ||
name = "Sui" | ||
id = "Sui" | ||
source = { local = "../../../../../../crates/sui-framework/packages/sui-framework" } | ||
|
||
dependencies = [ | ||
{ name = "MoveStdlib" }, | ||
{ id = "MoveStdlib", name = "MoveStdlib" }, | ||
] | ||
|
||
[move.toolchain-version] | ||
compiler-version = "1.30.0" | ||
compiler-version = "1.38.0" | ||
edition = "2024.beta" | ||
flavor = "sui" |
115 changes: 65 additions & 50 deletions
115
sdk/typescript/test/e2e/data/serializer/sources/serializer.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,81 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
module serializer::serializer_tests { | ||
use sui::clock::Clock; | ||
use std::option::Option; | ||
use sui::object::ID; | ||
use std::string::String; | ||
use std::ascii; | ||
|
||
public struct MutableShared has key { | ||
id: UID, | ||
value: u64, | ||
} | ||
module serializer::serializer_tests; | ||
|
||
fun init(ctx: &mut TxContext) { | ||
transfer::share_object(MutableShared { | ||
id: object::new(ctx), | ||
value: 1, | ||
}) | ||
} | ||
use std::ascii; | ||
use std::option::{is_some, extract}; | ||
use std::string::String; | ||
use sui::clock::Clock; | ||
|
||
public entry fun use_clock(_clock: &Clock) {} | ||
public struct MutableShared has key { | ||
id: UID, | ||
value: u64, | ||
} | ||
|
||
public entry fun list<T: key + store>( | ||
item: T, | ||
ctx: &mut TxContext | ||
) { | ||
transfer::public_transfer(item, tx_context::sender(ctx)) | ||
} | ||
fun init(ctx: &mut TxContext) { | ||
transfer::share_object(MutableShared { | ||
id: object::new(ctx), | ||
value: 1, | ||
}) | ||
} | ||
|
||
public fun return_struct<T: key + store>( | ||
item: T, | ||
): T { | ||
item | ||
} | ||
public entry fun use_clock(_clock: &Clock) {} | ||
|
||
public entry fun value(clock: &MutableShared) { | ||
assert!(clock.value > 0, 1); | ||
} | ||
public entry fun list<T: key + store>(item: T, ctx: &mut TxContext) { | ||
transfer::public_transfer(item, tx_context::sender(ctx)) | ||
} | ||
|
||
public entry fun set_value(clock: &mut MutableShared) { | ||
clock.value = 10; | ||
} | ||
public fun return_struct<T: key + store>(item: T): T { | ||
item | ||
} | ||
|
||
public entry fun delete_value(clock: MutableShared) { | ||
let MutableShared { id, value: _ } = clock; | ||
object::delete(id); | ||
} | ||
public entry fun value(clock: &MutableShared) { | ||
assert!(clock.value > 0, 1); | ||
} | ||
|
||
public fun test_abort() { | ||
abort 0 | ||
} | ||
public entry fun set_value(clock: &mut MutableShared) { | ||
clock.value = 10; | ||
} | ||
|
||
public entry fun delete_value(clock: MutableShared) { | ||
let MutableShared { id, value: _ } = clock; | ||
object::delete(id); | ||
} | ||
|
||
public fun test_abort() { | ||
abort 0 | ||
} | ||
|
||
public fun addr(_: address) {} | ||
|
||
public fun id(_: ID) {} | ||
|
||
public fun addr(_: address) {} | ||
public fun id(_: ID) {} | ||
public fun ascii_(_: ascii::String) {} | ||
|
||
public fun ascii_(_: ascii::String) {} | ||
public fun string(_: String) {} | ||
public fun string(_: String) {} | ||
|
||
public fun vec(_: vector<ascii::String>) {} | ||
public fun opt(_: Option<ascii::String>) {} | ||
public fun vec(_: vector<ascii::String>) {} | ||
|
||
public fun ints(_u8: u8, _u16: u16, _u32: u32, _u64: u64, _u128: u128, _u256: u256) {} | ||
public fun boolean(_bool: bool) {} | ||
public fun opt(_: Option<ascii::String>) {} | ||
|
||
public fun ints( | ||
_u8: u8, | ||
_u16: u16, | ||
_u32: u32, | ||
_u64: u64, | ||
_u128: u128, | ||
_u256: u256, | ||
) {} | ||
|
||
public fun boolean(_bool: bool) {} | ||
|
||
public fun some<T>(opt: &mut Option<T>): T { | ||
extract<T>(opt) | ||
} | ||
|
||
public fun none<T>(opt: &mut Option<T>) { | ||
if (is_some(opt)) { | ||
abort 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.