sui icon indicating copy to clipboard operation
sui copied to clipboard

[Sui SDKs] [Rust SDK] Updated with additional features, clarifications, and examples for interacting with Sui Blokchain using the Rust programming language

Open SaitamaCoderVN opened this issue 1 year ago • 1 comments
trafficstars

I would like to update further and show examples of interacting with Sui Blockchain through the use of the Rust SDK.

During the process of building my product, I encountered some problems with the Rust SDK, and I felt that the Rust SDK docs page was not really effective, so I wanted to update it with more information and specific examples. for your Sui SDKs.

One of the problems I encountered was calling a function on my module that is on Sui Blockchain, and I found a few links to the answer but it wasn't really clear. Here is the link I found: https://github.com/MystenLabs/sui/issues/15538

Here is one of my solutions that I would like to update:

// programmable transactions allows the user to bundle a number of actions into one transaction
    let mut ptb = ProgrammableTransactionBuilder::new();

    // Create an Argument::Input for the Pure 10 value of type u64
    let input_value = 10u64;
    let input_argument = CallArg::Pure(bcs::to_bytes(&input_value).unwrap());

    // Add this input to the builder
    ptb.input(input_argument);

    ptb.command(Command::MoveCall(Box::new(
        sui_sdk::types::transaction::ProgrammableMoveCall {
            package: ObjectID::from_hex_literal("0x883393ee444fb828aa0e977670cf233b0078b41d144e6208719557cb3888244d").unwrap(),
            module: Identifier::new("hello_wolrd").unwrap(),
            function: Identifier::new("hello_world").unwrap(),
            type_arguments: vec![],
            arguments: vec![Argument::Input(0)],
        }
    )));

    // finish building the transaction block by calling finish on the ptb
    let builder = ptb.finish();

### If you don't mind I can create a Pull Request so I can update my solution for the community on the docs page describing your Sui SDKs - Rust SDK

SaitamaCoderVN avatar May 28 '24 06:05 SaitamaCoderVN

@FucktheKingcode We'd love to have more examples for the Rust SDK. Please feel free to create a PR and I will make sure we review it quickly and get it merged.

Thanks in advance for your contribution!

stefan-mysten avatar May 28 '24 06:05 stefan-mysten

Hey bro, I have some problem with my PR https://github.com/MystenLabs/sui/pull/18008

SaitamaCoderVN avatar May 31 '24 07:05 SaitamaCoderVN

Hi @stefan-mysten I want to rewrite the Rust SDK documentation on Sui SDK because it has many limitations and very little description, but I think this seems like quite a big challenge and I need a small grant. image

SaitamaCoderVN avatar Jun 02 '24 10:06 SaitamaCoderVN

For grants, have a look here https://sui.io/grants-hub

On the other hand, we're planning on having a new/improved Rust SDK so I wouldn't want you to spend the time to do it, and shortly after a new SDK is released.

stefan-mysten avatar Jun 03 '24 16:06 stefan-mysten