PHP WebShell

Текущая директория: /opt/BitGoJS/node_modules/@aptos-labs/ts-sdk/src/transactions/instances

Просмотр файла: transactionArgument.ts

// Copyright © Aptos Foundation
// SPDX-License-Identifier: Apache-2.0

import { Serializer } from "../../bcs/serializer";
import { Hex } from "../../core/hex";

export interface TransactionArgument extends EntryFunctionArgument, ScriptFunctionArgument {}

/**
 * Represents an argument for entry functions, providing methods to serialize the argument
 * to BCS-serialized bytes and convert it to different formats.
 */
export interface EntryFunctionArgument {
  /**
   * Serialize an argument to BCS-serialized bytes.
   *
   * @param serializer - The serializer instance used for serialization.
   */
  serialize(serializer: Serializer): void;

  /**
   * Serialize an argument to BCS-serialized bytes.
   * Serialize an argument as a type-agnostic, fixed byte sequence. The byte sequence contains
   * the number of the following bytes followed by the BCS-serialized bytes for a typed argument.
   *
   * @param serializer - The serializer used to convert the argument.
   */
  serializeForEntryFunction(serializer: Serializer): void;

  /**
   * Convert the argument to BCS-serialized bytes.
   *
   * @returns Uint8Array representing the BCS-serialized bytes of the argument.
   */
  bcsToBytes(): Uint8Array;

  /**
   * Converts the BCS-serialized bytes of an argument into a hexadecimal representation.
   * This function is useful for obtaining a Hex instance that encapsulates the BCS-serialized bytes,
   * allowing for easier manipulation and representation of the data.
   * @returns A Hex instance containing the BCS-serialized bytes.
   */
  bcsToHex(): Hex;
}

/**
 * Represents an argument for script functions, providing methods to serialize and convert to bytes.
 */
export interface ScriptFunctionArgument {
  /**
   * Serialize an argument to BCS-serialized bytes.
   */
  serialize(serializer: Serializer): void;
  /**
   * Serialize an argument to BCS-serialized bytes as a type aware byte sequence.
   * The byte sequence contains an enum variant index followed by the BCS-serialized
   * bytes for a typed argument.
   */
  serializeForScriptFunction(serializer: Serializer): void;

  bcsToBytes(): Uint8Array;
  bcsToHex(): Hex;
}

Выполнить команду


Для локальной разработки. Не используйте в интернете!