Skip to content
Discussion options

You must be logged in to vote

Options as Entry function parameters

Depends on the SDK etc. Let's take this example entry function:

module 0x1337::module {
  entry fun do_stuff(caller: &signer, my_option: Option<u8>) {
    // Do something with the option
  }
}

TS SDK

There are two ways to encode it, either typed, or the easy mode, where it'll figure it out for you.

Easy mode: SDK will figure it out for you

The SDK will use the ABI, either provided or retrieved from on-chain to infer and try to
determine the proper encoding.

Here's for a Some(5) option:

    const num = 5; // Note must be between 0-255 for u8
    const txn = await aptos.transaction.build.simple({
        sender: account.accountAddress,
        data: {

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@0x-j
Comment options

0x-j Mar 13, 2024
Maintainer

@gregnazario
Comment options

Answer selected by Pelumi527
@Pelumi527
Comment options

@Pelumi527
Comment options

@Pelumi527
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
move Questions related to the Move Language
4 participants