PHP WebShell

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

Просмотр файла: chunk-ACVIE7IE.mjs.map

{"version":3,"sources":["../../src/transactions/instances/moduleId.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Serializable, Serializer } from \"../../bcs/serializer\";\nimport { Deserializer } from \"../../bcs/deserializer\";\nimport { AccountAddress } from \"../../core\";\nimport { Identifier } from \"./identifier\";\nimport { MoveModuleId } from \"../../types\";\n\n/**\n * Represents a ModuleId that can be serialized and deserialized.\n * A ModuleId consists of a module address (e.g., \"0x1\") and a module name (e.g., \"coin\").\n */\nexport class ModuleId extends Serializable {\n  public readonly address: AccountAddress;\n\n  public readonly name: Identifier;\n\n  /**\n   * Initializes a new instance of the module with the specified account address and name.\n   *\n   * @param address - The account address, e.g., \"0x1\".\n   * @param name - The module name under the specified address, e.g., \"coin\".\n   */\n  constructor(address: AccountAddress, name: Identifier) {\n    super();\n    this.address = address;\n    this.name = name;\n  }\n\n  /**\n   * Converts a string literal in the format \"account_address::module_name\" to a ModuleId.\n   * @param moduleId - A string literal representing the module identifier.\n   * @throws Error if the provided moduleId is not in the correct format.\n   * @returns ModuleId - The corresponding ModuleId object.\n   */\n  static fromStr(moduleId: MoveModuleId): ModuleId {\n    const parts = moduleId.split(\"::\");\n    if (parts.length !== 2) {\n      throw new Error(\"Invalid module id.\");\n    }\n    return new ModuleId(AccountAddress.fromString(parts[0]), new Identifier(parts[1]));\n  }\n\n  /**\n   * Serializes the address and name properties using the provided serializer.\n   * This function is essential for converting the object's data into a format suitable for transmission or storage.\n   *\n   * @param serializer - The serializer instance used to perform the serialization.\n   */\n  serialize(serializer: Serializer): void {\n    this.address.serialize(serializer);\n    this.name.serialize(serializer);\n  }\n\n  /**\n   * Deserializes a ModuleId from the provided deserializer.\n   * This function retrieves the account address and identifier to construct a ModuleId instance.\n   *\n   * @param deserializer - The deserializer instance used to read the data.\n   */\n  static deserialize(deserializer: Deserializer): ModuleId {\n    const address = AccountAddress.deserialize(deserializer);\n    const name = Identifier.deserialize(deserializer);\n    return new ModuleId(address, name);\n  }\n}\n"],"mappings":"2HAaO,IAAMA,EAAN,MAAMC,UAAiBC,CAAa,CAWzC,YAAYC,EAAyBC,EAAkB,CACrD,MAAM,EACN,KAAK,QAAUD,EACf,KAAK,KAAOC,CACd,CAQA,OAAO,QAAQC,EAAkC,CAC/C,IAAMC,EAAQD,EAAS,MAAM,IAAI,EACjC,GAAIC,EAAM,SAAW,EACnB,MAAM,IAAI,MAAM,oBAAoB,EAEtC,OAAO,IAAIL,EAASM,EAAe,WAAWD,EAAM,CAAC,CAAC,EAAG,IAAIE,EAAWF,EAAM,CAAC,CAAC,CAAC,CACnF,CAQA,UAAUG,EAA8B,CACtC,KAAK,QAAQ,UAAUA,CAAU,EACjC,KAAK,KAAK,UAAUA,CAAU,CAChC,CAQA,OAAO,YAAYC,EAAsC,CACvD,IAAMP,EAAUI,EAAe,YAAYG,CAAY,EACjDN,EAAOI,EAAW,YAAYE,CAAY,EAChD,OAAO,IAAIT,EAASE,EAASC,CAAI,CACnC,CACF","names":["ModuleId","_ModuleId","Serializable","address","name","moduleId","parts","AccountAddress","Identifier","serializer","deserializer"]}

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


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