Skip to content
Discussion options

You must be logged in to vote

You can check out the Example below to pass an Optional argument of type 0x1::object::Object<0x1::fungible_asset::Metadata> or an empty Optional:

`import { MoveOption, TransactionArgument, TransactionPayloadScript, TypeTagStruct, TypeTagAddress, TypeTagVector, U64, AccountAddress } from "@aptos-labs/aptos-ts-sdk";
import { HexString } from "@aptos-labs/hex-string";

// Helper to create a MoveOption for Optional
function createOptionalMetadata(metadata: any | null): MoveOption {
if (metadata === null) {
return new MoveOption(null); // Represents an empty Optional
} else {
// Serialize the metadata object manually
const serializedMetadata = serializeMetadata(metadata);
return new MoveOption(…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by KodamaHQ
Comment options

You must be logged in to vote
1 reply
@KodamaHQ
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants