-
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.
[tto-sdks] Add typescript SDK support and plumb out into json-rpc
- Loading branch information
Showing
9 changed files
with
300 additions
and
12 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
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
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[package] | ||
name = "tto" | ||
version = "0.0.1" | ||
|
||
[dependencies] | ||
Sui = { local = "../../../../../../crates/sui-framework/packages/sui-framework" } | ||
|
||
[addresses] | ||
tto = "0x0" |
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,44 @@ | ||
module tto::tto { | ||
use sui::object::{Self, UID}; | ||
use sui::tx_context::{Self, TxContext}; | ||
use sui::transfer::{Self, Receiving}; | ||
|
||
struct A has key, store { | ||
id: UID, | ||
} | ||
|
||
struct B has key, store { | ||
id: UID, | ||
} | ||
|
||
public fun start(ctx: &mut TxContext) { | ||
let a = A { id: object::new(ctx) }; | ||
let a_address = object::id_address(&a); | ||
let b = B { id: object::new(ctx) }; | ||
transfer::public_transfer(a, tx_context::sender(ctx)); | ||
transfer::public_transfer(b, a_address); | ||
} | ||
|
||
public entry fun receiver(parent: &mut A, x: Receiving<B>) { | ||
let b = transfer::receive(&mut parent.id, x); | ||
transfer::public_transfer(b, @tto); | ||
} | ||
|
||
public entry fun deleter(parent: &mut A, x: Receiving<B>) { | ||
let B { id } = transfer::receive(&mut parent.id, x); | ||
object::delete(id); | ||
} | ||
|
||
public fun return_(parent: &mut A, x: Receiving<B>): B { | ||
transfer::receive(&mut parent.id, x) | ||
} | ||
|
||
public entry fun delete_(b: B) { | ||
let B { id } = b; | ||
object::delete(id); | ||
} | ||
|
||
public fun invalid_call_immut_ref(_parent: &mut A, _x: &Receiving<B>) { } | ||
public fun invalid_call_mut_ref(_parent: &mut A, _x: &mut Receiving<B>) { } | ||
public fun dropper(_parent: &mut A, _x: Receiving<B>) { } | ||
} |
Oops, something went wrong.