import { A as AccountAddress, a as AccountPublicKey, b as AuthenticationKey, V as VerifySignatureArgs, c as VerifySignatureAsyncArgs, S as Serializer, d as Signature, H as HexInput, D as Deserializer, P as PublicKey, E as EphemeralPublicKeyVariant, e as AptosConfig, f as Serializable, g as EphemeralCertificateVariant, Z as ZkpVariant, L as LedgerVersionArg, h as AccountAddressInput, i as PrivateKey, j as Hex, k as Ed25519PublicKey, l as AnyPublicKey, M as MultiKey, m as MultiEd25519PublicKey, n as Ed25519Signature, o as MultiEd25519Signature, p as AccountAuthenticator, q as MoveString, r as MoveVector, U as U8, s as U64, t as AnyNumber, R as RawTransaction, u as SimpleEntryFunctionArgumentTypes, v as MoveFunction, w as EntryFunctionArgumentTypes, B as Bool, F as FixedBytes, I as I128, x as I16, y as I256, z as I32, C as I64, G as I8, J as U128, K as U16, N as U256, O as U32, Q as InputGenerateTransactionPayloadDataWithRemoteABI, T as InputGenerateTransactionPayloadData, W as InputScriptData, X as InputGenerateSingleSignerRawTransactionArgs, Y as SimpleTransaction, _ as InputGenerateMultiAgentRawTransactionArgs, $ as MultiAgentTransaction, a0 as AnyTransactionPayloadInstance, a1 as TransactionInnerPayload, a2 as InputGenerateTransactionOptions, a3 as InputSubmitTransactionData, a4 as InputSimulateTransactionData, a5 as TransactionPayloadScript, a6 as InputEntryFunctionDataWithRemoteABI, a7 as TransactionPayloadEntryFunction, a8 as InputMultiSigDataWithRemoteABI, a9 as TransactionPayloadMultiSig, aa as InputEntryFunctionDataWithABI, ab as InputMultiSigDataWithABI, ac as InputViewFunctionDataWithRemoteABI, ad as EntryFunction, ae as InputViewFunctionDataWithABI, af as AccountAuthenticatorNoAccountAuthenticator, ag as AccountAuthenticatorEd25519, ah as AccountAuthenticatorSingleKey, ai as AccountAuthenticatorMultiKey, aj as TypeTag, ak as MoveModule, al as FunctionABI, am as EntryFunctionABI, an as ViewFunctionABI, ao as TypeArgument, ap as AnyRawTransaction, aq as AnyRawTransactionInstance, ar as AccountData, as as MoveModuleBytecode, at as CursorPaginationArgs, au as PaginationArgs, av as TransactionResponse, aw as MoveResource, ax as MoveStructId, ay as TokenStandardArg, az as OrderByArg, aA as GetAccountOwnedTokensQueryResponse, aB as GetAccountOwnedTokensFromCollectionResponse, aC as GetAccountCollectionsWithOwnedTokenResponse, aD as GetAccountCoinsDataResponse, aE as WhereArg, aF as GetObjectDataQueryResponse, aG as PrivateKeyInput, aH as GetCollectionDataResponse, aI as GetTokenDataResponse, aJ as GetCurrentTokenOwnershipResponse, aK as GetOwnedTokensResponse, aL as GetTokenActivityResponse, aM as WaitForTransactionOptions, aN as UserTransactionResponse, aO as GetFungibleAssetMetadataResponse, aP as GetFungibleAssetActivitiesResponse, aQ as GetCurrentFungibleAssetBalancesResponse, aR as LedgerInfo, aS as Block, aT as MoveValue, aU as InputViewFunctionData, aV as InputViewFunctionJsonData, aW as GetChainTopUserTransactionsResponse, aX as GraphqlQuery, aY as ProcessorType, aZ as GetProcessorStatusResponse, a_ as InputEntryFunctionData, a$ as GetNumberOfDelegatorsResponse, b0 as GetDelegatedStakingActivitiesResponse, b1 as InputSimulateTransactionOptions, b2 as InputTransactionPluginData, b3 as PendingTransactionResponse, b4 as CommittedTransactionResponse, b5 as GasEstimation, b6 as Ed25519PrivateKey, b7 as TableItemRequest, b8 as GetTableItemsDataResponse, b9 as GetTableItemsMetadataResponse, ba as SigningScheme, bb as SigningSchemeInput, bc as AnySignature, bd as GetANSNameResponse, be as EntryFunctionArgument, bf as MultiKeySignature, bg as AccountAuthenticatorMultiEd25519, bh as AccountAuthenticatorAbstraction, bi as MoveFunctionId, bj as AptosRequest, bk as AptosApiType, bl as AptosResponse, bm as ClientRequest, bn as Client, bo as ClientResponse, bp as MimeType, bq as ClientConfig } from './account-2FUAPVPW.js'; export { br as ACCOUNT_ABSTRACTION_SIGNING_DATA_SALT, bs as APTOS_COIN, bt as APTOS_FA, bu as AbstractMultiKey, bv as AccountAbstractionMessage, bw as AccountAuthenticatorVariant, bx as AccountSignature, by as AddressInvalidReason, bz as AnyPublicKeyVariant, bA as AnySignatureVariant, bB as AptosSettings, bC as AuthenticationKeyScheme, bD as BlockEndInfo, bE as BlockEpilogueTransactionResponse, bF as BlockMetadataTransactionResponse, bG as ChainId, bH as ClientHeadersType, bI as DEFAULT_MAX_GAS_AMOUNT, bJ as DEFAULT_TXN_EXP_SEC_FROM_NOW, bK as DEFAULT_TXN_TIMEOUT_SEC, bL as DecodedTableData, bM as DeletedTableData, bN as DeriveScheme, bO as Deserializable, bP as DirectWriteSet, bQ as EntryFunctionPayloadResponse, bR as EphemeralSignatureVariant, bS as Event, bT as EventGuid, bU as FIREBASE_AUTH_ISS_PATTERN, bV as FaucetConfig, bW as FeePayerRawTransaction, bX as FullNodeConfig, bY as GenerateAccount, bZ as GenerateAccountWithEd25519, b_ as GenerateAccountWithSingleSignerSecp256k1Key, b$ as GenesisPayload, c0 as GenesisTransactionResponse, c1 as GetAccountAddressesForAuthKeyResponse, c2 as GetEventsResponse, c3 as HexInvalidReason, c4 as Identifier, c5 as IndexerConfig, c6 as InputGenerateMultiAgentRawTransactionData, c7 as InputGenerateOrderlessTransactionOptions, c8 as InputGenerateRawTransactionArgs, c9 as InputGenerateSequenceNumberTransactionOptions, ca as InputGenerateSingleSignerRawTransactionData, cb as InputGenerateTransactionData, cc as InputGenerateTransactionPayloadDataWithABI, cd as InputMultiSigData, ce as Int128, cf as Int16, cg as Int256, ch as Int32, ci as Int64, cj as Int8, ck as MIN_MAX_GAS_AMOUNT, cl as ModuleId, cm as MoveAbility, cn as MoveAddressType, co as MoveFunctionGenericTypeParam, cp as MoveFunctionVisibility, cq as MoveInt128Type, cr as MoveInt16Type, cs as MoveInt256Type, ct as MoveInt32Type, cu as MoveInt64Type, cv as MoveInt8Type, cw as MoveModuleId, cx as MoveObjectType, cy as MoveOption, cz as MoveOptionType, cA as MoveScriptBytecode, cB as MoveStruct, cC as MoveStructField, cD as MoveStructType, cE as MoveType, cF as MoveUint128Type, cG as MoveUint16Type, cH as MoveUint256Type, cI as MoveUint32Type, cJ as MoveUint64Type, cK as MoveUint8Type, cL as MultiAgentRawTransaction, cM as MultiSig, cN as MultiSigTransactionPayload, cO as MultisigPayloadResponse, cP as Network, cQ as NetworkToChainId, cR as NetworkToFaucetAPI, cS as NetworkToIndexerAPI, cT as NetworkToNetworkName, cU as NetworkToNodeAPI, cV as NetworkToPepperAPI, cW as NetworkToProverAPI, cX as OrderBy, cY as OrderByValue, cZ as ParsingError, c_ as ParsingResult, c$ as PluginConfig, d0 as PluginSettings, d1 as PrivateKeyVariants, d2 as RAW_TRANSACTION_SALT, d3 as RAW_TRANSACTION_WITH_DATA_SALT, d4 as RawTransactionWithData, d5 as RoleType, d6 as Script, d7 as ScriptFunctionArgument, d8 as ScriptFunctionArgumentTypes, d9 as ScriptPayloadResponse, da as ScriptTransactionArgumentVariants, db as ScriptWriteSet, dc as Secp256k1PrivateKey, dd as Secp256k1PublicKey, de as Secp256k1Signature, df as Serialized, dg as StateCheckpointTransactionResponse, dh as StructTag, di as TEXT_ENCODER, dj as TokenStandard, dk as TransactionArgument, dl as TransactionAuthenticatorVariant, dm as TransactionEd25519Signature, dn as TransactionExecutable, dp as TransactionExecutableEmpty, dq as TransactionExecutableEntryFunction, dr as TransactionExecutableScript, ds as TransactionExecutableVariants, dt as TransactionExtraConfig, du as TransactionExtraConfigV1, dv as TransactionExtraConfigVariants, dw as TransactionFeePayerSignature, dx as TransactionGenerationConfig, dy as TransactionInnerPayloadV1, dz as TransactionInnerPayloadVariants, dA as TransactionMultiAgentSignature, dB as TransactionMultiEd25519Signature, dC as TransactionPayload, dD as TransactionPayloadResponse, dE as TransactionPayloadVariants, dF as TransactionResponseType, dG as TransactionSecp256k1Signature, dH as TransactionSignature, dI as TransactionSingleSenderSignature, dJ as TransactionSubmitter, dK as TransactionVariants, dL as TypeTagAddress, dM as TypeTagBool, dN as TypeTagGeneric, dO as TypeTagI128, dP as TypeTagI16, dQ as TypeTagI256, dR as TypeTagI32, dS as TypeTagI64, dT as TypeTagI8, dU as TypeTagReference, dV as TypeTagSigner, dW as TypeTagStruct, dX as TypeTagU128, dY as TypeTagU16, dZ as TypeTagU256, d_ as TypeTagU32, d$ as TypeTagU64, e0 as TypeTagU8, e1 as TypeTagVariants, e2 as TypeTagVector, e3 as Uint128, e4 as Uint16, e5 as Uint256, e6 as Uint32, e7 as Uint64, e8 as Uint8, e9 as ValidatorTransactionResponse, ea as ViewFunctionJsonPayload, eb as WriteSet, ec as WriteSetChange, ed as WriteSetChangeDeleteModule, ee as WriteSetChangeDeleteResource, ef as WriteSetChangeDeleteTableItem, eg as WriteSetChangeWriteModule, eh as WriteSetChangeWriteResource, ei as WriteSetChangeWriteTableItem, ej as anyPublicKeyVariantToString, ek as aptosCoinStructTag, el as deserializeFromScriptArgument, em as ensureBoolean, en as hexToAsciiString, eo as isBlockEpilogueTransactionResponse, ep as isBlockMetadataTransactionResponse, eq as isCanonicalEd25519Signature, er as isEd25519Signature, es as isFeePayerSignature, et as isGenesisTransactionResponse, eu as isMultiAgentSignature, ev as isMultiEd25519Signature, ew as isPendingTransactionResponse, ex as isSecp256k1Signature, ey as isSingleSenderSignature, ez as isStateCheckpointTransactionResponse, eA as isUserTransactionResponse, eB as isValidatorTransactionResponse, eC as objectStructTag, eD as optionStructTag, eE as outOfRangeErrorMessage, eF as serializeEntryFunctionBytesCompat, eG as stringStructTag, eH as validateNumberInRange } from './account-2FUAPVPW.js'; import { ProjPointType } from '@noble/curves/abstract/weierstrass'; import { Fp2 } from '@noble/curves/abstract/tower'; import EventEmitter from 'eventemitter3'; type Maybe = T | null; type InputMaybe = Maybe; /** All built-in and custom scalars, mapped to their actual values */ type Scalars = { ID: { input: string; output: string; }; String: { input: string; output: string; }; Boolean: { input: boolean; output: boolean; }; Int: { input: number; output: number; }; Float: { input: number; output: number; }; bigint: { input: any; output: any; }; jsonb: { input: any; output: any; }; numeric: { input: any; output: any; }; timestamp: { input: any; output: any; }; }; /** Boolean expression to compare columns of type "Boolean". All fields are combined with logical 'AND'. */ type BooleanComparisonExp = { _eq?: InputMaybe; _gt?: InputMaybe; _gte?: InputMaybe; _in?: InputMaybe>; _is_null?: InputMaybe; _lt?: InputMaybe; _lte?: InputMaybe; _neq?: InputMaybe; _nin?: InputMaybe>; }; /** Boolean expression to compare columns of type "Int". All fields are combined with logical 'AND'. */ type IntComparisonExp = { _eq?: InputMaybe; _gt?: InputMaybe; _gte?: InputMaybe; _in?: InputMaybe>; _is_null?: InputMaybe; _lt?: InputMaybe; _lte?: InputMaybe; _neq?: InputMaybe; _nin?: InputMaybe>; }; /** Boolean expression to compare columns of type "String". All fields are combined with logical 'AND'. */ type StringComparisonExp = { _eq?: InputMaybe; _gt?: InputMaybe; _gte?: InputMaybe; /** does the column match the given case-insensitive pattern */ _ilike?: InputMaybe; _in?: InputMaybe>; /** does the column match the given POSIX regular expression, case insensitive */ _iregex?: InputMaybe; _is_null?: InputMaybe; /** does the column match the given pattern */ _like?: InputMaybe; _lt?: InputMaybe; _lte?: InputMaybe; _neq?: InputMaybe; /** does the column NOT match the given case-insensitive pattern */ _nilike?: InputMaybe; _nin?: InputMaybe>; /** does the column NOT match the given POSIX regular expression, case insensitive */ _niregex?: InputMaybe; /** does the column NOT match the given pattern */ _nlike?: InputMaybe; /** does the column NOT match the given POSIX regular expression, case sensitive */ _nregex?: InputMaybe; /** does the column NOT match the given SQL regular expression */ _nsimilar?: InputMaybe; /** does the column match the given POSIX regular expression, case sensitive */ _regex?: InputMaybe; /** does the column match the given SQL regular expression */ _similar?: InputMaybe; }; /** Boolean expression to compare columns of type "bigint". All fields are combined with logical 'AND'. */ type BigintComparisonExp = { _eq?: InputMaybe; _gt?: InputMaybe; _gte?: InputMaybe; _in?: InputMaybe>; _is_null?: InputMaybe; _lt?: InputMaybe; _lte?: InputMaybe; _neq?: InputMaybe; _nin?: InputMaybe>; }; type CurrentAptosNamesAggregateBoolExp = { bool_and?: InputMaybe; bool_or?: InputMaybe; count?: InputMaybe; }; type CurrentAptosNamesAggregateBoolExpBoolAnd = { arguments: CurrentAptosNamesSelectColumnCurrentAptosNamesAggregateBoolExpBoolAndArgumentsColumns; distinct?: InputMaybe; filter?: InputMaybe; predicate: BooleanComparisonExp; }; type CurrentAptosNamesAggregateBoolExpBoolOr = { arguments: CurrentAptosNamesSelectColumnCurrentAptosNamesAggregateBoolExpBoolOrArgumentsColumns; distinct?: InputMaybe; filter?: InputMaybe; predicate: BooleanComparisonExp; }; type CurrentAptosNamesAggregateBoolExpCount = { arguments?: InputMaybe>; distinct?: InputMaybe; filter?: InputMaybe; predicate: IntComparisonExp; }; /** Boolean expression to filter rows from the table "current_aptos_names". All fields are combined with a logical 'AND'. */ type CurrentAptosNamesBoolExp = { _and?: InputMaybe>; _not?: InputMaybe; _or?: InputMaybe>; domain?: InputMaybe; domain_expiration_timestamp?: InputMaybe; domain_with_suffix?: InputMaybe; expiration_timestamp?: InputMaybe; is_active?: InputMaybe; is_domain_owner?: InputMaybe; is_primary?: InputMaybe; last_transaction_version?: InputMaybe; owner_address?: InputMaybe; registered_address?: InputMaybe; subdomain?: InputMaybe; subdomain_expiration_policy?: InputMaybe; token_name?: InputMaybe; token_standard?: InputMaybe; }; /** select columns of table "current_aptos_names" */ declare enum CurrentAptosNamesSelectColumn { /** column name */ Domain = "domain", /** column name */ DomainExpirationTimestamp = "domain_expiration_timestamp", /** column name */ DomainWithSuffix = "domain_with_suffix", /** column name */ ExpirationTimestamp = "expiration_timestamp", /** column name */ IsActive = "is_active", /** column name */ IsPrimary = "is_primary", /** column name */ LastTransactionVersion = "last_transaction_version", /** column name */ OwnerAddress = "owner_address", /** column name */ RegisteredAddress = "registered_address", /** column name */ Subdomain = "subdomain", /** column name */ SubdomainExpirationPolicy = "subdomain_expiration_policy", /** column name */ TokenName = "token_name", /** column name */ TokenStandard = "token_standard" } /** select "current_aptos_names_aggregate_bool_exp_bool_and_arguments_columns" columns of table "current_aptos_names" */ declare enum CurrentAptosNamesSelectColumnCurrentAptosNamesAggregateBoolExpBoolAndArgumentsColumns { /** column name */ IsActive = "is_active", /** column name */ IsPrimary = "is_primary" } /** select "current_aptos_names_aggregate_bool_exp_bool_or_arguments_columns" columns of table "current_aptos_names" */ declare enum CurrentAptosNamesSelectColumnCurrentAptosNamesAggregateBoolExpBoolOrArgumentsColumns { /** column name */ IsActive = "is_active", /** column name */ IsPrimary = "is_primary" } /** Boolean expression to filter rows from the table "current_fungible_asset_balances". All fields are combined with a logical 'AND'. */ type CurrentFungibleAssetBalancesBoolExp = { _and?: InputMaybe>; _not?: InputMaybe; _or?: InputMaybe>; amount?: InputMaybe; amount_v1?: InputMaybe; amount_v2?: InputMaybe; asset_type?: InputMaybe; asset_type_v1?: InputMaybe; asset_type_v2?: InputMaybe; is_frozen?: InputMaybe; is_primary?: InputMaybe; last_transaction_timestamp?: InputMaybe; last_transaction_timestamp_v1?: InputMaybe; last_transaction_timestamp_v2?: InputMaybe; last_transaction_version?: InputMaybe; last_transaction_version_v1?: InputMaybe; last_transaction_version_v2?: InputMaybe; metadata?: InputMaybe; owner_address?: InputMaybe; storage_id?: InputMaybe; token_standard?: InputMaybe; }; /** Boolean expression to filter rows from the table "fungible_asset_activities". All fields are combined with a logical 'AND'. */ type FungibleAssetActivitiesBoolExp = { _and?: InputMaybe>; _not?: InputMaybe; _or?: InputMaybe>; amount?: InputMaybe; asset_type?: InputMaybe; block_height?: InputMaybe; entry_function_id_str?: InputMaybe; event_index?: InputMaybe; gas_fee_payer_address?: InputMaybe; is_frozen?: InputMaybe; is_gas_fee?: InputMaybe; is_transaction_success?: InputMaybe; metadata?: InputMaybe; owner_address?: InputMaybe; owner_aptos_names?: InputMaybe; owner_aptos_names_aggregate?: InputMaybe; storage_id?: InputMaybe; storage_refund_amount?: InputMaybe; token_standard?: InputMaybe; transaction_timestamp?: InputMaybe; transaction_version?: InputMaybe; type?: InputMaybe; }; /** Boolean expression to filter rows from the table "fungible_asset_metadata". All fields are combined with a logical 'AND'. */ type FungibleAssetMetadataBoolExp = { _and?: InputMaybe>; _not?: InputMaybe; _or?: InputMaybe>; asset_type?: InputMaybe; creator_address?: InputMaybe; decimals?: InputMaybe; icon_uri?: InputMaybe; last_transaction_timestamp?: InputMaybe; last_transaction_version?: InputMaybe; maximum_v2?: InputMaybe; name?: InputMaybe; project_uri?: InputMaybe; supply_aggregator_table_handle_v1?: InputMaybe; supply_aggregator_table_key_v1?: InputMaybe; supply_v2?: InputMaybe; symbol?: InputMaybe; token_standard?: InputMaybe; }; type JsonbCastExp = { String?: InputMaybe; }; /** Boolean expression to compare columns of type "jsonb". All fields are combined with logical 'AND'. */ type JsonbComparisonExp = { _cast?: InputMaybe; /** is the column contained in the given json value */ _contained_in?: InputMaybe; /** does the column contain the given json value at the top level */ _contains?: InputMaybe; _eq?: InputMaybe; _gt?: InputMaybe; _gte?: InputMaybe; /** does the string exist as a top-level key in the column */ _has_key?: InputMaybe; /** do all of these strings exist as top-level keys in the column */ _has_keys_all?: InputMaybe>; /** do any of these strings exist as top-level keys in the column */ _has_keys_any?: InputMaybe>; _in?: InputMaybe>; _is_null?: InputMaybe; _lt?: InputMaybe; _lte?: InputMaybe; _neq?: InputMaybe; _nin?: InputMaybe>; }; /** Boolean expression to compare columns of type "numeric". All fields are combined with logical 'AND'. */ type NumericComparisonExp = { _eq?: InputMaybe; _gt?: InputMaybe; _gte?: InputMaybe; _in?: InputMaybe>; _is_null?: InputMaybe; _lt?: InputMaybe; _lte?: InputMaybe; _neq?: InputMaybe; _nin?: InputMaybe>; }; /** Boolean expression to filter rows from the table "table_items". All fields are combined with a logical 'AND'. */ type TableItemsBoolExp = { _and?: InputMaybe>; _not?: InputMaybe; _or?: InputMaybe>; decoded_key?: InputMaybe; decoded_value?: InputMaybe; key?: InputMaybe; table_handle?: InputMaybe; transaction_version?: InputMaybe; write_set_change_index?: InputMaybe; }; /** Boolean expression to filter rows from the table "table_metadatas". All fields are combined with a logical 'AND'. */ type TableMetadatasBoolExp = { _and?: InputMaybe>; _not?: InputMaybe; _or?: InputMaybe>; handle?: InputMaybe; key_type?: InputMaybe; value_type?: InputMaybe; }; /** Boolean expression to compare columns of type "timestamp". All fields are combined with logical 'AND'. */ type TimestampComparisonExp = { _eq?: InputMaybe; _gt?: InputMaybe; _gte?: InputMaybe; _in?: InputMaybe>; _is_null?: InputMaybe; _lt?: InputMaybe; _lte?: InputMaybe; _neq?: InputMaybe; _nin?: InputMaybe>; }; /** * Creates an object address from creator address and seed * * @param creatorAddress The object creator account address * @param seed The seed in either Uint8Array | string type * * @returns The object account address * @group Implementation * @category Account (On-Chain Model) */ declare const createObjectAddress: (creatorAddress: AccountAddress, seed: Uint8Array | string) => AccountAddress; /** * Creates a resource address from creator address and seed * * @param creatorAddress The creator account address * @param seed The seed in either Uint8Array | string type * * @returns The resource account address * @group Implementation * @category Account (On-Chain Model) */ declare const createResourceAddress: (creatorAddress: AccountAddress, seed: Uint8Array | string) => AccountAddress; /** * Creates a user derived object address from source address and derive_from address * * @param sourceAddress The source account address * @param deriveFromAddress The address to derive from * * @returns The user derived object address * @group Implementation * @category Account (On-Chain Model) */ declare const createUserDerivedObjectAddress: (sourceAddress: AccountAddress, deriveFromAddress: AccountAddress) => AccountAddress; /** * Creates a token object address from creator address, collection name and token name * * @param creatorAddress The token creator account address * @param collectionName The collection name * @param tokenName The token name * * @returns The token account address * @group Implementation * @category Account (On-Chain Model) */ declare const createTokenAddress: (creatorAddress: AccountAddress, collectionName: string, tokenName: string) => AccountAddress; declare class AbstractSignature extends Signature { readonly value: Uint8Array; constructor(value: HexInput); serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): AbstractSignature; } declare class AbstractPublicKey extends AccountPublicKey { readonly accountAddress: AccountAddress; constructor(accountAddress: AccountAddress); authKey(): AuthenticationKey; verifySignature(args: VerifySignatureArgs): boolean; verifySignatureAsync(args: VerifySignatureAsyncArgs): Promise; serialize(serializer: Serializer): void; } /** * Represents ephemeral public keys for Aptos Keyless accounts. * * These keys are used only temporarily within Keyless accounts and are not utilized as public keys for account identification. * @group Implementation * @category Serialization */ declare class EphemeralPublicKey extends PublicKey { /** * The public key itself * @group Implementation * @category Serialization */ readonly publicKey: PublicKey; /** * An enum indicating the scheme of the ephemeral public key * @group Implementation * @category Serialization */ readonly variant: EphemeralPublicKeyVariant; /** * Creates an instance of EphemeralPublicKey using the provided public key. * This constructor ensures that only supported signature types are accepted. * * @param publicKey - The public key to be used for the ephemeral public key. * @throws Error if the signature type is unsupported. * @group Implementation * @category Serialization */ constructor(publicKey: PublicKey); /** * Verifies a signed message using the ephemeral public key. * * @param args - The arguments for the verification. * @param args.message - The message that was signed. * @param args.signature - The signature that was signed by the private key of the ephemeral public key. * @returns true if the signature is valid, otherwise false. * @group Implementation * @category Serialization */ verifySignature(args: { message: HexInput; signature: EphemeralSignature; }): boolean; verifySignatureAsync(args: { aptosConfig: AptosConfig; message: HexInput; signature: EphemeralSignature; }): Promise; /** * Serializes the current instance, specifically handling the Ed25519 signature type. * This function ensures that the signature is properly serialized using the provided serializer. * * @param serializer - The serializer instance used to serialize the signature. * @throws Error if the signature type is unknown. * @group Implementation * @category Serialization */ serialize(serializer: Serializer): void; /** * Deserializes an EphemeralSignature from the provided deserializer. * This function allows you to retrieve an EphemeralSignature based on the deserialized data. * * @param deserializer - The deserializer instance used to read the serialized data. * @group Implementation * @category Serialization */ static deserialize(deserializer: Deserializer): EphemeralPublicKey; /** * Determines if the provided public key is an instance of `EphemeralPublicKey`. * * @param publicKey - The public key to check. * @returns A boolean indicating whether the public key is an ephemeral type. * @group Implementation * @category Serialization */ static isPublicKey(publicKey: PublicKey): publicKey is EphemeralPublicKey; } /** * Represents ephemeral signatures used in Aptos Keyless accounts. * * These signatures are utilized within the KeylessSignature framework. * @group Implementation * @category Serialization */ declare class EphemeralSignature extends Signature { /** * The signature signed by the private key of an EphemeralKeyPair * @group Implementation * @category Serialization */ readonly signature: Signature; constructor(signature: Signature); /** * Deserializes an ephemeral signature from a hexadecimal input. * This function allows you to convert a hexadecimal representation of an ephemeral signature into its deserialized form for * further processing. * * @param hexInput - The hexadecimal input representing the ephemeral signature. * @group Implementation * @category Serialization */ static fromHex(hexInput: HexInput): EphemeralSignature; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): EphemeralSignature; } /** * An abstract representation of a cryptographic proof associated with specific * zero-knowledge proof schemes, such as Groth16 and PLONK. * @group Implementation * @category Serialization */ declare abstract class Proof extends Serializable { } /** * The response for keyless configuration containing the maximum committed EPK bytes. * @group Implementation * @category Types */ type KeylessConfigurationResponse = { max_commited_epk_bytes: number; max_exp_horizon_secs: string; max_extra_field_bytes: number; max_iss_val_bytes: number; max_jwt_header_b64_bytes: number; max_signatures_per_txn: number; override_aud_vals: string[]; training_wheels_pubkey: { vec: [string]; }; }; /** * The response containing the Groth16 verification key, including the alpha_g1 component. * @group Implementation * @category Types */ type Groth16VerificationKeyResponse = { alpha_g1: string; beta_g2: string; delta_g2: string; gamma_abc_g1: [string, string]; gamma_g2: string; }; type MoveAnyStruct = { variant: { data: string; type_name: string; }; }; /** * @group Implementation * @category Serialization */ declare const EPK_HORIZON_SECS = 10000000; /** * @group Implementation * @category Serialization */ declare const MAX_AUD_VAL_BYTES = 120; /** * @group Implementation * @category Serialization */ declare const MAX_UID_KEY_BYTES = 30; /** * @group Implementation * @category Serialization */ declare const MAX_UID_VAL_BYTES = 330; /** * @group Implementation * @category Serialization */ declare const MAX_ISS_VAL_BYTES = 120; /** * @group Implementation * @category Serialization */ declare const MAX_EXTRA_FIELD_BYTES = 350; /** * @group Implementation * @category Serialization */ declare const MAX_JWT_HEADER_B64_BYTES = 300; /** * @group Implementation * @category Serialization */ declare const MAX_COMMITED_EPK_BYTES = 93; /** * Represents a Keyless Public Key used for authentication. * * This class encapsulates the public key functionality for keyless authentication, * including methods for generating and verifying signatures, as well as serialization * and deserialization of the key. The KeylessPublicKey is represented in the SDK * as `AnyPublicKey`. * @group Implementation * @category Serialization */ declare class KeylessPublicKey extends AccountPublicKey { /** * The number of bytes that `idCommitment` should be * @group Implementation * @category Serialization */ static readonly ID_COMMITMENT_LENGTH: number; /** * The value of the 'iss' claim on the JWT which identifies the OIDC provider. * @group Implementation * @category Serialization */ readonly iss: string; /** * A value representing a cryptographic commitment to a user identity. * * It is calculated from the aud, uidKey, uidVal, pepper. * @group Implementation * @category Serialization */ readonly idCommitment: Uint8Array; /** * Constructs an instance with the specified parameters for cryptographic operations. * * @param args - The parameters required to initialize the instance. * @param args.alphaG1 - The hex representation of the alpha G1 value. * @param args.betaG2 - The hex representation of the beta G2 value. * @param args.deltaG2 - The hex representation of the delta G2 value. * @param args.gammaAbcG1 - An array containing two hex representations for gamma ABC G1 values. * @param args.gammaG2 - The hex representation of the gamma G2 value. * @group Implementation * @category Serialization */ constructor(iss: string, idCommitment: HexInput); /** * Get the authentication key for the keyless public key. * * @returns AuthenticationKey - The authentication key derived from the keyless public key. * @group Implementation * @category Serialization */ authKey(): AuthenticationKey; /** * Verifies the validity of a signature for a given message. * * @param args - The arguments for signature verification. * @param args.message - The message that was signed. * @param args.signature - The signature to verify against the message. * @param args.jwk - The JWK to use for verification. * @param args.keylessConfig - The keyless configuration to use for verification. * @returns true if the signature is valid; otherwise, false. * @group Implementation * @category Serialization */ verifySignature(args: { message: HexInput; signature: Signature; jwk: MoveJWK; keylessConfig: KeylessConfiguration; }): boolean; /** * Verifies a keyless signature for a given message. It will fetch the keyless configuration and the JWK to * use for verification from the appropriate network as defined by the aptosConfig. * * @param args.aptosConfig The aptos config to use for fetching the keyless configuration. * @param args.message The message to verify the signature against. * @param args.signature The signature to verify. * @param args.options.throwErrorWithReason Whether to throw an error with the reason for the failure instead of returning false. * @returns true if the signature is valid */ verifySignatureAsync(args: { aptosConfig: AptosConfig; message: HexInput; signature: Signature; options?: { throwErrorWithReason?: boolean; }; }): Promise; /** * Serializes the current instance into a format suitable for transmission or storage. * This function ensures that all relevant fields are properly serialized, including the proof and optional fields. * * @param serializer - The serializer instance used to perform the serialization. * @param serializer.proof - The proof to be serialized. * @param serializer.expHorizonSecs - The expiration horizon in seconds. * @param serializer.extraField - An optional additional field for serialization. * @param serializer.overrideAudVal - An optional override value for auditing. * @param serializer.trainingWheelsSignature - An optional signature for training wheels. * @group Implementation * @category Serialization */ serialize(serializer: Serializer): void; /** * Deserializes a ZeroKnowledgeSig object from the provided deserializer. * This function allows you to reconstruct a ZeroKnowledgeSig instance from its serialized form. * * @param deserializer - The deserializer instance used to read the serialized data. * @returns A new instance of ZeroKnowledgeSig. * @group Implementation * @category Serialization */ static deserialize(deserializer: Deserializer): KeylessPublicKey; /** * Loads a KeylessPublicKey instance from the provided deserializer. * This function is used to deserialize the necessary components to create a KeylessPublicKey. * * @param deserializer - The deserializer used to extract the string and byte data. * @param deserializer.deserializeStr - A method to deserialize a string value. * @param deserializer.deserializeBytes - A method to deserialize byte data. * @returns A new instance of KeylessPublicKey. * @group Implementation * @category Serialization */ static load(deserializer: Deserializer): KeylessPublicKey; /** * Determines if the provided public key is an instance of KeylessPublicKey. * * @param publicKey - The public key to check. * @returns A boolean indicating whether the public key is a KeylessPublicKey instance. * @group Implementation * @category Serialization */ static isPublicKey(publicKey: PublicKey): publicKey is KeylessPublicKey; /** * Creates a KeylessPublicKey from the JWT components plus pepper * * @param args.iss the iss of the identity * @param args.uidKey the key to use to get the uidVal in the JWT token * @param args.uidVal the value of the uidKey in the JWT token * @param args.aud the client ID of the application * @param args.pepper The pepper used to maintain privacy of the account * @returns KeylessPublicKey * @group Implementation * @category Serialization */ static create(args: { iss: string; uidKey: string; uidVal: string; aud: string; pepper: HexInput; }): KeylessPublicKey; /** * Creates a KeylessPublicKey instance from a JWT and a pepper value. * This function is useful for generating a public key that can be used for authentication based on the provided JWT claims and pepper. * * @param args - The arguments for creating the KeylessPublicKey. * @param args.jwt - The JSON Web Token to decode. * @param args.pepper - The pepper value used in the key creation process. * @param args.uidKey - An optional key to retrieve the unique identifier from the JWT payload, defaults to "sub". * @returns A KeylessPublicKey instance created from the provided JWT and pepper. * @group Implementation * @category Serialization */ static fromJwtAndPepper(args: { jwt: string; pepper: HexInput; uidKey?: string; }): KeylessPublicKey; /** * Checks if the provided public key is a valid instance by verifying its structure and types. * * @param publicKey - The public key to validate. * @returns A boolean indicating whether the public key is a valid instance. * @group Implementation * @category Serialization */ static isInstance(publicKey: PublicKey): boolean; } declare function verifyKeylessSignature(args: { publicKey: KeylessPublicKey | FederatedKeylessPublicKey; aptosConfig: AptosConfig; message: HexInput; signature: Signature; keylessConfig?: KeylessConfiguration; jwk?: MoveJWK; options?: { throwErrorWithReason?: boolean; }; }): Promise; /** * Syncronously verifies a keyless signature for a given message. You need to provide the keyless configuration and the * JWK to use for verification. * * @param args.message The message to verify the signature against. * @param args.signature The signature to verify. * @param args.keylessConfig The keyless configuration. * @param args.jwk The JWK to use for verification. * @returns true if the signature is valid * @throws KeylessError if the signature is invalid */ declare function verifyKeylessSignatureWithJwkAndConfig(args: { publicKey: KeylessPublicKey | FederatedKeylessPublicKey; message: HexInput; signature: Signature; keylessConfig: KeylessConfiguration; jwk: MoveJWK; }): void; /** * Fetches the JWK from the issuer's well-known JWKS endpoint. * * @param args.publicKey The keyless public key which contains the issuer the address to fetch the JWK from (0x1 if not federated). * @param args.kid The kid of the JWK to fetch * @returns A JWK matching the `kid` in the JWT header. * @throws {KeylessError} If the JWK cannot be fetched */ declare function fetchJWK(args: { aptosConfig: AptosConfig; publicKey: KeylessPublicKey | FederatedKeylessPublicKey; kid: string; }): Promise; /** * Represents a signature of a message signed via a Keyless Account, utilizing proofs or a JWT token for authentication. * @group Implementation * @category Serialization */ declare class KeylessSignature extends Signature { /** * The inner signature ZeroKnowledgeSignature or OpenIdSignature * @group Implementation * @category Serialization */ readonly ephemeralCertificate: EphemeralCertificate; /** * The jwt header in the token used to create the proof/signature. In json string representation. * @group Implementation * @category Serialization */ readonly jwtHeader: string; /** * The expiry timestamp in seconds of the EphemeralKeyPair used to sign * @group Implementation * @category Serialization */ readonly expiryDateSecs: number; /** * The ephemeral public key used to verify the signature * @group Implementation * @category Serialization */ readonly ephemeralPublicKey: EphemeralPublicKey; /** * The signature resulting from signing with the private key of the EphemeralKeyPair * @group Implementation * @category Serialization */ readonly ephemeralSignature: EphemeralSignature; constructor(args: { jwtHeader: string; ephemeralCertificate: EphemeralCertificate; expiryDateSecs: number; ephemeralPublicKey: EphemeralPublicKey; ephemeralSignature: EphemeralSignature; }); /** * Get the kid of the JWT used to derive the Keyless Account used to sign. * * @returns the kid as a string */ getJwkKid(): string; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): KeylessSignature; static getSimulationSignature(): KeylessSignature; static isSignature(signature: Signature): signature is KeylessSignature; } /** * Represents an ephemeral certificate containing a signature, specifically a ZeroKnowledgeSig. * This class can be extended to support additional signature types, such as OpenIdSignature. * * @extends Signature * @group Implementation * @category Serialization */ declare class EphemeralCertificate extends Signature { readonly signature: Signature; /** * Index of the underlying enum variant * @group Implementation * @category Serialization */ readonly variant: EphemeralCertificateVariant; constructor(signature: Signature, variant: EphemeralCertificateVariant); /** * Get the public key in bytes (Uint8Array). * * @returns Uint8Array representation of the public key * @group Implementation * @category Serialization */ toUint8Array(): Uint8Array; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): EphemeralCertificate; } /** * Represents a fixed-size byte array of 32 bytes, extending the Serializable class. * This class is used for handling and serializing G1 bytes in cryptographic operations. * * @extends Serializable * @group Implementation * @category Serialization */ declare class G1Bytes extends Serializable { private static readonly B; data: Uint8Array; constructor(data: HexInput); serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): G1Bytes; toArray(): string[]; /** * Converts the G1 bytes to a projective point. * @returns The projective point. */ toProjectivePoint(): ProjPointType; } /** * Represents a 64-byte G2 element in a cryptographic context. * This class provides methods for serialization and deserialization of G2 bytes. * * @extends Serializable * @group Implementation * @category Serialization */ declare class G2Bytes extends Serializable { /** * The constant b value used in G2 point calculations */ private static readonly B; data: Uint8Array; constructor(data: HexInput); serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): G2Bytes; toArray(): [string, string][]; toProjectivePoint(): ProjPointType; } /** * Represents a Groth16 zero-knowledge proof, consisting of three proof points in compressed serialization format. * The points are the compressed serialization of affine representation of the proof. * * @extends Proof * @group Implementation * @category Serialization */ declare class Groth16Zkp extends Proof { /** * The bytes of G1 proof point a * @group Implementation * @category Serialization */ a: G1Bytes; /** * The bytes of G2 proof point b * @group Implementation * @category Serialization */ b: G2Bytes; /** * The bytes of G1 proof point c * @group Implementation * @category Serialization */ c: G1Bytes; constructor(args: { a: HexInput; b: HexInput; c: HexInput; }); serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): Groth16Zkp; toSnarkJsJson(): { protocol: string; curve: string; pi_a: string[]; pi_b: [string, string][]; pi_c: string[]; }; } /** * Represents a Groth16 proof and statement, consisting of a Groth16 proof and a public inputs hash. * This is used to generate the signing message for the training wheels signature. * * @extends Serializable * @group Implementation * @category Serialization */ declare class Groth16ProofAndStatement extends Serializable { /** * The Groth16 proof * @group Implementation * @category Serialization */ proof: Groth16Zkp; /** * The public inputs hash as a 32 byte Uint8Array * @group Implementation * @category Serialization */ publicInputsHash: Uint8Array; /** * The domain separator prefix used when hashing. * @group Implementation * @category Account (On-Chain Model) */ readonly domainSeparator = "APTOS::Groth16ProofAndStatement"; constructor(proof: Groth16Zkp, publicInputsHash: HexInput | bigint); serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): Groth16ProofAndStatement; hash(): Uint8Array; } /** * Represents a container for different types of zero-knowledge proofs. * * @extends Serializable * @group Implementation * @category Serialization */ declare class ZkProof extends Serializable { readonly proof: Proof; /** * Index of the underlying enum variant * @group Implementation * @category Serialization */ readonly variant: ZkpVariant; constructor(proof: Proof, variant: ZkpVariant); serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): ZkProof; } /** * Represents a zero-knowledge signature, encapsulating the proof and its associated metadata. * * @extends Signature * @group Implementation * @category Serialization */ declare class ZeroKnowledgeSig extends Signature { /** * The proof * @group Implementation * @category Serialization */ readonly proof: ZkProof; /** * The max lifespan of the proof * @group Implementation * @category Serialization */ readonly expHorizonSecs: number; /** * A key value pair on the JWT token that can be specified on the signature which would reveal the value on chain. * Can be used to assert identity or other attributes. * @group Implementation * @category Serialization */ readonly extraField?: string; /** * The 'aud' value of the recovery service which is set when recovering an account. * @group Implementation * @category Serialization */ readonly overrideAudVal?: string; /** * The training wheels signature * @group Implementation * @category Serialization */ readonly trainingWheelsSignature?: EphemeralSignature; constructor(args: { proof: ZkProof; expHorizonSecs: number; extraField?: string; overrideAudVal?: string; trainingWheelsSignature?: EphemeralSignature; }); /** * Deserialize a ZeroKnowledgeSig object from its BCS serialization in bytes. * * @param bytes - The bytes representing the serialized ZeroKnowledgeSig. * @returns ZeroKnowledgeSig - The deserialized ZeroKnowledgeSig object. * @group Implementation * @category Serialization */ static fromBytes(bytes: Uint8Array): ZeroKnowledgeSig; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): ZeroKnowledgeSig; } /** * Represents the on-chain configuration for how Keyless accounts operate. * * @remarks * This class encapsulates the verification key and the maximum lifespan of ephemeral key pairs, * which are essential for the functionality of Keyless accounts. * @group Implementation * @category Serialization */ declare class KeylessConfiguration { /** * The verification key used to verify Groth16 proofs on chain * @group Implementation * @category Serialization */ readonly verificationKey: Groth16VerificationKey; /** * The maximum lifespan of an ephemeral key pair. This is configured on chain. * @group Implementation * @category Serialization */ readonly maxExpHorizonSecs: number; /** * The public key of the training wheels account. * @group Implementation * @category Serialization */ readonly trainingWheelsPubkey?: EphemeralPublicKey; /** * The maximum number of bytes that can be used for the extra field. * @group Implementation * @category Serialization */ readonly maxExtraFieldBytes: number; /** * The maximum number of bytes that can be used for the JWT header. * @group Implementation * @category Serialization */ readonly maxJwtHeaderB64Bytes: number; /** * The maximum number of bytes that can be used for the issuer value. * @group Implementation * @category Serialization */ readonly maxIssValBytes: number; /** * The maximum number of bytes that can be used for the committed ephemeral public key. * @group Implementation * @category Serialization */ readonly maxCommitedEpkBytes: number; constructor(args: { verificationKey: Groth16VerificationKey; trainingWheelsPubkey?: HexInput; maxExpHorizonSecs?: number; maxExtraFieldBytes?: number; maxJwtHeaderB64Bytes?: number; maxIssValBytes?: number; maxCommitedEpkBytes?: number; }); /** * Creates a new KeylessConfiguration instance from a Groth16VerificationKeyResponse and a KeylessConfigurationResponse. * @param res - The Groth16VerificationKeyResponse object containing the verification key data. * @param config - The KeylessConfigurationResponse object containing the configuration data. * @returns A new KeylessConfiguration instance. */ static create(res: Groth16VerificationKeyResponse, config: KeylessConfigurationResponse): KeylessConfiguration; } /** * Represents the verification key stored on-chain used to verify Groth16 proofs. * @group Implementation * @category Serialization */ declare class Groth16VerificationKey { /** * The `alpha * G`, where `G` is the generator of G1 * @group Implementation * @category Serialization */ readonly alphaG1: G1Bytes; /** * The `alpha * H`, where `H` is the generator of G2 * @group Implementation * @category Serialization */ readonly betaG2: G2Bytes; /** * The `delta * H`, where `H` is the generator of G2 * @group Implementation * @category Serialization */ readonly deltaG2: G2Bytes; /** * The `gamma^{-1} * (beta * a_i + alpha * b_i + c_i) * H`, where H is the generator of G1 * @group Implementation * @category Serialization */ readonly gammaAbcG1: [G1Bytes, G1Bytes]; /** * The `gamma * H`, where `H` is the generator of G2 * @group Implementation * @category Serialization */ readonly gammaG2: G2Bytes; constructor(args: { alphaG1: HexInput; betaG2: HexInput; deltaG2: HexInput; gammaAbcG1: [HexInput, HexInput]; gammaG2: HexInput; }); /** * Calculates the hash of the serialized form of the verification key. * This is useful for comparing verification keys or using them as unique identifiers. * * @returns The SHA3-256 hash of the serialized verification key as a Uint8Array */ hash(): Uint8Array; serialize(serializer: Serializer): void; /** * Converts a Groth16VerificationKeyResponse object into a Groth16VerificationKey instance. * * @param res - The Groth16VerificationKeyResponse object containing the verification key data. * @param res.alpha_g1 - The alpha G1 value from the response. * @param res.beta_g2 - The beta G2 value from the response. * @param res.delta_g2 - The delta G2 value from the response. * @param res.gamma_abc_g1 - The gamma ABC G1 value from the response. * @param res.gamma_g2 - The gamma G2 value from the response. * @returns A Groth16VerificationKey instance constructed from the provided response data. * @group Implementation * @category Serialization */ static fromGroth16VerificationKeyResponse(res: Groth16VerificationKeyResponse): Groth16VerificationKey; /** * Verifies a Groth16 proof using the verification key given the public inputs hash and the proof. * * @param args.publicInputsHash The public inputs hash * @param args.groth16Proof The Groth16 proof * @returns true if the proof is valid */ verifyProof(args: { publicInputsHash: bigint; groth16Proof: Groth16Zkp; }): boolean; /** * Converts the verification key to a JSON format compatible with snarkjs groth16.verify * * @returns An object containing the verification key in snarkjs format * @group Implementation * @category Serialization */ toSnarkJsJson(): { protocol: string; curve: string; nPublic: number; vk_alpha_1: string[]; vk_beta_2: [string, string][]; vk_gamma_2: [string, string][]; vk_delta_2: [string, string][]; IC: string[][]; }; } /** * Retrieves the configuration parameters for Keyless Accounts on the blockchain, including the verifying key and the maximum * expiry horizon. * * @param args - The arguments for retrieving the keyless configuration. * @param args.aptosConfig - The Aptos configuration object containing network details. * @param args.options - Optional parameters for the request. * @param args.options.ledgerVersion - The ledger version to query; if not provided, the latest version will be used. * @returns KeylessConfiguration - The configuration object containing the verifying key and maximum expiry horizon. * @group Implementation * @category Serialization */ declare function getKeylessConfig(args: { aptosConfig: AptosConfig; options?: LedgerVersionArg; }): Promise; /** * Parses a JWT and returns the 'iss', 'aud', and 'uid' values. * * @param args - The arguments for parsing the JWT. * @param args.jwt - The JWT to parse. * @param args.uidKey - The key to use for the 'uid' value; defaults to 'sub'. * @returns The 'iss', 'aud', and 'uid' values from the JWT. */ declare function getIssAudAndUidVal(args: { jwt: string; uidKey?: string; }): { iss: string; aud: string; uidVal: string; }; /** * Fetches JWKs from the blockchain with optional caching. * * @param args.aptosConfig - The Aptos configuration object. * @param args.jwkAddr - Optional. The address to fetch JWKs from (for federated keyless). * @param args.options - Optional. Ledger version options. * @param args.useCache - Optional. Whether to use cached JWKs. Defaults to true. * @returns A map of issuer to JWK arrays. */ declare function getKeylessJWKs(args: { aptosConfig: AptosConfig; jwkAddr?: AccountAddressInput; options?: LedgerVersionArg; useCache?: boolean; }): Promise>; declare class MoveJWK extends Serializable { kid: string; kty: string; alg: string; e: string; n: string; constructor(args: { kid: string; kty: string; alg: string; e: string; n: string; }); serialize(serializer: Serializer): void; static fromMoveStruct(struct: MoveAnyStruct): MoveJWK; toScalar(): bigint; static deserialize(deserializer: Deserializer): MoveJWK; } interface JwtHeader { kid: string; } /** * Safely parses the JWT header. * @param jwtHeader The JWT header string * @returns Parsed JWT header as an object. * @throws KeylessError if the header is invalid or missing required fields */ declare function parseJwtHeader(jwtHeader: string): JwtHeader; /** * Represents the FederatedKeylessPublicKey public key * * These keys use an on-chain address as a source of truth for the JWK used to verify signatures. * * FederatedKeylessPublicKey authentication key is represented in the SDK as `AnyPublicKey`. * @group Implementation * @category Serialization */ declare class FederatedKeylessPublicKey extends AccountPublicKey { /** * The address that contains the JWK set to be used for verification. * @group Implementation * @category Serialization */ readonly jwkAddress: AccountAddress; /** * The inner public key which contains the standard Keyless public key. * @group Implementation * @category Serialization */ readonly keylessPublicKey: KeylessPublicKey; constructor(jwkAddress: AccountAddressInput, keylessPublicKey: KeylessPublicKey); /** * Get the authentication key for the federated keyless public key * * @returns AuthenticationKey * @group Implementation * @category Serialization */ authKey(): AuthenticationKey; /** * Verifies a signed data with a public key * * @param args.message message * @param args.signature The signature * @param args.jwk - The JWK to use for verification. * @param args.keylessConfig - The keyless configuration to use for verification. * @returns true if the signature is valid * @group Implementation * @category Serialization */ verifySignature(args: { message: HexInput; signature: Signature; jwk: MoveJWK; keylessConfig: KeylessConfiguration; }): boolean; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): FederatedKeylessPublicKey; static isPublicKey(publicKey: PublicKey): publicKey is FederatedKeylessPublicKey; /** * Verifies a keyless signature for a given message. It will fetch the keyless configuration and the JWK to * use for verification from the appropriate network as defined by the aptosConfig. * * @param args.aptosConfig The aptos config to use for fetching the keyless configuration. * @param args.message The message to verify the signature against. * @param args.signature The signature to verify. * @param args.options.throwErrorWithReason Whether to throw an error with the reason for the failure instead of returning false. * @returns true if the signature is valid */ verifySignatureAsync(args: { aptosConfig: AptosConfig; message: HexInput; signature: KeylessSignature; options?: { throwErrorWithReason?: boolean; }; }): Promise; /** * Creates a FederatedKeylessPublicKey from the JWT components plus pepper * * @param args.iss the iss of the identity * @param args.uidKey the key to use to get the uidVal in the JWT token * @param args.uidVal the value of the uidKey in the JWT token * @param args.aud the client ID of the application * @param args.pepper The pepper used to maintain privacy of the account * @returns FederatedKeylessPublicKey * @group Implementation * @category Serialization */ static create(args: { iss: string; uidKey: string; uidVal: string; aud: string; pepper: HexInput; jwkAddress: AccountAddressInput; }): FederatedKeylessPublicKey; static fromJwtAndPepper(args: { jwt: string; pepper: HexInput; jwkAddress: AccountAddressInput; uidKey?: string; }): FederatedKeylessPublicKey; static isInstance(publicKey: PublicKey): boolean; } /** * Contains the derived cryptographic key as a Uint8Array. * @group Implementation * @category Serialization */ type DerivedKeys = { key: Uint8Array; chainCode: Uint8Array; }; /** * Aptos derive path is 637 * @group Implementation * @category Serialization */ declare const APTOS_HARDENED_REGEX: RegExp; /** * @group Implementation * @category Serialization */ declare const APTOS_BIP44_REGEX: RegExp; /** * Supported key types and their associated seeds. * @group Implementation * @category Serialization */ declare enum KeyType { ED25519 = "ed25519 seed" } /** * @group Implementation * @category Serialization */ declare const HARDENED_OFFSET = 2147483648; /** * Validate a BIP-44 derivation path string to ensure it meets the required format. * This function checks if the provided path adheres to the BIP-44 standard for Secp256k1. * Parse and validate a path that is compliant to BIP-44 in form m/44'/637'/{account_index}'/{change_index}/{address_index} * for Secp256k1 * * Note that for Secp256k1, the last two components must be non-hardened. * * @param path - The path string to validate (e.g. `m/44'/637'/0'/0/0`). * @group Implementation * @category Serialization */ declare function isValidBIP44Path(path: string): boolean; /** * Aptos derive path is 637 * * Parse and validate a path that is compliant to SLIP-0010 and BIP-44 * in form m/44'/637'/{account_index}'/{change_index}'/{address_index}'. * See SLIP-0010 {@link https://github.com/satoshilabs/slips/blob/master/slip-0044.md} * See BIP-44 {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki} * * Note that for Ed25519, all components must be hardened. * This is because non-hardened [PK] derivation would not work due to Ed25519's lack of a key homomorphism. * Specifically, you cannot derive the PK associated with derivation path a/b/c given the PK of a/b. * This is because the PK in Ed25519 is, more or less, computed as 𝑔𝐻(𝑠𝑘), * with the hash function breaking the homomorphism. * * @param path - The derivation path string to validate (e.g. `m/44'/637'/0'/0'/0'`). * @group Implementation * @category Serialization */ declare function isValidHardenedPath(path: string): boolean; /** * @group Implementation * @category Serialization */ declare const deriveKey: (hashSeed: Uint8Array | string, data: Uint8Array | string) => DerivedKeys; /** * Derive a child key from the private key * @param key * @param chainCode * @param index * @group Implementation * @category Serialization */ declare const CKDPriv: ({ key, chainCode }: DerivedKeys, index: number) => DerivedKeys; /** * Splits derive path into segments * @param path * @group Implementation * @category Serialization */ declare const splitPath: (path: string) => Array; /** * Normalizes the mnemonic by removing extra whitespace and making it lowercase * @param mnemonic the mnemonic seed phrase * @group Implementation * @category Serialization */ declare const mnemonicToSeed: (mnemonic: string) => Uint8Array; /** * Hashes a string to a field element via Poseidon hashing. * This function is useful for converting a string into a fixed-size hash that can be used in cryptographic applications. * * @param str - The string to be hashed. * @param maxSizeBytes - The maximum size in bytes for the resulting hash. * @returns bigint - The result of the hash. * @group Implementation * @category Serialization */ declare function hashStrToField(str: string, maxSizeBytes: number): bigint; /** * Pads and packs the given byte array to a specified maximum size and appends its length. * This function ensures that the byte array does not exceed the maximum size, throwing an error if it does. * It is useful for preparing byte data for further processing or transmission by ensuring a consistent format. * * @param bytes - The byte array to be padded and packed. * @param maxSizeBytes - The maximum allowed size for the byte array. * @throws Error if the length of the input bytes exceeds the maximum size. * @returns A new Uint8Array that contains the padded and packed bytes along with the length of the original byte array. * @group Implementation * @category Serialization */ declare function padAndPackBytesWithLen(bytes: Uint8Array, maxSizeBytes: number): bigint[]; /** * Converts a little-endian byte array into a BigInt. * This function is useful for interpreting byte data as a numerical value in a way that respects the little-endian format. * * @param bytes - The byte array to convert. * @returns The resulting BigInt representation of the byte array. * @group Implementation * @category Serialization */ declare function bytesToBigIntLE(bytes: Uint8Array): bigint; /** * Converts a bigint value into a little-endian byte array of a specified length. * This function is useful for representing large integers in a byte format, which is often required for cryptographic operations * or binary data manipulation. * * @param value - The number to convert into bytes. * @param length - The desired length of the resulting byte array. * @returns A Uint8Array containing the little-endian representation of the bigint value. * @group Implementation * @category Serialization */ declare function bigIntToBytesLE(value: bigint | number, length: number): Uint8Array; /** * Hashes up to 16 scalar elements via the Poseidon hashing algorithm. * Each element must be scalar fields of the BN254 elliptic curve group. * * @param inputs - An array of elements to be hashed, which can be of type number, bigint, or string. * @returns bigint - The result of the hash. * @throws Error - Throws an error if the input length exceeds the maximum allowed. * @group Implementation * @category Serialization */ declare function poseidonHash(inputs: (number | bigint | string)[]): bigint; /** * Represents a Secp256r1 ECDSA public key. * * @extends PublicKey * @property LENGTH - The length of the Secp256r1 public key in bytes. * @group Implementation * @category Serialization */ declare class Secp256r1PublicKey extends PublicKey { static readonly LENGTH: number; static readonly COMPRESSED_LENGTH: number; private readonly key; readonly keyType: string; /** * Create a new PublicKey instance from a HexInput, which can be a string or Uint8Array. * This constructor validates the length of the provided public key data. * * @param hexInput - A HexInput (string or Uint8Array) representing the public key data. * @throws Error if the length of the public key data is not equal to Secp256r1PublicKey.LENGTH or COMPRESSED_LENGTH. * @group Implementation * @category Serialization */ constructor(hexInput: HexInput); /** * Get the data as a Uint8Array representation. * * @returns Uint8Array representation of the data. * @group Implementation * @category Serialization */ toUint8Array(): Uint8Array; /** * Get the public key as a hex string with the 0x prefix. * * @returns string representation of the public key. * @group Implementation * @category Serialization */ toString(): string; /** * Converts the public key to BCS (Binary Canonical Serialization) bytes. * This function serializes the public key data into a byte array format suitable for transmission or storage. * * @returns Uint8Array representation of the serialized public key. * @group Implementation * @category Serialization */ bcsToBytes(): Uint8Array; /** * Verifies a Secp256r1 signature against the public key. * * This function checks the validity of a signature for a given message. * * @param args - The arguments for verifying the signature. * @param args.message - The message that was signed. * @param args.signature - The signature to verify against the public key. * @group Implementation * @category Serialization */ verifySignature(args: { message: HexInput; signature: Signature; }): boolean; /** * Note: Secp256r1Signatures can be verified synchronously. * * Verifies the provided signature against the given message. * This function helps ensure the integrity and authenticity of the message by confirming that the signature is valid. * * @param args - The arguments for signature verification. * @param args.message - The message that was signed. * @param args.signature - The signature to verify, which must be an instance of Secp256r1Signature. * @returns A boolean indicating whether the signature is valid for the given message. * @group Implementation * @category Serialization */ verifySignatureAsync(args: VerifySignatureAsyncArgs): Promise; /** * Serializes the data into a byte array using the provided serializer. * This function is essential for converting data into a format suitable for transmission or storage. * * @param serializer - The serializer instance used to convert the data. * @group Implementation * @category Serialization */ serialize(serializer: Serializer): void; /** * Deserializes a Secp256r1PublicKey from the provided deserializer. * This function allows you to reconstruct a Secp256r1PublicKey object from its serialized byte representation. * * @param deserializer - The deserializer instance used to read the serialized data. * @group Implementation * @category Serialization */ static deserialize(deserializer: Deserializer): Secp256r1PublicKey; /** * Loads a Secp256r1PublicKey from the provided deserializer. * * @param deserializer - The deserializer instance used to read the serialized data. * @group Implementation * @category Serialization */ static load(deserializer: Deserializer): Secp256r1PublicKey; /** * Determines if the provided public key is a valid instance of a Secp256r1 public key. * This function checks for the presence of a "key" property and validates the length of the key data. * * @param publicKey - The public key to validate. * @returns A boolean indicating whether the public key is a valid Secp256r1 public key. * @group Implementation * @category Serialization */ static isInstance(publicKey: PublicKey): publicKey is Secp256r1PublicKey; /** * Generates an authentication key from the public key using the Secp256r1 scheme. * This function is essential for creating a secure authentication key that can be used for further cryptographic operations. * * @returns {AuthenticationKey} The generated authentication key. * @group Implementation * @category Serialization */ authKey(): AuthenticationKey; } /** * Represents a Secp256r1 ECDSA private key, providing functionality to create, sign messages, * derive public keys, and serialize/deserialize the key. * @group Implementation * @category Serialization */ declare class Secp256r1PrivateKey extends PrivateKey { /** * Length of Secp256r1 ecdsa private key * @group Implementation * @category Serialization */ static readonly LENGTH: number; /** * The private key bytes * @private * @group Implementation * @category Serialization */ private readonly key; /** * Create a new PrivateKey instance from a Uint8Array or String. * * [Read about AIP-80](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md) * * @param hexInput A HexInput (string or Uint8Array) * @param strict If true, private key must AIP-80 compliant. * @group Implementation * @category Serialization */ constructor(hexInput: HexInput, strict?: boolean); /** * Get the private key in bytes (Uint8Array). * * @returns * @group Implementation * @category Serialization */ toUint8Array(): Uint8Array; /** * Get the private key as a string representation. * * @returns string representation of the private key * @group Implementation * @category Serialization */ toString(): string; /** * Get the private key as a hex string with the 0x prefix. * * @returns string representation of the private key. */ toHexString(): string; /** * Sign the given message with the private key. * This function generates a cryptographic signature for the provided message. * * @param message - A message in HexInput format to be signed. * @returns Signature - The generated signature for the provided message. * @group Implementation * @category Serialization */ sign(message: HexInput): Secp256r1Signature; /** * Serializes the data into a byte array using the provided serializer. * This function is essential for converting data into a format suitable for transmission or storage. * * @param serializer - The serializer instance used to convert the data. * @group Implementation * @category Serialization */ serialize(serializer: Serializer): void; /** * Deserializes a Secp256r1PrivateKey from the provided deserializer. * This function allows you to reconstruct a Secp256r1PrivateKey object from its serialized byte representation. * * @param deserializer - The deserializer instance used to read the serialized data. * @group Implementation * @category Serialization */ static deserialize(deserializer: Deserializer): Secp256r1PrivateKey; /** * Generate a new random private key. * * @returns Secp256r1PrivateKey - A newly generated Secp256r1 private key. * @group Implementation * @category Serialization */ static generate(): Secp256r1PrivateKey; /** * Derive the Secp256r1PublicKey from this private key. * * @returns Secp256r1PublicKey The derived public key. * @group Implementation * @category Serialization */ publicKey(): Secp256r1PublicKey; } declare class WebAuthnSignature extends Signature { signature: Hex; authenticatorData: Hex; clientDataJSON: Hex; constructor(signature: HexInput, authenticatorData: HexInput, clientDataJSON: HexInput); toUint8Array(): Uint8Array; serialize(serializer: Serializer): void; bcsToBytes(): Uint8Array; bcsToHex(): Hex; toStringWithoutPrefix(): string; static deserialize(deserializer: Deserializer): WebAuthnSignature; } /** * Represents a signature of a message signed using a Secp256r1 ECDSA private key. * * @group Implementation * @category Serialization */ declare class Secp256r1Signature extends Signature { /** * Secp256r1 ecdsa signatures are 256-bit. * @group Implementation * @category Serialization */ static readonly LENGTH = 64; /** * The signature bytes * @private * @group Implementation * @category Serialization */ private readonly data; /** * Create a new Signature instance from a Uint8Array or String. * * @param hexInput A HexInput (string or Uint8Array) * @group Implementation * @category Serialization */ constructor(hexInput: HexInput); /** * Get the signature in bytes (Uint8Array). * * @returns Uint8Array representation of the signature * @group Implementation * @category Serialization */ toUint8Array(): Uint8Array; /** * Get the signature as a hex string with the 0x prefix. * * @returns string representation of the signature * @group Implementation * @category Serialization */ toString(): string; /** * Serializes the data into a byte array using the provided serializer. * This function is essential for converting data into a format suitable for transmission or storage. * * @param serializer - The serializer instance used to convert the data. * @group Implementation * @category Serialization */ serialize(serializer: Serializer): void; /** * Deserializes a Secp256r1Signature from the provided deserializer. * This function allows you to reconstruct a Secp256r1Signature object from its serialized byte representation. * * @param deserializer - The deserializer instance used to read the serialized data. * @group Implementation * @category Serialization */ static deserialize(deserializer: Deserializer): Secp256r1Signature; } type BaseAccountPublicKey = Ed25519PublicKey | AnyPublicKey | MultiKey | MultiEd25519PublicKey; /** * Deserializes a public key from a hex string. * Attempts to deserialize using various public key types in sequence until one succeeds. * * @param publicKey - The hex string representation of the public key to deserialize * @returns The deserialized public key * @throws Error if deserialization fails for all supported key types or if multiple deserializations are found */ declare function deserializePublicKey(publicKey: HexInput): PublicKey; /** * Deserializes a signature from a hex string. * Attempts to deserialize using various signature types in sequence until one succeeds. * * @param signature - The hex string representation of the signature to deserialize * @returns The deserialized signature * @throws Error if deserialization fails for all supported signature types or if multiple deserializations are found */ declare function deserializeSignature(signature: HexInput): Signature; /** * Represents an abstract base class for transaction authenticators. * This class provides methods for serializing and deserializing different types of transaction authenticators. * * @extends Serializable * @group Implementation * @category Transactions */ declare abstract class TransactionAuthenticator extends Serializable { abstract serialize(serializer: Serializer): void; /** * Deserializes a TransactionAuthenticator from the provided deserializer. * This function helps in reconstructing the TransactionAuthenticator based on the variant index found in the serialized data. * * @param deserializer - The deserializer instance used to read the serialized data. * @group Implementation * @category Transactions */ static deserialize(deserializer: Deserializer): TransactionAuthenticator; isEd25519(): this is TransactionAuthenticatorEd25519; isMultiEd25519(): this is TransactionAuthenticatorMultiEd25519; isMultiAgent(): this is TransactionAuthenticatorMultiAgent; isFeePayer(): this is TransactionAuthenticatorFeePayer; isSingleSender(): this is TransactionAuthenticatorSingleSender; } /** * Represents a transaction authenticator using Ed25519 for a single signer transaction. * This class encapsulates the client's public key and the Ed25519 signature of a raw transaction. * * @param public_key - The client's public key. * @param signature - The Ed25519 signature of a raw transaction. * @see {@link https://aptos.dev/integration/creating-a-signed-transaction | Creating a Signed Transaction} * for details about generating a signature. * @group Implementation * @category Transactions */ declare class TransactionAuthenticatorEd25519 extends TransactionAuthenticator { readonly public_key: Ed25519PublicKey; readonly signature: Ed25519Signature; /** * Creates an instance of the class with the specified account authenticator. * * @param public_key - The Ed25519PublicKey that will be used for authentication. * @param signature - The Ed25519Signature that will be used for authentication. * @group Implementation * @category Transactions */ constructor(public_key: Ed25519PublicKey, signature: Ed25519Signature); /** * Serializes the transaction authenticator by encoding the sender information. * * @param serializer - The serializer instance used to perform the serialization. * @group Implementation * @category Transactions */ serialize(serializer: Serializer): void; /** * Loads a TransactionAuthenticatorSingleSender instance from the provided deserializer. * This function helps in deserializing the sender information to create a transaction authenticator. * * @param deserializer - The deserializer used to extract the sender data. * @group Implementation * @category Transactions */ static load(deserializer: Deserializer): TransactionAuthenticatorEd25519; } /** * Represents a transaction authenticator for multi-signature transactions using Ed25519. * This class is used to validate transactions that require multiple signatures from different signers. * * @param public_key - The public key of the client involved in the transaction. * @param signature - The multi-signature of the raw transaction. * @group Implementation * @category Transactions */ declare class TransactionAuthenticatorMultiEd25519 extends TransactionAuthenticator { readonly public_key: MultiEd25519PublicKey; readonly signature: MultiEd25519Signature; constructor(public_key: MultiEd25519PublicKey, signature: MultiEd25519Signature); serialize(serializer: Serializer): void; static load(deserializer: Deserializer): TransactionAuthenticatorMultiEd25519; } /** * Represents a transaction authenticator for a multi-agent transaction. * * This class manages the authentication process involving a primary sender and multiple secondary signers. * * @param sender - The authenticator for the sender account. * @param secondary_signer_addresses - An array of addresses for the secondary signers. * @param secondary_signers - An array of authenticators for the secondary signer accounts. * @group Implementation * @category Transactions */ declare class TransactionAuthenticatorMultiAgent extends TransactionAuthenticator { readonly sender: AccountAuthenticator; readonly secondary_signer_addresses: Array; readonly secondary_signers: Array; constructor(sender: AccountAuthenticator, secondary_signer_addresses: Array, secondary_signers: Array); serialize(serializer: Serializer): void; static load(deserializer: Deserializer): TransactionAuthenticatorMultiAgent; } /** * Represents a transaction authenticator specifically for fee payer transactions. * It encapsulates the sender's account authenticator, addresses of secondary signers, * their respective authenticators, and the fee payer's account information. * * @param sender - The authenticator for the sender's account. * @param secondary_signer_addresses - An array of addresses for secondary signers. * @param secondary_signers - An array of authenticators for secondary signers' accounts. * @param fee_payer - An object containing the fee payer's account address and authenticator. * @group Implementation * @category Transactions */ declare class TransactionAuthenticatorFeePayer extends TransactionAuthenticator { readonly sender: AccountAuthenticator; readonly secondary_signer_addresses: Array; readonly secondary_signers: Array; readonly fee_payer: { address: AccountAddress; authenticator: AccountAuthenticator; }; constructor(sender: AccountAuthenticator, secondary_signer_addresses: Array, secondary_signers: Array, fee_payer: { address: AccountAddress; authenticator: AccountAuthenticator; }); serialize(serializer: Serializer): void; static load(deserializer: Deserializer): TransactionAuthenticatorMultiAgent; } /** * Represents a single sender authenticator for transactions that require a single signer. * This class is responsible for managing the authentication of a transaction initiated by a single sender. * * @param sender - An instance of AccountAuthenticator that represents the account of the sender. * @group Implementation * @category Transactions */ declare class TransactionAuthenticatorSingleSender extends TransactionAuthenticator { readonly sender: AccountAuthenticator; constructor(sender: AccountAuthenticator); serialize(serializer: Serializer): void; static load(deserializer: Deserializer): TransactionAuthenticatorSingleSender; } /** * Represents a challenge required for the account owner to sign in order to rotate the authentication key. * @group Implementation * @category Transactions */ declare class RotationProofChallenge extends Serializable { readonly accountAddress: AccountAddress; readonly moduleName: MoveString; readonly structName: MoveString; readonly originator: AccountAddress; readonly currentAuthKey: AccountAddress; readonly newPublicKey: MoveVector; readonly sequenceNumber: U64; /** * Initializes a new instance of the class with the specified parameters. * This constructor sets up the necessary attributes for managing account keys. * * @param args - The parameters required to create the instance. * @param args.sequenceNumber - The sequence number associated with the transaction. * @param args.originator - The account address of the originator. * @param args.currentAuthKey - The current authentication key of the account. * @param args.newPublicKey - The new public key to be set for the account. * @group Implementation * @category Transactions */ constructor(args: { sequenceNumber: AnyNumber; originator: AccountAddress; currentAuthKey: AccountAddress; newPublicKey: PublicKey; }); /** * Serializes the properties of the current instance for transmission or storage. * This function helps in converting the instance data into a format suitable for serialization. * * @param serializer - The serializer used to serialize the instance properties. * @param serializer.accountAddress - The account address to serialize. * @param serializer.moduleName - The module name to serialize. * @param serializer.structName - The struct name to serialize. * @param serializer.sequenceNumber - The sequence number to serialize. * @param serializer.originator - The originator to serialize. * @param serializer.currentAuthKey - The current authentication key to serialize. * @param serializer.newPublicKey - The new public key to serialize. * @group Implementation * @category Transactions */ serialize(serializer: Serializer): void; } /** * Represents a signed transaction that includes a raw transaction and an authenticator. * The authenticator contains a client's public key and the signature of the raw transaction. * * @see {@link https://aptos.dev/integration/creating-a-signed-transaction | Creating a Signed Transaction} * @param raw_txn - The raw transaction to be signed. * @param authenticator - Contains a client's public key and the signature of the raw transaction. * Authenticator can have three variations: single signature, multi-signature, and multi-agent. * @see {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/authenticator.rs} for details. * @group Implementation * @category Transactions */ declare class SignedTransaction extends Serializable { readonly raw_txn: RawTransaction; readonly authenticator: TransactionAuthenticator; /** * Represents a signed transaction that includes a raw transaction and an authenticator. * The authenticator contains a client's public key and the signature of the raw transaction, * which can be of three types: single signature, multi-signature, and multi-agent. * * @param raw_txn The raw transaction to be signed. * @param authenticator Contains a client's public key and the signature of the raw transaction. The authenticator has 3 * flavors: single signature, multi-signature and multi-agent. * @see {@link https://aptos.dev/integration/creating-a-signed-transaction | Creating a Signed Transaction} * @see {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/authenticator.rs} for details. * @group Implementation * @category Transactions */ constructor(raw_txn: RawTransaction, authenticator: TransactionAuthenticator); /** * Serializes the raw transaction and its authenticator using the provided serializer. * This function is essential for preparing the transaction data for transmission or storage. * * @param serializer - The serializer instance used to serialize the transaction and authenticator. * @group Implementation * @category Transactions */ serialize(serializer: Serializer): void; /** * Deserializes a signed transaction from the provided deserializer. * This function allows you to reconstruct a SignedTransaction object from its serialized form, enabling further processing or validation. * * @param deserializer - The deserializer instance used to read the serialized data. * @group Implementation * @category Transactions */ static deserialize(deserializer: Deserializer): SignedTransaction; } /** * Determines if the provided argument is of type boolean. * This can help in validating input types before processing them further. * * @param arg - The argument to check, which can be of various types. * @returns A boolean indicating whether the argument is a boolean. * @group Implementation * @category Transactions */ declare function isBool(arg: SimpleEntryFunctionArgumentTypes): arg is boolean; /** * Checks if the provided argument is of type string. * * @param arg - The value to be checked for string type. * @returns A boolean indicating whether the argument is a string. * @group Implementation * @category Transactions */ declare function isString(arg: any): arg is string; /** * Determines if the provided argument is of type number. * * @param arg - The argument to check, which can be of various types. * @returns A boolean indicating whether the argument is a number. * @group Implementation * @category Transactions */ declare function isNumber(arg: SimpleEntryFunctionArgumentTypes): arg is number; /** * Converts a number or a string representation of a number into a number type. * This function is useful for ensuring that the input is in a consistent numeric format, * which can help prevent type mismatches in further processing. * * @param arg - The input value to be converted. This can be a number, a string representing a number, or any other type. * @returns Returns the converted number if the input is valid; otherwise, it returns undefined. * @group Implementation * @category Transactions */ declare function convertNumber(arg: SimpleEntryFunctionArgumentTypes): number | undefined; /** * Determines if the provided argument is a large number, which can be a number, bigint, or string representation of a number. * * @param arg - The argument to check, which can be of type number, bigint, or string. * @group Implementation * @category Transactions */ declare function isLargeNumber(arg: SimpleEntryFunctionArgumentTypes): arg is number | bigint | string; /** * Checks if the provided argument is empty, meaning it is either null or undefined. * * @param arg - The argument to check for emptiness. * @returns A boolean indicating whether the argument is empty. * @group Implementation * @category Transactions */ declare function isEmptyOption(arg: SimpleEntryFunctionArgumentTypes): arg is null | undefined; /** * Determines if the provided argument is a valid encoded entry function argument type. * This function helps validate that the argument conforms to the expected types for entry function parameters. * * @param arg - The argument to check, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes. * @group Implementation * @category Transactions */ declare function isEncodedEntryFunctionArgument(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is EntryFunctionArgumentTypes; /** * @group Implementation * @category Transactions */ declare function isBcsBool(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is Bool; /** * @group Implementation * @category Transactions */ declare function isBcsAddress(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is AccountAddress; /** * @group Implementation * @category Transactions */ declare function isBcsString(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is MoveString; /** * @group Implementation * @category Transactions */ declare function isBcsFixedBytes(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is FixedBytes; /** * @group Implementation * @category Transactions */ declare function isBcsU8(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U8; /** * @group Implementation * @category Transactions */ declare function isBcsU16(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U16; /** * @group Implementation * @category Transactions */ declare function isBcsU32(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U32; /** * @group Implementation * @category Transactions */ declare function isBcsU64(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U64; /** * @group Implementation * @category Transactions */ declare function isBcsU128(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U128; /** * @group Implementation * @category Transactions */ declare function isBcsU256(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U256; /** * @group Implementation * @category Transactions */ declare function isBcsI8(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is I8; /** * @group Implementation * @category Transactions */ declare function isBcsI16(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is I16; /** * @group Implementation * @category Transactions */ declare function isBcsI32(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is I32; /** * @group Implementation * @category Transactions */ declare function isBcsI64(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is I64; /** * @group Implementation * @category Transactions */ declare function isBcsI128(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is I128; /** * @group Implementation * @category Transactions */ declare function isBcsI256(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is I256; /** * Determines if the provided argument contains script data input by checking for the presence of bytecode. * * @param arg - The input data to be checked, which can either be a payload with remote ABI or a standard payload. * @param arg.bytecode - The bytecode of the script, present if the input is script data. * @param arg.function - The function associated with the transaction, which is relevant for standard payloads. * @param arg.args - The arguments for the function, applicable in the context of standard payloads. * @group Implementation * @category Transactions */ declare function isScriptDataInput(arg: InputGenerateTransactionPayloadDataWithRemoteABI | InputGenerateTransactionPayloadData): arg is InputScriptData; /** * Throws an error indicating a type mismatch for a specified argument position. * This function helps in debugging by providing clear feedback on expected types. * * @param expectedType - The type that was expected for the argument. * @param position - The position of the argument that caused the type mismatch. * @group Implementation * @category Transactions */ declare function throwTypeMismatch(expectedType: string, position: number): void; /** * Finds the index of the first non-signer argument in the function ABI parameters. * * A function is often defined with a `signer` or `&signer` arguments at the start, which are filled in * by signatures and not by the caller. This function helps identify the position of the first argument that * can be provided by the caller, allowing for easier handling of function parameters. * * @param functionAbi - The ABI of the function to analyze. * @returns The index of the first non-signer argument, or the length of the parameters array if none are found. * @group Implementation * @category Transactions */ declare function findFirstNonSignerArg(functionAbi: MoveFunction): number; /** * Builds a transaction payload based on the provided arguments and returns a transaction payload. * This function uses the RemoteABI by default, but can also utilize a specified ABI. * When we call our `generateTransactionPayload` function with the relevant type properties, * Typescript can infer the return type based on the appropriate function overload. * @param args - The input data for generating the transaction payload. * @param args.function - The function to be called, specified in the format "moduleAddress::moduleName::functionName". * @param args.functionArguments - The arguments to pass to the function. * @param args.typeArguments - The type arguments for the function. * @param args.aptosConfig - The configuration settings for Aptos. * @param args.abi - The ABI to use for the transaction, if not using the RemoteABI. * * @returns TransactionPayload - The generated transaction payload, which can be of type TransactionPayloadScript, * TransactionPayloadMultiSig, or TransactionPayloadEntryFunction. * @group Implementation * @category Transactions */ declare function generateTransactionPayload(args: InputScriptData): Promise; /** * @group Implementation * @category Transactions */ declare function generateTransactionPayload(args: InputEntryFunctionDataWithRemoteABI): Promise; /** * @group Implementation * @category Transactions */ declare function generateTransactionPayload(args: InputMultiSigDataWithRemoteABI): Promise; /** * Generates a transaction payload using the provided ABI and function details. * This function helps create a properly structured transaction payload for executing a specific function on a module. * * @param args - The input data required to generate the transaction payload. * @param args.abi - The ABI of the function to be executed. * @param args.function - The fully qualified name of the function in the format `moduleAddress::moduleName::functionName`. * @param args.typeArguments - An array of type arguments that correspond to the function's type parameters. * @param args.functionArguments - An array of arguments to be passed to the function. * @param args.multisigAddress - (Optional) The address for a multisig transaction if applicable. * * @throws Error if the type argument count does not match the ABI or if the number of function arguments is incorrect. * @group Implementation * @category Transactions */ declare function generateTransactionPayloadWithABI(args: InputEntryFunctionDataWithABI): TransactionPayloadEntryFunction; /** * @group Implementation * @category Transactions */ declare function generateTransactionPayloadWithABI(args: InputMultiSigDataWithABI): TransactionPayloadMultiSig; /** * Generates the payload for a view function call using the provided arguments. * This function helps in preparing the necessary data to interact with a specific view function on the blockchain. * * @param args - The input data required to generate the view function payload. * @param args.function - The function identifier in the format "moduleAddress::moduleName::functionName". * @param args.aptosConfig - Configuration settings for the Aptos client. * @param args.abi - The ABI (Application Binary Interface) of the module. * * @returns The generated payload for the view function call. * @group Implementation * @category Transactions */ declare function generateViewFunctionPayload(args: InputViewFunctionDataWithRemoteABI): Promise; /** * Generates a payload for a view function call using the provided ABI and arguments. * This function ensures that the type arguments and function arguments are correctly formatted * and match the expected counts as defined in the ABI. * * @param args - The input data for generating the view function payload. * @param args.abi - The ABI of the function to be called. * @param args.function - The full name of the function in the format "moduleAddress::moduleName::functionName". * @param args.typeArguments - An array of type arguments to be used in the function call. * @param args.functionArguments - An array of arguments to be passed to the function. * * @throws Error if the type argument count does not match the ABI or if the function arguments * do not match the expected parameters defined in the ABI. * @group Implementation * @category Transactions */ declare function generateViewFunctionPayloadWithABI(args: InputViewFunctionDataWithABI): EntryFunction; /** * Generates a raw transaction that can be sent to the Aptos network. * * @param args - The arguments for generating the raw transaction. * @param args.aptosConfig - The configuration for the Aptos network. * @param args.sender - The transaction's sender account address as a hex input. * @param args.payload - The transaction payload, which can be created using generateTransactionPayload(). * @param args.options - Optional parameters for transaction generation. * @param args.feePayerAddress - The address of the fee payer for sponsored transactions. * * @returns RawTransaction - The generated raw transaction. * @group Implementation * @category Transactions */ declare function generateRawTransaction(args: { aptosConfig: AptosConfig; sender: AccountAddressInput; payload: AnyTransactionPayloadInstance; options?: InputGenerateTransactionOptions; feePayerAddress?: AccountAddressInput; }): Promise; declare function convertPayloadToInnerPayload(payload: AnyTransactionPayloadInstance, replayProtectionNonce?: bigint): TransactionInnerPayload; /** * Generates a transaction based on the provided arguments. * This function can create both simple and multi-agent transactions, allowing for flexible transaction handling. * * @param args - The input arguments for generating the transaction. * @param args.aptosConfig - The configuration settings for Aptos. * @param args.sender - The transaction's sender account address as a hex input. * @param args.payload - The transaction payload, which can be created using `generateTransactionPayload()`. * @param args.options - Optional. Transaction options object. * @param args.secondarySignerAddresses - Optional. An array of addresses for additional signers in a multi-signature transaction. * @param args.feePayerAddress - Optional. The address of the fee payer for sponsored transactions. * @returns An instance of a transaction, which may include secondary signer addresses and a fee payer address. * @group Implementation * @category Transactions */ declare function buildTransaction(args: InputGenerateSingleSignerRawTransactionArgs): Promise; /** * @group Implementation * @category Transactions */ declare function buildTransaction(args: InputGenerateMultiAgentRawTransactionArgs): Promise; /** * Generate a signed transaction for simulation before submitting it to the chain. * This function helps in preparing a transaction that can be simulated, allowing users to verify its validity and expected behavior. * * @param args - The input data required to generate the signed transaction for simulation. * @param args.transaction - An Aptos transaction type to sign. * @param args.signerPublicKey - The public key of the signer. * @param args.secondarySignersPublicKeys - Optional. The public keys of secondary signers if it is a multi-signer transaction. * @param args.feePayerPublicKey - Optional. The public key of the fee payer in a sponsored transaction. * @param args.options - Optional. Additional options for simulating the transaction. * * @returns A signed serialized transaction that can be simulated. * @group Implementation * @category Transactions */ declare function generateSignedTransactionForSimulation(args: InputSimulateTransactionData): Uint8Array; /** * @group Implementation * @category Transactions */ declare function getAuthenticatorForSimulation(publicKey?: PublicKey): AccountAuthenticatorNoAccountAuthenticator | AccountAuthenticatorEd25519 | AccountAuthenticatorSingleKey | AccountAuthenticatorMultiKey; /** * Generate a signed transaction ready for submission to the blockchain. * This function prepares the transaction by authenticating the sender and any additional signers based on the provided arguments. * * @param args - The input data required to generate the signed transaction. * @param args.transaction - An Aptos transaction type containing the details of the transaction. * @param args.senderAuthenticator - The account authenticator of the transaction sender. * @param args.feePayerAuthenticator - The authenticator for the fee payer, required if the transaction has a fee payer address. * @param args.additionalSignersAuthenticators - Optional authenticators for additional signers in a multi-signer transaction. * * @returns A Uint8Array representing the signed transaction in bytes. * * @throws Error if the feePayerAuthenticator is not provided for a fee payer transaction. * @throws Error if additionalSignersAuthenticators are not provided for a multi-signer transaction. * @group Implementation * @category Transactions */ declare function generateSignedTransaction(args: InputSubmitTransactionData): Uint8Array; /** * Hashes the set of values using a SHA-3 256 hash algorithm. * @param input - An array of UTF-8 strings or Uint8Array byte arrays to be hashed. * @group Implementation * @category Transactions */ declare function hashValues(input: (Uint8Array | string)[]): Uint8Array; /** * Generates a user transaction hash for the provided transaction payload, which must already have an authenticator. * This function helps ensure the integrity and uniqueness of the transaction by producing a hash based on the signed transaction data. * * @param args - The input data required to submit the transaction. * @param args.authenticator - The authenticator for the transaction. * @param args.payload - The payload containing the transaction details. * @param args.sender - The address of the sender initiating the transaction. * @param args.sequenceNumber - The sequence number of the transaction for the sender. * @group Implementation * @category Transactions */ declare function generateUserTransactionHash(args: InputSubmitTransactionData): string; /** * Convert type arguments to only type tags, allowing for string representations of type tags. * * @param typeArguments - An optional array of type arguments that may include string representations. * @returns An array of TypeTag objects derived from the provided type arguments. * @group Implementation * @category Transactions */ declare function standardizeTypeTags(typeArguments?: Array): Array; /** * Fetches the ABI of a specified module from the on-chain module ABI. * Results are cached for 5 minutes to reduce redundant network calls. * * @param moduleAddress - The address of the module from which to fetch the ABI. * @param moduleName - The name of the module containing the ABI. * @param aptosConfig - The configuration settings for Aptos. * @group Implementation * @category Transactions */ declare function fetchModuleAbi(moduleAddress: string, moduleName: string, aptosConfig: AptosConfig): Promise; /** * Fetches the ABI of a specified function from the on-chain module ABI. This function allows you to access the details of a * specific function within a module. * * @param moduleAddress - The address of the module from which to fetch the function ABI. * @param moduleName - The name of the module containing the function. * @param functionName - The name of the function whose ABI is to be fetched. * @param aptosConfig - The configuration settings for Aptos. * @group Implementation * @category Transactions */ declare function fetchFunctionAbi(moduleAddress: string, moduleName: string, functionName: string, aptosConfig: AptosConfig): Promise; /** * @deprecated Use `fetchFunctionAbi` instead and manually parse the type tags. */ declare function fetchMoveFunctionAbi(moduleAddress: string, moduleName: string, functionName: string, aptosConfig: AptosConfig): Promise; /** * Fetches the ABI for an entry function from the specified module address. * This function validates if the ABI corresponds to an entry function and retrieves its parameters. * * @param moduleAddress - The address of the module containing the entry function. * @param moduleName - The name of the module containing the entry function. * @param functionName - The name of the entry function to fetch the ABI for. * @param aptosConfig - The configuration settings for Aptos. * @returns An object containing the number of signers, type parameters, and function parameters. * @throws Error if the ABI cannot be found or if the function is not an entry function. * @group Implementation * @category Transactions */ declare function fetchEntryFunctionAbi(moduleAddress: string, moduleName: string, functionName: string, aptosConfig: AptosConfig): Promise; /** * Fetches the ABI for a view function from the specified module address. * This function ensures that the ABI is valid and retrieves the type parameters, parameters, and return types for the view function. * * @param moduleAddress - The address of the module containing the view function. * @param moduleName - The name of the module containing the view function. * @param functionName - The name of the view function for which to fetch the ABI. * @param aptosConfig - The configuration settings for Aptos. * @returns An object containing the type parameters, parameters, and return types of the view function. * @throws Error if the ABI cannot be found or if the function is not a view function. * @group Implementation * @category Transactions */ declare function fetchViewFunctionAbi(moduleAddress: string, moduleName: string, functionName: string, aptosConfig: AptosConfig): Promise; /** * Converts a non-BCS encoded argument into BCS encoded, if necessary. * This function checks the provided argument against the expected parameter type and converts it accordingly. * * @param functionName - The name of the function for which the argument is being converted. * @param functionAbiOrModuleAbi - The ABI (Application Binary Interface) of the function, which defines its parameters. * @param arg - The argument to be converted, which can be of various types. * @param position - The index of the argument in the function's parameter list. * @param genericTypeParams - An array of type tags for any generic type parameters. * @param options - Options for the conversion process. * @param options.allowUnknownStructs - If true, unknown structs will be allowed and converted to a `FixedBytes`. * @group Implementation * @category Transactions */ declare function convertArgument(functionName: string, functionAbiOrModuleAbi: MoveModule | FunctionABI, arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes, position: number, genericTypeParams: Array, options?: { allowUnknownStructs?: boolean; }): EntryFunctionArgumentTypes; /** * Checks if the provided argument is BCS encoded and converts it if necessary, ensuring type compatibility with the ABI. * This function helps in validating and converting arguments for entry functions based on their expected types. * * @param arg - The argument to check or convert, which can be either a simple or entry function argument type. * @param param - The expected type tag for the argument. * @param position - The position of the argument in the function call. * @param genericTypeParams - An array of generic type parameters that may be used for conversion. * @group Implementation * @category Transactions */ declare function checkOrConvertArgument(arg: SimpleEntryFunctionArgumentTypes | EntryFunctionArgumentTypes, param: TypeTag, position: number, genericTypeParams: Array, moduleAbi?: MoveModule, options?: { allowUnknownStructs?: boolean; }): EntryFunctionArgumentTypes; /** * Derives the appropriate raw transaction type based on the provided transaction details. * This function helps in identifying whether the transaction is a FeePayerRawTransaction, * MultiAgentRawTransaction, or a standard RawTransaction. * * @param transaction - An object representing an Aptos transaction, which may include: * - feePayerAddress - The address of the fee payer (optional). * - secondarySignerAddresses - An array of secondary signer addresses (optional). * - rawTransaction - The raw transaction data. * * @returns FeePayerRawTransaction | MultiAgentRawTransaction | RawTransaction * @group Implementation * @category Transactions */ declare function deriveTransactionType(transaction: AnyRawTransaction): AnyRawTransactionInstance; /** * Generates the 'signing message' form of a message to be signed. * This function combines a domain separator with the byte representation of the message to create a signing message. * * @param bytes - The byte representation of the message to be signed and sent to the chain. * @param domainSeparator - A domain separator that starts with 'APTOS::'. * * @returns The Uint8Array of the signing message. * @group Implementation * @category Transactions */ declare function generateSigningMessage(bytes: Uint8Array, domainSeparator: string): Uint8Array; /** * @deprecated * Use CryptoHashable instead by having your class implement it and call hash() to get the signing message. * * Generates the 'signing message' form of a serializable value by serializing it and using the constructor name as the domain * separator. * * @param serializable - An object that has a BCS serialized form. * * @returns The Uint8Array of the signing message. * @group Implementation * @category Transactions */ declare function generateSigningMessageForSerializable(serializable: Serializable): Uint8Array; /** * Generates the 'signing message' form of a transaction by deriving the type of transaction and applying the appropriate domain * separator based on the presence of a fee payer or secondary signers. * * @param transaction - A transaction that is to be signed, which can include a fee payer address or secondary signer addresses. * * @returns The Uint8Array of the signing message. * @group Implementation * @category Transactions */ declare function generateSigningMessageForTransaction(transaction: AnyRawTransaction): Uint8Array; /** * Error types related to parsing type tags, indicating various issues encountered during the parsing process. * @group Implementation * @category Transactions */ declare enum TypeTagParserErrorType { InvalidTypeTag = "unknown type", UnexpectedGenericType = "unexpected generic type", UnexpectedTypeArgumentClose = "unexpected '>'", UnexpectedWhitespaceCharacter = "unexpected whitespace character", UnexpectedComma = "unexpected ','", TypeArgumentCountMismatch = "type argument count doesn't match expected amount", MissingTypeArgumentClose = "no matching '>' for '<'", MissingTypeArgument = "no type argument before ','", UnexpectedPrimitiveTypeArguments = "primitive types not expected to have type arguments", UnexpectedVectorTypeArgumentCount = "vector type expected to have exactly one type argument", UnexpectedStructFormat = "unexpected struct format, must be of the form 0xaddress::module_name::struct_name", InvalidModuleNameCharacter = "module name must only contain alphanumeric or '_' characters", InvalidStructNameCharacter = "struct name must only contain alphanumeric or '_' characters", InvalidAddress = "struct address must be valid" } /** * Represents an error that occurs during the parsing of a type tag. * This error extends the built-in Error class and provides additional context * regarding the specific type tag that failed to parse and the reason for the failure. * * @param typeTagStr - The type tag string that failed to be parsed. * @param invalidReason - The reason why the type tag string is considered invalid. * @group Implementation * @category Transactions */ declare class TypeTagParserError extends Error { /** * Constructs an error indicating a failure to parse a type tag. * This error provides details about the specific type tag that could not be parsed and the reason for the failure. * * @param typeTagStr - The string representation of the type tag that failed to parse. * @param invalidReason - The reason why the type tag is considered invalid. * @group Implementation * @category Transactions */ constructor(typeTagStr: string, invalidReason: TypeTagParserErrorType); } /** * Parses a type string into a structured representation of type tags, accommodating various formats including generics and * nested types. * * This function can help you accurately interpret type strings, which can include simple types, standalone structs, and complex * nested generics. * It supports multiple generics, spacing within generics, and nested generics of varying depths. * All types are made of a few parts they're either: * 1. A simple type e.g. u8 * 2. A standalone struct e.g. 0x1::account::Account * 3. A nested struct e.g. 0x1::coin::Coin<0x1234::coin::MyCoin> * * There are a few more special cases that need to be handled, however. * 1. Multiple generics e.g. 0x1::pair::Pair * 2. Spacing in the generics e.g. 0x1::pair::Pair< u8 , u16> * 3. Nested generics of different depths e.g. 0x1::pair::Pair<0x1::coin::Coin<0x1234::coin::MyCoin>, u8> * 4. Generics for types in ABIs are filled in with placeholders e.g. T1, T2, T3 * @param typeStr - The string representation of the type to be parsed. * @param options - Optional settings for parsing behavior. * @param options.allowGenerics - A flag indicating whether to allow generics in the parsing process. * @returns The parsed type tag representation. * @throws TypeTagParserError if the type string is malformed or does not conform to expected formats. * @group Implementation * @category Transactions */ declare function parseTypeTag(typeStr: string, options?: { allowGenerics?: boolean; }): TypeTag; /** * This file contains the underlying implementations for exposed API surface in * the {@link api/account}. By moving the methods out into a separate file, * other namespaces and processes can access these methods without depending on the entire * account namespace and without having a dependency cycle error. * @group Implementation */ type AccountInfo = { accountAddress: AccountAddress; publicKey: BaseAccountPublicKey; lastTransactionVersion: number; }; declare class AccountAbstraction { readonly config: AptosConfig; constructor(config: AptosConfig); /** * Adds a dispatchable authentication function to the account. * * @example * ```ts * const txn = await aptos.abstraction.addAuthenticationFunctionTransaction({ * accountAddress: alice.accountAddress, * authenticationFunction: `${alice.accountAddress}::any_authenticator::authenticate`, * }); * * const txn = await aptos.signAndSubmitTransaction({ signer: alice, transaction}); * await aptos.waitForTransaction({ transactionHash: txn.hash }); * ``` * * @param args.accountAddress - The account to add the authentication function to. * @param args.authenticationFunction - The authentication function info to add. * @param args.options - The options for the transaction. * @returns A transaction to add the authentication function to the account. */ addAuthenticationFunctionTransaction(args: { accountAddress: AccountAddressInput; authenticationFunction: string; options?: InputGenerateTransactionOptions; }): Promise; /** * Removes a dispatchable authentication function from the account. * * @example * ```ts * const txn = await aptos.abstraction.removeAuthenticationFunctionTransaction({ * accountAddress: alice.accountAddress, * authenticationFunction: `${alice.accountAddress}::any_authenticator::authenticate`, * }); * * const txn = await aptos.signAndSubmitTransaction({ signer: alice, transaction: txn }); * await aptos.waitForTransaction({ transactionHash: txn.hash }); * ``` * * @param args.accountAddress - The account to remove the authentication function from. * @param args.authenticationFunction - The authentication function info to remove. * @param args.options - The options for the transaction. * @returns A transaction to remove the authentication function from the account. */ removeAuthenticationFunctionTransaction(args: { accountAddress: AccountAddressInput; authenticationFunction: string; options?: InputGenerateTransactionOptions; }): Promise; /** * Removes a dispatchable authenticator from the account. * * @example * ```ts * const txn = await aptos.abstraction.removeDispatchableAuthenticatorTransaction({ * accountAddress: alice.accountAddress, * }); * * const txn = await aptos.signAndSubmitTransaction({ signer: alice, transaction: txn }); * await aptos.waitForTransaction({ transactionHash: txn.hash }); * ``` * * @param args.accountAddress - The account to remove the authenticator from. * @param args.options - The options for the transaction. * @returns A transaction to remove the authenticator from the account. */ removeDispatchableAuthenticatorTransaction(args: { accountAddress: AccountAddressInput; options?: InputGenerateTransactionOptions; }): Promise; /** * Gets the dispatchable authentication function for the account. * * @example * ```ts * const functionInfos = await aptos.abstraction.getAuthenticationFunction({ * accountAddress: alice.accountAddress, * }); * * if (functionInfos) { * console.log(`Account ${alice.accountAddress.toString()} is using account abstraction!`); * } else { * console.log(`Account ${alice.accountAddress.toString()} is not using account abstraction.`); * } * ``` * * @param args.accountAddress - The account to get the dispatchable authentication function for. * @returns The dispatchable authentication function for the account. */ getAuthenticationFunction(args: { accountAddress: AccountAddressInput; }): Promise<{ moduleAddress: AccountAddress; moduleName: string; functionName: string; }[] | undefined>; /** * Will return true if the account is abstracted, otherwise false. * * @example * ```ts * const isAccountAbstractionEnabled = await aptos.abstraction.isAccountAbstractionEnabled({ * accountAddress: alice.accountAddress, * authenticationFunction: `${alice.accountAddress}::any_authenticator::authenticate`, * }); * if (isAccountAbstractionEnabled) { * console.log(`Account ${alice.accountAddress.toString()} is using account abstraction!`); * } else { * console.log(`Account ${alice.accountAddress.toString()} is not using account abstraction.`); * } * ``` * * @param args.accountAddress - The account to check. * @returns Whether the account is abstracted. */ isAccountAbstractionEnabled: (args: { accountAddress: AccountAddressInput; authenticationFunction: string; }) => Promise; /** * Creates a transaction to enable account abstraction with the given authentication function. * * @example * ```ts * const txn = await aptos.abstraction.enableAccountAbstractionTransaction({ * accountAddress: alice.accountAddress, * authenticationFunction: `{alice.accountAddress}::any_authenticator::authenticate`, * }); * * const txn = await aptos.signAndSubmitTransaction({ signer: alice, transaction: txn }); * await aptos.waitForTransaction({ transactionHash: txn.hash }); * ``` * * @param args.accountAddress - The account to enable account abstraction for. * @param args.authenticationFunction - The authentication function info to use. * @param args.options - The options for the transaction. * @returns A transaction to enable account abstraction for the account. */ enableAccountAbstractionTransaction: (args: { accountAddress: AccountAddressInput; authenticationFunction: string; options?: InputGenerateTransactionOptions; }) => Promise; /** * Creates a transaction to disable account abstraction. If an authentication function is provided, it will specify to * remove the authentication function. * * @example * ```ts * const txn = await aptos.abstraction.disableAccountAbstractionTransaction({ * accountAddress: alice.accountAddress, * authenticationFunction: `${alice.accountAddress}::any_authenticator::authenticate`, * }); * * const txn = await aptos.signAndSubmitTransaction({ signer: alice, transaction: txn }); * await aptos.waitForTransaction({ transactionHash: txn.hash }); * ``` * * @param args.accountAddress - The account to disable account abstraction for. * @param args.authenticationFunction - The authentication function info to remove. * @param args.options - The options for the transaction. * @returns A transaction to disable account abstraction for the account. */ disableAccountAbstractionTransaction: (args: { accountAddress: AccountAddressInput; authenticationFunction?: string; options?: InputGenerateTransactionOptions; }) => Promise; } /** * A class to query all `Account` related queries on Aptos. * @group Account */ declare class Account$1 { readonly config: AptosConfig; abstraction: AccountAbstraction; /** * Creates an instance of the Aptos client with the provided configuration. * * @param config - The configuration settings for the Aptos client. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * async function runExample() { * // Initialize the Aptos client with testnet configuration * const config = new AptosConfig({ network: Network.TESTNET }); // specify your own network if needed * const aptos = new Aptos(config); * * console.log("Aptos client initialized:", aptos); * } * runExample().catch(console.error); * ``` * @group Account */ constructor(config: AptosConfig); /** * Queries the current state for an Aptos account given its account address. * * @param args - The arguments for retrieving account information. * @param args.accountAddress - The Aptos account address to query. * @returns The account data. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Retrieve account information for a specific address * const accountInfo = await aptos.getAccountInfo({ accountAddress: "0x1" }); // replace with a real account address * console.log(accountInfo); * } * runExample().catch(console.error); * ``` * @group Account */ getAccountInfo(args: { accountAddress: AccountAddressInput; }): Promise; /** * Queries for all modules in an account given an account address. * This function may call the API multiple times to auto paginate through results. * * @param args.accountAddress - The Aptos account address to query modules for. * @param args.options.limit - The maximum number of results to return. * @param args.options.ledgerVersion - The ledger version to query; if not provided, it retrieves the latest version. * * @returns - The account modules associated with the specified address. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Fetching account modules for a specific account * const accountModules = await aptos.getAccountModules({ * accountAddress: "0x1", // replace with a real account address * options: { * limit: 10, // limiting to 10 modules * }, * }); * * console.log(accountModules); * } * runExample().catch(console.error); * ``` * @group Account */ getAccountModules(args: { accountAddress: AccountAddressInput; options?: { limit?: number; } & LedgerVersionArg; }): Promise; /** * Queries for a page of modules in an account given an account address. * * @param args.accountAddress - The Aptos account address to query modules for. * @param args.options.cursor - The cursor to start returning results from. Note, this is obfuscated and is not an index. * @param args.options.limit - The maximum number of results to return. * @param args.options.ledgerVersion - The ledger version to query; if not provided, it retrieves the latest version. * * @returns - The account modules associated with the specified address. Along with a cursor for future pagination. If the cursor is undefined, it means there are no more modules to fetch. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Fetching account modules for a specific account * const {modules, cursor} = await aptos.getAccountModulesPage({ * accountAddress: "0x1", // replace with a real account address * options: { * cursor: undefined, // starting from the first module * limit: 10, // limiting to 10 modules * }, * }); * * console.log(modules); * console.log(`More to fetch: ${cursor !== undefined}`); * } * runExample().catch(console.error); * ``` * @group Account */ getAccountModulesPage(args: { accountAddress: AccountAddressInput; options?: CursorPaginationArgs & LedgerVersionArg; }): Promise<{ modules: MoveModuleBytecode[]; cursor: string | undefined; }>; /** * Queries for a specific account module given an account address and module name. * * @param args.accountAddress - The Aptos account address. * @param args.moduleName - The name of the module. * @param args.options.ledgerVersion - The ledger version to query; if not provided, it will get the latest version. * * @returns The account module associated with the specified account address and module name. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Get the account module for a specific account address and module name * const module = await aptos.getAccountModule({ * accountAddress: "0x1", // replace with a real account address * moduleName: "MyModule" // specify the module name * }); * * console.log(module); * } * runExample().catch(console.error); * ``` * @group Account */ getAccountModule(args: { accountAddress: AccountAddressInput; moduleName: string; options?: LedgerVersionArg; }): Promise; /** * Queries account transactions given an account address. * This function may call the API multiple times to auto paginate and retrieve all account transactions. * * @param args.accountAddress - The Aptos account address to query transactions for. * @param args.options - Optional pagination arguments. * @param args.options.offset - The number of transactions to start returning results from. * @param args.options.limit - The maximum number of results to return. * * @returns The account transactions. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Fetch transactions for a specific account * const transactions = await aptos.getAccountTransactions({ * accountAddress: "0x1", // replace with a real account address * options: { * offset: 0, // starting from the first transaction * limit: 10, // limiting to 10 transactions * }, * }); * * console.log(transactions); * } * runExample().catch(console.error); * ``` * @group Account */ getAccountTransactions(args: { accountAddress: AccountAddressInput; options?: PaginationArgs; }): Promise; /** * Queries all account resources given an account address. * This function may call the API multiple times to auto paginate through results. * * @param args.accountAddress - The Aptos account address to query resources for. * @param args.options.limit - The maximum number of results to return. * @param args.options.ledgerVersion - The ledger version to query; if not provided, it will get the latest version. * @returns Account resources. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Fetching account resources for a specific account address * const resources = await aptos.getAccountResources({ accountAddress: "0x1" }); // replace with a real account address * console.log(resources); * } * runExample().catch(console.error); * ``` * @group Account */ getAccountResources(args: { accountAddress: AccountAddressInput; options?: PaginationArgs & LedgerVersionArg; }): Promise; /** * Queries a page of account resources given an account address. * * @param args.accountAddress - The Aptos account address to query resources for. * @param args.options.cursor - The cursor to start returning results from. Note, this is obfuscated and is not an index. * @param args.options.limit - The maximum number of results to return. * @param args.options.ledgerVersion - The ledger version to query; if not provided, it will get the latest version. * @returns Account resources. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Fetching account resources for a specific account address * const resources = await aptos.getAccountResourcesPage({ * accountAddress: "0x1", // replace with a real account address * options: { * cursor: undefined, // starting from the first resource * limit: 10, // limiting to 10 resources * }, * }); * console.log(resources); * console.log(`More to fetch: ${resources.cursor !== undefined}`); * } * runExample().catch(console.error); * ``` * @group Account */ getAccountResourcesPage(args: { accountAddress: AccountAddressInput; options?: CursorPaginationArgs & LedgerVersionArg; }): Promise<{ resources: MoveResource[]; cursor: string | undefined; }>; /** * Queries a specific account resource given an account address and resource type. * * @template T - The typed output of the resource. * @param args.accountAddress - The Aptos account address to query. * @param args.resourceType - The string representation of an on-chain Move struct type, e.g., "0x1::aptos_coin::AptosCoin". * @param args.options.ledgerVersion - The ledger version to query; if not provided, it will get the latest version. * @returns The account resource of the specified type. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Get the account resource for a specific account address and resource type * const resource = await aptos.getAccountResource({ * accountAddress: "0x1", // replace with a real account address * resourceType: "0x1::aptos_coin::AptosCoin" * }); * * console.log(resource); * } * runExample().catch(console.error); * ``` * @group Account */ getAccountResource(args: { accountAddress: AccountAddressInput; resourceType: MoveStructId; options?: LedgerVersionArg; }): Promise; /** * Looks up the account address for a given authentication key, handling both rotated and non-rotated keys. * * @param args.authenticationKey - The authentication key for which to look up the account address. * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying. * @param args.options.ledgerVersion - The ledger version to query; if not provided, it will get the latest version. * @returns Promise - The account address associated with the authentication key. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Look up the original account address for a given authentication key * const accountAddress = await aptos.lookupOriginalAccountAddress({ * authenticationKey: "0x1", // replace with a real authentication key * }); * * console.log("Original Account Address:", accountAddress); * } * runExample().catch(console.error); * ``` * @group Account */ lookupOriginalAccountAddress(args: { authenticationKey: AccountAddressInput; minimumLedgerVersion?: AnyNumber; options?: LedgerVersionArg; }): Promise; /** * Queries the current count of tokens owned by a specified account. * * @param args - The parameters for the query. * @param args.accountAddress - The account address to query the token count for. * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying. * @returns The current count of tokens owned by the account. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Get the count of tokens owned by the account * const tokensCount = await aptos.getAccountTokensCount({ accountAddress: "0x1" }); // replace with a real account address * console.log(`Tokens Count: ${tokensCount}`); * } * runExample().catch(console.error); * ``` * @group Account */ getAccountTokensCount(args: { accountAddress: AccountAddressInput; minimumLedgerVersion?: AnyNumber; }): Promise; /** * Queries the tokens currently owned by a specified account, including NFTs and fungible tokens. * If desired, you can filter the results by a specific token standard. * * @param args.accountAddress The account address for which to retrieve owned tokens. * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying. * @param args.options.tokenStandard Optional filter for the NFT standard to query for. * @param args.options.offset Optional number to start returning results from. * @param args.options.limit Optional number of results to return. * @param args.options.orderBy Optional order to sort the tokens by. * @returns An array of tokens with their respective data. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Get the tokens owned by a specific account * const accountOwnedTokens = await aptos.getAccountOwnedTokens({ * accountAddress: "0x1", // replace with a real account address * options: { * limit: 10, // specify how many tokens to return * orderBy: "created_at", // specify the order of the results * }, * }); * * console.log(accountOwnedTokens); * } * runExample().catch(console.error); * ``` * @group Account */ getAccountOwnedTokens(args: { accountAddress: AccountAddressInput; minimumLedgerVersion?: AnyNumber; options?: TokenStandardArg & PaginationArgs & OrderByArg; }): Promise; /** * Queries all current tokens of a specific collection that an account owns by the collection address. * This query returns all tokens (v1 and v2 standards) an account owns, including NFTs, fungible, soulbound, etc. * If you want to get only the token from a specific standard, you can pass an optional tokenStandard parameter. * * @param args.accountAddress - The account address we want to get the tokens for. * @param args.collectionAddress - The address of the collection being queried. * @param args.minimumLedgerVersion - Optional ledger version to sync up to, before querying. * @param args.options.tokenStandard - The NFT standard to query for. * @param args.options.offset - The number token to start returning results from. * @param args.options.limit - The number of results to return. * @param args.options.orderBy - The order to sort the tokens by. * @returns Tokens array with the token data. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Get tokens owned by a specific account in a specific collection * const accountOwnedTokens = await aptos.getAccountOwnedTokensFromCollectionAddress({ * accountAddress: "0x1", // replace with a real account address * collectionAddress: "0x2", // replace with a real collection address * }); * * console.log(accountOwnedTokens); * } * runExample().catch(console.error); * ``` * @group Account */ getAccountOwnedTokensFromCollectionAddress(args: { accountAddress: AccountAddressInput; collectionAddress: AccountAddressInput; minimumLedgerVersion?: AnyNumber; options?: TokenStandardArg & PaginationArgs & OrderByArg; }): Promise; /** * Queries for all collections that an account currently has tokens for, including NFTs, fungible tokens, and soulbound tokens. * If you want to filter by a specific token standard, you can pass an optional tokenStandard parameter. * * @param args.accountAddress - The account address we want to get the collections for. * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying. * @param args.options.tokenStandard - The NFT standard to query for. * @param args.options.offset - The number of the collection to start returning results from. * @param args.options.limit - The number of results to return. * @param args.options.orderBy - The order to sort the tokens by. * @returns Collections array with the collections data. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Get account collections with owned tokens for a specific account * const accountCollectionsWithOwnedTokens = await aptos.getAccountCollectionsWithOwnedTokens({ * accountAddress: "0x1", // replace with a real account address * options: { * tokenStandard: "NFT", // specify the token standard if needed * limit: 10, // specify the number of results to return * }, * }); * * console.log(accountCollectionsWithOwnedTokens); * } * runExample().catch(console.error); * ``` * @group Account */ getAccountCollectionsWithOwnedTokens(args: { accountAddress: AccountAddressInput; minimumLedgerVersion?: AnyNumber; options?: TokenStandardArg & PaginationArgs & OrderByArg; }): Promise; /** * Queries the current count of transactions submitted by an account. * * @param args - The parameters for the query. * @param args.accountAddress - The account address we want to get the total count for. * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying. * @returns Current count of transactions made by an account. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Get the count of transactions for a specific account * const accountTransactionsCount = await aptos.getAccountTransactionsCount({ * accountAddress: "0x1", // replace with a real account address * minimumLedgerVersion: 1, // specify your own minimum ledger version if needed * }); * * console.log(accountTransactionsCount); * } * runExample().catch(console.error); * ``` * @group Account */ getAccountTransactionsCount(args: { accountAddress: AccountAddressInput; minimumLedgerVersion?: AnyNumber; }): Promise; /** * Retrieves the coins data for a specified account. * * @param args.accountAddress - The account address for which to retrieve the coin's data. * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying. * @param args.options.offset - Optional. The number of coins to start returning results from. * @param args.options.limit - Optional. The number of results to return. * @param args.options.orderBy - Optional. The order to sort the coins by. * @param args.options.where - Optional. Filter the results by specific criteria. * @returns An array containing the coins data for the specified account. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Fetching coins data for a specific account * const accountCoinsData = await aptos.getAccountCoinsData({ * accountAddress: "0x1", // replace with a real account address * options: { * limit: 10, // specify the number of results to return * orderBy: { asset_type: "asc" }, // specify the order of results * }, * }); * * console.log(accountCoinsData); * } * runExample().catch(console.error); * ``` * @group Account */ getAccountCoinsData(args: { accountAddress: AccountAddressInput; minimumLedgerVersion?: AnyNumber; options?: PaginationArgs & OrderByArg & WhereArg; }): Promise; /** * Retrieves the current count of an account's coins aggregated across all types. * * @param args The parameters for the account coins count query. * @param args.accountAddress The account address we want to get the total count for. * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying. * @returns The current count of the aggregated coins for the specified account. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Getting the account coins count for a specific account * const accountCoinsCount = await aptos.getAccountCoinsCount({ accountAddress: "0x1" }); // replace with a real account address * console.log("Account Coins Count:", accountCoinsCount); * } * runExample().catch(console.error); * ``` * @group Account */ getAccountCoinsCount(args: { accountAddress: AccountAddressInput; minimumLedgerVersion?: AnyNumber; }): Promise; /** * Retrieves the current amount of APT for a specified account. If the account does not exist, it will return 0. * * @param args The arguments for the account query. * @param args.accountAddress The account address for which to retrieve the APT amount. * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying. * @returns The current amount of APT for the specified account. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Get the APT amount for a specific account * const accountAPTAmount = await aptos.getAccountAPTAmount({ accountAddress: "0x1" }); // replace with a real account address * console.log("Account APT Amount:", accountAPTAmount); * } * runExample().catch(console.error); * ``` * @group Account */ getAccountAPTAmount(args: { accountAddress: AccountAddressInput; minimumLedgerVersion?: AnyNumber; }): Promise; /** * Queries the current amount of a specified coin held by an account. * * @deprecated Use `getBalance({ accountAddress, asset })` instead. * This method is slated for removal in a future release. * * @param args The parameters for querying the account's coin amount. * @param args.accountAddress The account address to query for the coin amount. * @param args.coinType The coin type to query. Note: If not provided, it may be automatically populated if `faMetadataAddress` * is specified. * @param args.faMetadataAddress The fungible asset metadata address to query. Note: If not provided, it may be automatically * populated if `coinType` is specified. * @returns The current amount of the specified coin held by the account. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Prefer the new API * const amount = await aptos.getBalance({ accountAddress: "0x1", asset: "0x1::aptos_coin::AptosCoin" }); * console.log(`Balance: ${amount}`); * } * runExample().catch(console.error); * ``` * @group Account */ getAccountCoinAmount(args: { accountAddress: AccountAddressInput; coinType?: MoveStructId; faMetadataAddress?: AccountAddressInput; }): Promise; /** * Retrieves the balance for an account and asset. * * @param args The parameters for the balance query. * @param args.accountAddress The account address to query. * @param args.asset The asset to query: Move struct ID (e.g., `0x1::aptos_coin::AptosCoin`) or FA metadata address. * @returns The balance as a number. * * @example * ```ts * const aptos = new Aptos(new AptosConfig()); * // APT coin by type * const apt = await aptos.getBalance({ accountAddress: "0x1", asset: "0x1::aptos_coin::AptosCoin" }); * // Some FA by metadata address * const fa = await aptos.getBalance({ accountAddress: "0x1", asset: "0xa" }); * ``` * @group Account */ getBalance(args: { accountAddress: AccountAddressInput; asset: MoveStructId | AccountAddressInput; }): Promise; /** * Queries an account's owned objects. * * @param args.accountAddress The account address we want to get the objects for. * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying. * @param args.options.offset The starting position to start returning results from. * @param args.options.limit The number of results to return. * @param args.options.orderBy The order to sort the objects by. * @returns Objects array with the object data. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Get the objects owned by the specified account * const accountOwnedObjects = await aptos.getAccountOwnedObjects({ * accountAddress: "0x1", // replace with a real account address * minimumLedgerVersion: 1, // optional, specify if needed * options: { * offset: 0, // optional, specify if needed * limit: 10, // optional, specify if needed * orderBy: "created_at", // optional, specify if needed * }, * }); * * console.log(accountOwnedObjects); * } * runExample().catch(console.error); * ``` * @group Account */ getAccountOwnedObjects(args: { accountAddress: AccountAddressInput; minimumLedgerVersion?: AnyNumber; options?: PaginationArgs & OrderByArg; }): Promise; /** * Derives an account by providing a private key. This function resolves the provided private key type and derives the public * key from it. * * If the privateKey is a Secp256k1 type, it derives the account using the derived public key and auth key using the SingleKey * scheme locally. * If the privateKey is an ED25519 type, it looks up the authentication key on chain to determine whether it is a Legacy ED25519 * key or a Unified ED25519 key, and then derives the account based on that. * * @param args - The arguments for deriving the account. * @param args.privateKey - An account private key. * @returns The derived Account type. * * @example * ```typescript * import { Aptos, AptosConfig, Network, Ed25519PrivateKey } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Deriving an account from a private key * const account = await aptos.deriveAccountFromPrivateKey({ * privateKey: new Ed25519PrivateKey("0x123") // replace with a real private key * }); * * console.log(account); * } * runExample().catch(console.error); * ``` * @group Account * @deprecated Note that more inspection is needed by the user to determine which account exists on-chain */ deriveAccountFromPrivateKey(args: { privateKey: PrivateKeyInput; minimumLedgerVersion?: AnyNumber; options?: { throwIfNoAccountFound?: boolean; }; }): Promise; /** * Derives all accounts owned by a signer. This function takes a signer (either an Account or PrivateKey) * and returns all accounts that can be derived from it, ordered by the most recently used account first. * * Note, this function will not return accounts that require more than one signer to be used. * * @param args - The arguments for deriving owned accounts * @param args.signer - The signer to derive accounts from (Account or PrivateKey) * @param args.minimumLedgerVersion - The minimum ledger version to wait for before querying * @param args.options.includeUnverified - Whether to include unverified accounts in the results. Unverified accounts * are accounts that can be authenticated with the signer, but there is no history of the signer using the account. * Default is false. * @param args.options.noMultiKey - If true, do not include multi-key accounts in the results. Default is false. * @returns Promise resolving to an array of derived Account objects * * @example * ```typescript * import { Aptos, AptosConfig, Network, Ed25519Account } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function getOwnedAccounts() { * const signer = Ed25519Account.generate(); * const accounts = await aptos.deriveOwnedAccountsFromSigner({ * signer * }); * const account = accounts[0]; * console.log(account); * } * ``` * @group Account */ deriveOwnedAccountsFromSigner(args: { signer: Account | PrivateKeyInput; minimumLedgerVersion?: AnyNumber; options?: { includeUnverified?: boolean; noMultiKey?: boolean; }; }): Promise; /** * Gets all account info (address, account public key, last transaction version) that have are associated with a public key and **related public keys** * * For a given public key, it will query all multikeys that the public key is part of. Then for the provided public key and * any multikeys found in the previous step, it will query for any accounts that have an auth key that matches any of the * public keys. * * Note: If an Ed25519PublicKey or an AnyPublicKey that wraps Ed25519PublicKey is passed in, it will query for both legacy and single singer cases. * * @param args - The arguments for getting accounts for a public key * @param args.publicKey - The public key to look up accounts for * @param args.minimumLedgerVersion - The minimum ledger version to wait for before querying * @param args.options.includeUnverified - Whether to include unverified accounts in the results. Unverified accounts * are accounts that can be authenticated with the signer, but there is no history of the signer using the account. Default * is false. * @param args.options.noMultiKey - Whether to exclude multi-key accounts in the results. Default is false. * @returns Promise resolving to an array of account addresses and their associated public keys * * @example * ```typescript * import { Aptos, AptosConfig, Network, Ed25519PrivateKey } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function getAccounts() { * const privateKey = Ed25519PrivateKey.generate(); * const publicKey = privateKey.publicKey(); * const accounts = await aptos.getAccountsForPublicKey({ * publicKey * }); * console.log(accounts); * } * ``` * @group Account */ getAccountsForPublicKey(args: { publicKey: BaseAccountPublicKey; minimumLedgerVersion?: AnyNumber; options?: { includeUnverified?: boolean; noMultiKey?: boolean; }; }): Promise; } /** * A class to handle all `Coin` operations. * @group Coin */ declare class Coin { readonly config: AptosConfig; /** * Initializes a new instance of the Aptos client with the specified configuration. * This allows you to interact with the Aptos blockchain using the provided settings. * * @param config - The configuration settings for the Aptos client. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * async function runExample() { * // Create a new Aptos client with testnet configuration * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * console.log("Aptos client initialized:", aptos); * } * runExample().catch(console.error); * ``` * @group Coin */ constructor(config: AptosConfig); /** * Generate a transfer coin transaction that can be simulated, signed, and submitted. * This function helps you create a transaction to transfer a specified amount of coins * from one account to another within the Aptos network. * * @param args The arguments for the transfer transaction. * @param args.sender The sender account address. * @param args.recipient The recipient account address. * @param args.amount The amount of coins to transfer. * @param args.coinType Optional. The coin struct type to transfer. Defaults to 0x1::aptos_coin::AptosCoin. * @param args.options Optional. Additional options for generating the transaction. * * @returns SimpleTransaction * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Generate a transfer coin transaction * const transaction = await aptos.transferCoinTransaction({ * sender: "0x1", // replace with a real sender account address * recipient: "0x2", // replace with a real recipient account address * amount: 10, * }); * * console.log(transaction); * } * runExample().catch(console.error); * ``` * @group Coin */ transferCoinTransaction(args: { sender: AccountAddressInput; recipient: AccountAddressInput; amount: AnyNumber; coinType?: MoveStructId; options?: InputGenerateTransactionOptions; }): Promise; } /** * This file contains the underlying implementations for exposed API surface in * the {@link api/digitalAsset}. By moving the methods out into a separate file, * other namespaces and processes can access these methods without depending on the entire * digitalAsset namespace and without having a dependency cycle error. * @group Implementation */ declare const PropertyTypeMap: { BOOLEAN: string; U8: string; U16: string; U32: string; U64: string; U128: string; U256: string; ADDRESS: string; STRING: string; ARRAY: string; }; /** * The keys of the PropertyTypeMap, representing different property types. * @group Implementation */ type PropertyType = keyof typeof PropertyTypeMap; /** * Accepted property value types for user input, including boolean, number, bigint, string, AccountAddress, and Uint8Array. * To pass in an Array, use Uint8Array type * for example `new MoveVector([new MoveString("hello"), new MoveString("world")]).bcsToBytes()` * @group Implementation */ type PropertyValue = boolean | number | bigint | string | AccountAddress | Uint8Array; /** * Options for creating a collection, allowing customization of various attributes such as supply limits, mutability of metadata, * and royalty settings. * * @param maxSupply - Maximum number of tokens that can be minted in the collection. * @param mutableDescription - Indicates if the collection description can be changed after creation. * @param mutableRoyalty - Indicates if the royalty settings can be modified after creation. * @param mutableURI - Indicates if the collection URI can be updated. * @param mutableTokenDescription - Indicates if individual token descriptions can be modified. * @param mutableTokenName - Indicates if individual token names can be changed. * @param mutableTokenProperties - Indicates if individual token properties can be altered. * @param mutableTokenURI - Indicates if individual token URIs can be updated. * @param tokensBurnableByCreator - Indicates if the creator can burn tokens from the collection. * @param tokensFreezableByCreator - Indicates if the creator can freeze tokens in the collection. * @param royaltyNumerator - The numerator for calculating royalties. * @param royaltyDenominator - The denominator for calculating royalties. * @group Implementation */ interface CreateCollectionOptions { maxSupply?: AnyNumber; mutableDescription?: boolean; mutableRoyalty?: boolean; mutableURI?: boolean; mutableTokenDescription?: boolean; mutableTokenName?: boolean; mutableTokenProperties?: boolean; mutableTokenURI?: boolean; tokensBurnableByCreator?: boolean; tokensFreezableByCreator?: boolean; royaltyNumerator?: number; royaltyDenominator?: number; } /** * A class to query all `DigitalAsset` related queries on Aptos. * @group DigitalAsset */ declare class DigitalAsset { readonly config: AptosConfig; /** * Initializes a new instance of the Aptos client with the specified configuration. * This allows you to interact with the Aptos blockchain using the provided settings. * * @param config - The configuration settings for the Aptos client. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * async function runExample() { * // Create a configuration for the Aptos client * const config = new AptosConfig({ network: Network.TESTNET }); // Specify your desired network * * // Initialize the Aptos client with the configuration * const aptos = new Aptos(config); * * console.log("Aptos client initialized:", aptos); * } * runExample().catch(console.error); * ``` * @group DigitalAsset */ constructor(config: AptosConfig); /** * Queries data of a specific collection by the collection creator address and the collection name. * This function is deprecated; use `getCollectionDataByCreatorAddressAndCollectionName` instead. * * If a creator account has two collections with the same name in v1 and v2, you can pass an optional `tokenStandard` parameter * to query a specific standard. * * @param args - The arguments for querying the collection data. * @param args.creatorAddress - The address of the collection's creator. * @param args.collectionName - The name of the collection. * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying. * @param args.options - Optional parameters for the query. * @param args.options.tokenStandard - The token standard to query. * @returns GetCollectionDataResponse - The response type containing the collection data. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Querying collection data by creator address and collection name * const collection = await aptos.getCollectionData({ * creatorAddress: "0x1", // replace with a real creator address * collectionName: "myCollection", // specify your collection name * }); * * console.log(collection); * } * runExample().catch(console.error); * ``` * @group DigitalAsset */ getCollectionData(args: { creatorAddress: AccountAddressInput; collectionName: string; minimumLedgerVersion?: AnyNumber; options?: TokenStandardArg; }): Promise; /** * Queries data of a specific collection by the collection creator address and the collection name. * If a creator account has multiple collections with the same name across different versions, * specify the `tokenStandard` parameter to query a specific standard. * * @param args.creatorAddress - The address of the collection's creator. * @param args.collectionName - The name of the collection. * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying. * @param args.options.tokenStandard - Optional token standard to query. * @returns GetCollectionDataResponse - The response type containing collection data. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Fetching collection data by creator address and collection name * const collection = await aptos.getCollectionDataByCreatorAddressAndCollectionName({ * creatorAddress: "0x1", // replace with a real creator address * collectionName: "myCollection", * minimumLedgerVersion: 1, // optional, specify if needed * options: { tokenStandard: "v2" } // optional, specify if needed * }); * * console.log(collection); * } * runExample().catch(console.error); * ``` * @group DigitalAsset */ getCollectionDataByCreatorAddressAndCollectionName(args: { creatorAddress: AccountAddressInput; collectionName: string; minimumLedgerVersion?: AnyNumber; options?: TokenStandardArg & PaginationArgs; }): Promise; /** * Retrieves data for a specific collection created by a given creator address. * This function allows you to query collection data while optionally specifying a minimum ledger version and pagination options. * * @param args.creatorAddress - The address of the collection's creator. * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying. * @param args.options.tokenStandard - Optional token standard to query. * @param args.options.pagination - Optional pagination arguments. * @returns GetCollectionDataResponse - The response type containing collection data. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Retrieve collection data by creator address * const collectionData = await aptos.getCollectionDataByCreatorAddress({ * creatorAddress: "0x1", // replace with a real creator address * minimumLedgerVersion: 1, // specify the minimum ledger version if needed * options: { * tokenStandard: "v2", // specify the token standard if needed * pagination: { limit: 10, offset: 0 } // specify pagination options if needed * } * }); * * console.log(collectionData); * } * runExample().catch(console.error); * ``` * @group DigitalAsset */ getCollectionDataByCreatorAddress(args: { creatorAddress: AccountAddressInput; minimumLedgerVersion?: AnyNumber; options?: TokenStandardArg & PaginationArgs; }): Promise; /** * Queries data of a specific collection by the collection ID. * * @param args.collectionId - The ID of the collection, which is the same as the address of the collection object. * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying. * @param args.options - Optional parameters for token standard and pagination. * @returns GetCollectionDataResponse - The response type containing the collection data. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Fetching collection data by collection ID * const collection = await aptos.getCollectionDataByCollectionId({ * collectionId: "0x123", // replace with a real collection ID * }); * * console.log(collection); * } * runExample().catch(console.error); * ``` * @group DigitalAsset */ getCollectionDataByCollectionId(args: { collectionId: AccountAddressInput; minimumLedgerVersion?: AnyNumber; options?: TokenStandardArg & PaginationArgs; }): Promise; /** * Queries the ID of a specified collection. * This ID corresponds to the collection's object address in V2, while V1 does not utilize objects and lacks an address. * * @param args.creatorAddress - The address of the collection's creator. * @param args.collectionName - The name of the collection. * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying. * @param args.options.tokenStandard - The token standard to query. * @returns The collection ID. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Fetching the collection ID for a specific creator and collection name * const collectionId = await aptos.getCollectionId({ * creatorAddress: "0x1", // replace with a real creator address * collectionName: "myCollection" * }); * * console.log("Collection ID:", collectionId); * } * runExample().catch(console.error); * ``` * @group DigitalAsset */ getCollectionId(args: { creatorAddress: AccountAddressInput; collectionName: string; minimumLedgerVersion?: AnyNumber; options?: TokenStandardArg; }): Promise; /** * Retrieves digital asset data using the address of a digital asset. * * @param args - The parameters for the request. * @param args.digitalAssetAddress - The address of the digital asset. * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying. * @returns GetTokenDataResponse containing relevant data for the digital asset. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Fetching digital asset data for a specific address * const digitalAsset = await aptos.getDigitalAssetData({ * digitalAssetAddress: "0x123", // replace with a real digital asset address * }); * * console.log(digitalAsset); * } * runExample().catch(console.error); * ``` * @group DigitalAsset */ getDigitalAssetData(args: { digitalAssetAddress: AccountAddressInput; minimumLedgerVersion?: AnyNumber; }): Promise; /** * Retrieves the current ownership data of a specified digital asset using its address. * * @param args The parameters for the request. * @param args.digitalAssetAddress The address of the digital asset. * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying. * * @returns GetCurrentTokenOwnershipResponse containing relevant ownership data of the digital asset. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Getting the current ownership of a digital asset * const digitalAssetOwner = await aptos.getCurrentDigitalAssetOwnership({ * digitalAssetAddress: "0x123", // replace with a real digital asset address * }); * * console.log(digitalAssetOwner); * } * runExample().catch(console.error); * ``` * @group DigitalAsset */ getCurrentDigitalAssetOwnership(args: { digitalAssetAddress: AccountAddressInput; minimumLedgerVersion?: AnyNumber; }): Promise; /** * Retrieves the digital assets owned by a specified address. * * @param args.ownerAddress The address of the owner. * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying. * @param args.options Optional pagination and ordering parameters for the response. * * @returns GetOwnedTokensResponse containing ownership data of the digital assets belonging to the ownerAddress. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Fetching the digital assets owned by the specified address * const digitalAssets = await aptos.getOwnedDigitalAssets({ * ownerAddress: "0x1", // replace with a real account address * }); * * console.log(digitalAssets); * } * runExample().catch(console.error); * ``` * @group DigitalAsset */ getOwnedDigitalAssets(args: { ownerAddress: AccountAddressInput; minimumLedgerVersion?: AnyNumber; options?: PaginationArgs & OrderByArg; }): Promise; /** * Retrieves the activity data for a specified digital asset using its address. * * @param args - The parameters for the request. * @param args.digitalAssetAddress - The address of the digital asset. * @param args.minimumLedgerVersion - Optional minimum ledger version to sync up to before querying. * @param args.options - Optional pagination and ordering parameters. * * @returns A promise that resolves to the activity data related to the digital asset. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Get the activity data for a digital asset * const digitalAssetActivity = await aptos.getDigitalAssetActivity({ * digitalAssetAddress: "0x123", // replace with a real digital asset address * }); * * console.log(digitalAssetActivity); * } * runExample().catch(console.error); * ``` * @group DigitalAsset */ getDigitalAssetActivity(args: { digitalAssetAddress: AccountAddressInput; minimumLedgerVersion?: AnyNumber; options?: PaginationArgs & OrderByArg; }): Promise; /** * Creates a new collection within the specified account. * * @param args.creator - The account of the collection's creator. * @param args.description - The description of the collection. * @param args.name - The name of the collection. * @param args.uri - The URI to additional info about the collection. * @param args.options - Optional parameters for generating the transaction. * * The parameters below are optional: * @param args.maxSupply - Controls the max supply of the digital assets. Defaults to MAX_U64_BIG_INT. * @param args.mutableDescription - Controls mutability of the collection's description. Defaults to true. * @param args.mutableRoyalty - Controls mutability of the collection's royalty. Defaults to true. * @param args.mutableUri - Controls mutability of the collection's URI. Defaults to true. * @param args.mutableTokenDescription - Controls mutability of the digital asset's description. Defaults to true. * @param args.mutableTokenName - Controls mutability of the digital asset's name. Defaults to true. * @param args.mutableTokenProperties - Controls mutability of digital asset's properties. Defaults to true. * @param args.mutableTokenUri - Controls mutability of the digital asset's URI. Defaults to true. * @param args.tokensBurnableByCreator - Controls whether digital assets can be burnable by the creator. Defaults to true. * @param args.tokensFreezableByCreator - Controls whether digital assets can be frozen by the creator. Defaults to true. * @param args.royaltyNumerator - The numerator of the royalty to be paid to the creator when a digital asset is transferred. * Defaults to 0. * @param args.royaltyDenominator - The denominator of the royalty to be paid to the creator when a digital asset is * transferred. Defaults to 1. * * @returns A SimpleTransaction that when submitted will create the collection. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Creating a new collection transaction * const transaction = await aptos.createCollectionTransaction({ * creator: Account.generate(), // Replace with a real account * description: "A unique collection of digital assets.", * name: "My Digital Collection", * uri: "https://mycollection.com", * }); * * console.log("Transaction created:", transaction); * } * runExample().catch(console.error); * ``` * @group DigitalAsset */ createCollectionTransaction(args: { creator: Account; description: string; name: string; uri: string; options?: InputGenerateTransactionOptions; } & CreateCollectionOptions): Promise; /** * Create a transaction to mint a digital asset into the creator's account within an existing collection. * This function helps you generate a transaction that can be simulated or submitted to the blockchain for minting a digital asset. * * @param args.creator - The creator of the collection. * @param args.collection - The name of the collection the digital asset belongs to. * @param args.description - The description of the digital asset. * @param args.name - The name of the digital asset. * @param args.uri - The URI to additional info about the digital asset. * @param args.propertyKeys - Optional array of property keys for the digital asset. * @param args.propertyTypes - Optional array of property types for the digital asset. * @param args.propertyValues - Optional array of property values for the digital asset. * @param args.options - Optional transaction generation options. * * @returns A SimpleTransaction that can be simulated or submitted to the chain. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Creating a transaction to mint a digital asset * const transaction = await aptos.mintDigitalAssetTransaction({ * creator: Account.generate(), // replace with a real account * collection: "MyCollection", * description: "This is a digital asset.", * name: "MyDigitalAsset", * uri: "https://example.com/my-digital-asset", * }); * * console.log(transaction); * } * runExample().catch(console.error); * ``` * @group DigitalAsset */ mintDigitalAssetTransaction(args: { creator: Account; collection: string; description: string; name: string; uri: string; propertyKeys?: Array; propertyTypes?: Array; propertyValues?: Array; options?: InputGenerateTransactionOptions; }): Promise; /** * Transfer ownership of a non-fungible digital asset. * This function allows you to transfer a digital asset only if it is not frozen, meaning the ownership transfer is not disabled. * * @param args The arguments for transferring the digital asset. * @param args.sender The sender account of the current digital asset owner. * @param args.digitalAssetAddress The address of the digital asset being transferred. * @param args.recipient The account address of the recipient. * @param args.digitalAssetType Optional. The type of the digital asset, defaults to "0x4::token::Token". * @param args.options Optional. Additional options for generating the transaction. * * @returns A SimpleTransaction that can be simulated or submitted to the chain. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Transfer a digital asset * const transaction = await aptos.transferDigitalAssetTransaction({ * sender: Account.generate(), // replace with a real sender account * digitalAssetAddress: "0x123", // replace with a real digital asset address * recipient: "0x456", // replace with a real recipient account address * }); * * console.log(transaction); * } * runExample().catch(console.error); * ``` * @group DigitalAsset */ transferDigitalAssetTransaction(args: { sender: Account; digitalAssetAddress: AccountAddressInput; recipient: AccountAddress; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; }): Promise; /** * Mint a soul bound digital asset into a recipient's account. * This function allows you to create a unique digital asset that is bound to a specific account. * * @param args - The arguments for minting the soul bound transaction. * @param args.account - The account that mints the digital asset. * @param args.collection - The collection name that the digital asset belongs to. * @param args.description - The digital asset description. * @param args.name - The digital asset name. * @param args.uri - The digital asset URL. * @param args.recipient - The account address where the digital asset will be created. * @param args.propertyKeys - The property keys for storing on-chain properties. * @param args.propertyTypes - The type of property values. * @param args.propertyValues - The property values to be stored on-chain. * @param args.options - Additional options for generating the transaction. * * @returns A SimpleTransaction that can be simulated or submitted to the chain. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Mint a soul bound digital asset * const transaction = await aptos.mintSoulBoundTransaction({ * account: Account.generate(), // Replace with a real account * collection: "collectionName", * description: "collectionDescription", * name: "digitalAssetName", * uri: "digital-asset-uri.com", * recipient: "0x123" // Replace with a real recipient account address * }); * * console.log(transaction); * } * runExample().catch(console.error); * ``` * @group DigitalAsset */ mintSoulBoundTransaction(args: { account: Account; collection: string; description: string; name: string; uri: string; recipient: AccountAddressInput; propertyKeys?: Array; propertyTypes?: Array; propertyValues?: Array; options?: InputGenerateTransactionOptions; }): Promise; /** * Burn a digital asset by its creator, allowing for the removal of a specified digital asset from the blockchain. * * @param args The arguments for burning the digital asset. * @param args.creator The creator account that is burning the digital asset. * @param args.digitalAssetAddress The address of the digital asset to be burned. * @param args.digitalAssetType Optional. The type of the digital asset being burned. * @param args.options Optional. Additional options for generating the transaction. * * @returns A SimpleTransaction that can be simulated or submitted to the chain. * * @example * ```typescript * import { Aptos, AptosConfig, Network, Account } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * const creator = Account.generate(); // Replace with a real creator account * const transaction = await aptos.burnDigitalAssetTransaction({ * creator: creator, * digitalAssetAddress: "0x123", // Replace with a real digital asset address * }); * * console.log(transaction); * } * runExample().catch(console.error); * ``` * @group DigitalAsset */ burnDigitalAssetTransaction(args: { creator: Account; digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; }): Promise; /** * Freeze the ability to transfer a specified digital asset. * This function allows the creator to restrict the transfer capability of a digital asset. * * @param args The arguments for freezing the digital asset transfer. * @param args.creator The creator account initiating the freeze. * @param args.digitalAssetAddress The address of the digital asset to be frozen. * @param args.digitalAssetType Optional. The type of the digital asset being frozen. * @param args.options Optional. Additional options for generating the transaction. * * @returns A SimpleTransaction that can be simulated or submitted to the chain. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Freeze the digital asset transfer * const transaction = await aptos.freezeDigitalAssetTransaferTransaction({ * creator: Account.generate(), // Replace with a real account if needed * digitalAssetAddress: "0x123", // Replace with a real digital asset address * }); * * console.log(transaction); * } * runExample().catch(console.error); * ``` * @group DigitalAsset */ freezeDigitalAssetTransaferTransaction(args: { creator: Account; digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; }): Promise; /** * Unfreeze the ability to transfer a digital asset. * This function allows the specified creator account to unfreeze the transfer of a digital asset identified by its address. * * @param args The parameters for unfreezing the digital asset transfer. * @param args.creator The creator account that is unfreezing the digital asset transfer. * @param args.digitalAssetAddress The address of the digital asset to unfreeze. * @param args.digitalAssetType Optional. The type of the digital asset being unfrozen. * @param args.options Optional. Additional options for generating the transaction. * * @returns A SimpleTransaction that can be simulated or submitted to the chain. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Unfreeze the ability to transfer a digital asset * const transaction = await aptos.unfreezeDigitalAssetTransaferTransaction({ * creator: Account.generate(), // replace with a real creator account * digitalAssetAddress: "0x123", // replace with a real digital asset address * }); * * console.log(transaction); * } * runExample().catch(console.error); * ``` * @group DigitalAsset */ unfreezeDigitalAssetTransaferTransaction(args: { creator: Account; digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; }): Promise; /** * Set the digital asset description to provide additional context or information about the asset. * * @param args The parameters for setting the digital asset description. * @param args.creator The creator account responsible for the digital asset. * @param args.description The digital asset description to be set. * @param args.digitalAssetAddress The address of the digital asset. * @param args.digitalAssetType Optional. The type of the digital asset. * @param args.options Optional. Additional options for generating the transaction. * * @returns A SimpleTransaction that can be simulated or submitted to the chain. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Set the digital asset description * const transaction = await aptos.setDigitalAssetDescriptionTransaction({ * creator: Account.generate(), // replace with a real account * description: "This is a digital asset description.", * digitalAssetAddress: "0x123", // replace with a real digital asset address * }); * * console.log(transaction); * } * runExample().catch(console.error); * ``` * @group DigitalAsset */ setDigitalAssetDescriptionTransaction(args: { creator: Account; description: string; digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; }): Promise; /** * Set the digital asset name, allowing you to define a name for a specific digital asset on the blockchain. * * @param args The parameters for setting the digital asset name. * @param args.creator The creator account responsible for the transaction. * @param args.name The desired name for the digital asset. * @param args.digitalAssetAddress The address of the digital asset. * @param args.digitalAssetType Optional. The type of the digital asset, represented as a Move struct ID. * @param args.options Optional. Additional options for generating the transaction. * * @returns A SimpleTransaction that can be simulated or submitted to the blockchain. * * @example * ```typescript * import { Aptos, AptosConfig, Network, Account } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * const creator = Account.generate(); // Generate a new account for the creator * const digitalAssetAddress = "0x123"; // replace with a real digital asset address * * // Set the digital asset name * const transaction = await aptos.setDigitalAssetNameTransaction({ * creator: creator, * name: "digitalAssetName", * digitalAssetAddress: digitalAssetAddress, * }); * * console.log(transaction); * } * runExample().catch(console.error); * ``` * @group DigitalAsset */ setDigitalAssetNameTransaction(args: { creator: Account; name: string; digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; }): Promise; /** * Set the URI for a digital asset, allowing you to associate a unique identifier with the asset. * * @param args The parameters for the transaction. * @param args.creator The creator account initiating the transaction. * @param args.uri The digital asset URI to be set. * @param args.digitalAssetAddress The address of the digital asset. * @param args.digitalAssetType Optional. The type of the digital asset. * @param args.options Optional. Additional options for generating the transaction. * @returns A SimpleTransaction that can be simulated or submitted to the chain. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Set the URI for a digital asset * const transaction = await aptos.setDigitalAssetURITransaction({ * creator: Account.generate(), // Replace with a real creator account * uri: "digital-asset-uri.com", * digitalAssetAddress: "0x123", // Replace with a real digital asset address * }); * * console.log(transaction); * } * runExample().catch(console.error); * ``` * @group DigitalAsset */ setDigitalAssetURITransaction(args: { creator: Account; uri: string; digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; }): Promise; /** * Add a digital asset property to the blockchain. * This function allows you to specify a new property for a digital asset, including its key, type, and value. * * @param args - The arguments for adding a digital asset property. * @param args.creator - The account that mints the digital asset. * @param args.propertyKey - The property key for storing on-chain properties. * @param args.propertyType - The type of property value. * @param args.propertyValue - The property value to be stored on-chain. * @param args.digitalAssetAddress - The digital asset address. * @param args.digitalAssetType - (Optional) The type of the digital asset. * @param args.options - (Optional) Options for generating the transaction. * @returns A SimpleTransaction that can be simulated or submitted to the chain. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Add a digital asset property * const transaction = await aptos.addDigitalAssetPropertyTransaction({ * creator: Account.generate(), // Replace with a real account * propertyKey: "newKey", * propertyType: "BOOLEAN", * propertyValue: true, * digitalAssetAddress: "0x123", // Replace with a real digital asset address * }); * * console.log(transaction); * } * runExample().catch(console.error); * ``` * @group DigitalAsset */ addDigitalAssetPropertyTransaction(args: { creator: Account; propertyKey: string; propertyType: PropertyType; propertyValue: PropertyValue; digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; }): Promise; /** * Remove a digital asset property from the blockchain. * This function allows you to delete an existing property associated with a digital asset. * * @param args The parameters required to remove the digital asset property. * @param args.creator The account that mints the digital asset. * @param args.propertyKey The property key for storing on-chain properties. * @param args.propertyType The type of property value. * @param args.propertyValue The property value to be stored on-chain. * @param args.digitalAssetAddress The digital asset address. * @param args.digitalAssetType Optional. The type of the digital asset. * @param args.options Optional. Additional options for generating the transaction. * * @returns A SimpleTransaction that can be simulated or submitted to the chain. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Remove a digital asset property * const transaction = await aptos.removeDigitalAssetPropertyTransaction({ * creator: Account.generate(), // replace with a real account * propertyKey: "newKey", * propertyType: "BOOLEAN", * propertyValue: true, * digitalAssetAddress: "0x123", // replace with a real digital asset address * }); * * console.log(transaction); * } * runExample().catch(console.error); * ``` * @group DigitalAsset */ removeDigitalAssetPropertyTransaction(args: { creator: Account; propertyKey: string; propertyType: PropertyType; propertyValue: PropertyValue; digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; }): Promise; /** * Update a digital asset property on-chain. * * @param args The parameters for updating the digital asset property. * @param args.creator The account that mints the digital asset. * @param args.digitalAssetAddress The address of the digital asset. * @param args.propertyKey The property key for storing on-chain properties. * @param args.propertyType The type of property value. * @param args.propertyValue The property value to be stored on-chain. * @param args.digitalAssetType Optional. The type of the digital asset. * @param args.options Optional. Additional options for generating the transaction. * * @returns A SimpleTransaction that can be simulated or submitted to the chain. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Update a digital asset property * const transaction = await aptos.updateDigitalAssetPropertyTransaction({ * creator: Account.generate(), // replace with a real account * propertyKey: "newKey", * propertyType: "BOOLEAN", * propertyValue: false, * digitalAssetAddress: "0x123", // replace with a real digital asset address * }); * * console.log(transaction); * } * runExample().catch(console.error); * ``` * @group DigitalAsset */ updateDigitalAssetPropertyTransaction(args: { creator: Account; propertyKey: string; propertyType: PropertyType; propertyValue: PropertyValue; digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; }): Promise; /** * Add a typed digital asset property to the blockchain. * This function allows you to define and store a specific property for a digital asset, enabling better categorization and * management of digital assets. * * @param args - The parameters for adding the typed property. * @param args.creator - The account that mints the digital asset. * @param args.propertyKey - The property key for storing on-chain properties. * @param args.propertyType - The type of property value. * @param args.propertyValue - The property value to be stored on-chain. * @param args.digitalAssetAddress - The digital asset address. * @param args.digitalAssetType - The optional type of the digital asset. * @param args.options - Optional transaction generation options. * * @returns A SimpleTransaction that can be simulated or submitted to the chain. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Adding a typed digital asset property * const transaction = await aptos.addDigitalAssetTypedPropertyTransaction({ * creator: Account.generate(), // replace with a real account * propertyKey: "typedKey", * propertyType: "STRING", * propertyValue: "hello", * digitalAssetAddress: "0x123", // replace with a real digital asset address * }); * * console.log(transaction); * } * runExample().catch(console.error); * ``` * @group DigitalAsset */ addDigitalAssetTypedPropertyTransaction(args: { creator: Account; propertyKey: string; propertyType: PropertyType; propertyValue: PropertyValue; digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; }): Promise; /** * Update a typed digital asset property on-chain. * This function allows you to modify the properties of a digital asset, enabling dynamic updates to its attributes. * * @param args - The arguments for updating the digital asset property. * @param args.creator - The account that mints the digital asset. * @param args.propertyKey - The property key for storing on-chain properties. * @param args.propertyType - The type of property value. * @param args.propertyValue - The property value to be stored on-chain. * @param args.digitalAssetAddress - The digital asset address. * @param args.digitalAssetType - (Optional) The type of the digital asset. * @param args.options - (Optional) Additional options for generating the transaction. * * @returns A SimpleTransaction that can be simulated or submitted to the chain. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Update a typed digital asset property * const transaction = await aptos.updateDigitalAssetTypedPropertyTransaction({ * creator: Account.generate(), // replace with a real account * propertyKey: "typedKey", * propertyType: "U8", * propertyValue: 2, * digitalAssetAddress: "0x123", // replace with a real digital asset address * }); * * console.log(transaction); * } * runExample().catch(console.error); * ``` * @group DigitalAsset */ updateDigitalAssetTypedPropertyTransaction(args: { creator: Account; propertyKey: string; propertyType: PropertyType; propertyValue: PropertyValue; digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; }): Promise; } /** * A class to query all `Faucet` related queries on Aptos. * @group Faucet */ declare class Faucet { readonly config: AptosConfig; /** * Initializes a new instance of the Aptos client with the specified configuration. * * Note that only devnet has a publicly accessible faucet. For testnet, you must use * the minting page at https://aptos.dev/network/faucet. * * @param config - The configuration settings for the Aptos client. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * async function runExample() { * // Create a configuration for the Aptos client * const config = new AptosConfig({ network: Network.DEVNET }); // specify your own network if needed * * // Initialize the Aptos client with the configuration * const aptos = new Aptos(config); * * console.log("Aptos client initialized:", aptos); * } * runExample().catch(console.error); * ``` * @group Faucet */ constructor(config: AptosConfig); /** * This function creates an account if it does not exist and mints the specified amount of coins into that account. * * Note that only devnet has a publicly accessible faucet. For testnet, you must use * the minting page at https://aptos.dev/network/faucet. * * @param args - The arguments for funding the account. * @param args.accountAddress - The address of the account to fund. * @param args.amount - The amount of tokens to fund the account with. * @param args.options - Configuration options for waiting for the transaction. * @returns Transaction hash of the transaction that funded the account. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.DEVNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Fund an account with a specified amount of tokens * const transaction = await aptos.fundAccount({ * accountAddress: "0x1", // replace with your account address * amount: 100, * }); * * console.log("Transaction hash:", transaction.hash); * } * runExample().catch(console.error); * ``` * @group Faucet */ fundAccount(args: { accountAddress: AccountAddressInput; amount: number; options?: WaitForTransactionOptions; }): Promise; } /** * A class for querying and managing fungible asset-related operations on the Aptos blockchain. * @group FungibleAsset */ declare class FungibleAsset { readonly config: AptosConfig; /** * Initializes a new instance of the Aptos class with the provided configuration. * This allows you to interact with the Aptos blockchain using the specified network settings. * * @param config - The configuration settings for connecting to the Aptos network. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * async function runExample() { * // Create a configuration for the Aptos client * const config = new AptosConfig({ network: Network.TESTNET }); // Specify your own network if needed * * // Initialize the Aptos client with the configuration * const aptos = new Aptos(config); * * console.log("Aptos client initialized:", aptos); * } * runExample().catch(console.error); * ``` * @group FungibleAsset */ constructor(config: AptosConfig); /** * Queries all fungible asset metadata. * * @param args Optional parameters for the query. * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying. * @param args.options Optional configuration for pagination and filtering. * * @returns A list of fungible asset metadata. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Fetching fungible asset metadata * const fungibleAssets = await aptos.getFungibleAssetMetadata(); * console.log(fungibleAssets); * } * runExample().catch(console.error); * ``` * @group FungibleAsset */ getFungibleAssetMetadata(args?: { minimumLedgerVersion?: AnyNumber; options?: PaginationArgs & WhereArg; }): Promise; /** * Queries the fungible asset metadata for a specific asset type. * This function helps retrieve detailed information about a fungible asset based on its type. * * @param args - The parameters for the query. * @param args.assetType - The asset type of the fungible asset, e.g., "0x1::aptos_coin::AptosCoin" for Aptos Coin. * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying. * * @returns A fungible asset metadata item. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Retrieve fungible asset metadata by asset type * const fungibleAsset = await aptos.getFungibleAssetMetadataByAssetType({ * assetType: "0x1::aptos_coin::AptosCoin" // replace with your asset type * }); * * console.log(fungibleAsset); * } * runExample().catch(console.error); * ``` * @group FungibleAsset */ getFungibleAssetMetadataByAssetType(args: { assetType: string; minimumLedgerVersion?: AnyNumber; }): Promise; /** * Retrieves fungible asset metadata based on the creator address. * * This function allows you to query metadata for a specific fungible asset created by a given address. * * @param args - The parameters for the query. * @param args.creatorAddress - The creator address of the fungible asset. * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying. * * @returns A fungible asset metadata item. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Retrieve fungible asset metadata by creator address * const fungibleAsset = await aptos.getFungibleAssetMetadataByCreatorAddress({ * creatorAddress: "0x123", // replace with a real creator address * }); * * console.log(fungibleAsset); * } * runExample().catch(console.error); * ``` * @group FungibleAsset */ getFungibleAssetMetadataByCreatorAddress(args: { creatorAddress: AccountAddressInput; minimumLedgerVersion?: AnyNumber; }): Promise; /** * Queries all fungible asset activities and returns a list of their metadata. * * @param args Optional parameters for the query. * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying. * @param args.options Optional configuration for pagination and filtering. * @returns A list of fungible asset metadata. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Fetching fungible asset activities * const fungibleAssetActivities = await aptos.getFungibleAssetActivities(); * console.log(fungibleAssetActivities); * } * runExample().catch(console.error); * ``` * @group FungibleAsset */ getFungibleAssetActivities(args?: { minimumLedgerVersion?: AnyNumber; options?: PaginationArgs & WhereArg; }): Promise; /** * Queries all fungible asset balances. * * @param args Optional parameters for the query. * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying. * @param args.options Optional configuration for pagination and filtering. * * @returns A list of fungible asset metadata. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Fetching current fungible asset balances * const fungibleAssetBalances = await aptos.getCurrentFungibleAssetBalances(); * * console.log(fungibleAssetBalances); * } * runExample().catch(console.error); * ``` * @group FungibleAsset */ getCurrentFungibleAssetBalances(args?: { minimumLedgerVersion?: AnyNumber; options?: PaginationArgs & WhereArg; }): Promise; /** * Transfer a specified amount of fungible asset from the sender's primary store to the recipient's primary store. * This method allows you to transfer any fungible asset, including fungible tokens. * * @param args - The arguments for the transfer operation. * @param args.sender - The sender account. * @param args.fungibleAssetMetadataAddress - The fungible asset account address. For example, if you're transferring USDT, * this would be the USDT address. * @param args.recipient - The recipient account address. * @param args.amount - The number of assets to transfer. * @param args.options - Optional parameters for generating the transaction. * * @returns A SimpleTransaction that can be simulated or submitted to the chain. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Transfer fungible asset from sender to recipient * const transaction = await aptos.transferFungibleAsset({ * sender: Account.generate(), // replace with a real sender account * fungibleAssetMetadataAddress: "0x123", // replace with a real fungible asset address * recipient: "0x456", // replace with a real recipient account * amount: 5 * }); * * console.log(transaction); * } * runExample().catch(console.error); * ``` * @group FungibleAsset */ transferFungibleAsset(args: { sender: Account; fungibleAssetMetadataAddress: AccountAddressInput; recipient: AccountAddressInput; amount: AnyNumber; options?: InputGenerateTransactionOptions; }): Promise; /** * Transfer a specified amount of fungible asset from the sender's any (primary or secondary) fungible store to any (primary or secondary) fungible store. * This method allows you to transfer any fungible asset, including fungible tokens. * * @param args - The arguments for the transfer operation. * @param args.sender - The sender account initiating the transfer. * @param args.fromStore - The fungible store address initiating the transfer. * @param args.toStore - The fungible store address receiving the asset. * @param args.amount - The number of assets to transfer. Must be a positive number. * @param args.options - Optional parameters for generating the transaction. * * @returns A SimpleTransaction that can be simulated or submitted to the chain. * * @throws Error if: * - The sender account is invalid * - The store addresses are invalid * - The amount is negative or zero * - The transaction fails to generate * * @example * ```typescript * import { Aptos, AptosConfig, Network, Account } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function transferAssets() { * // Transfer 100 units of the asset from senderStore to recipientStore * const transaction = await aptos.transferFungibleAssetBetweenStores({ * sender: Account.generate(), // replace with a real sender account * fromStore: "0x123", // replace with a real fungible store address * toStore: "0x456", // replace with a real fungible store address * amount: 100 * }); * * console.log(transaction); * } * * transferAssets().catch(console.error); * ``` * @group FungibleAsset */ transferFungibleAssetBetweenStores(args: { sender: Account; fromStore: AccountAddressInput; toStore: AccountAddressInput; amount: AnyNumber; options?: InputGenerateTransactionOptions; }): Promise; } /** * A class to query various Aptos-related information and perform operations on the Aptos blockchain. * @group General */ declare class General { readonly config: AptosConfig; /** * Initializes a new instance of the Aptos client with the specified configuration. * This allows users to interact with the Aptos blockchain using the provided settings. * * @param config - The configuration settings for the Aptos client. * @param config.network - The network to connect to (e.g., TESTNET, MAINNET). * @param config.nodeUrl - The URL of the Aptos node to connect to. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * async function runExample() { * // Create a configuration for the Aptos client * const config = new AptosConfig({ * network: Network.TESTNET, // specify the network * nodeUrl: "https://testnet.aptos.dev" // specify the node URL * }); * * // Initialize the Aptos client with the configuration * const aptos = new Aptos(config); * * console.log("Aptos client initialized:", aptos); * } * runExample().catch(console.error); * ``` * @group General */ constructor(config: AptosConfig); /** * Queries for the Aptos ledger information. * * @returns The Aptos Ledger Info, which includes details such as chain ID, epoch, and ledger version. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Fetching the ledger information * const ledgerInfo = await aptos.getLedgerInfo(); * * console.log(ledgerInfo); * } * runExample().catch(console.error); * ``` * @group General */ getLedgerInfo(): Promise; /** * Retrieves the chain ID of the Aptos blockchain. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Fetching the chain ID * const chainId = await aptos.getChainId(); * console.log("Chain ID:", chainId); * } * runExample().catch(console.error); * * @returns The chain ID of the Aptos blockchain. * ``` * @group General */ getChainId(): Promise; /** * Retrieves block information by the specified ledger version. * * @param args - The arguments for retrieving the block. * @param args.ledgerVersion - The ledger version to lookup block information for. * @param args.options - Optional parameters for the request. * @param args.options.withTransactions - If set to true, include all transactions in the block. * * @returns Block information with optional transactions. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Retrieve block information for a specific ledger version * const block = await aptos.getBlockByVersion({ ledgerVersion: 5 }); * console.log(block); * } * runExample().catch(console.error); * ``` * @group General */ getBlockByVersion(args: { ledgerVersion: AnyNumber; options?: { withTransactions?: boolean; }; }): Promise; /** * Retrieve a block by its height, allowing for the inclusion of transactions if specified. * * @param args - The parameters for the block retrieval. * @param args.blockHeight - The block height to look up, starting at 0. * @param args.options - Optional settings for the retrieval. * @param args.options.withTransactions - If set to true, includes all transactions in the block. * * @returns The block with optional transactions included. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Retrieve the block at height 5, including transactions * const block = await aptos.getBlockByHeight({ blockHeight: 5, options: { withTransactions: true } }); * console.log(block); * } * runExample().catch(console.error); * ``` * @group General */ getBlockByHeight(args: { blockHeight: AnyNumber; options?: { withTransactions?: boolean; }; }): Promise; /** * Queries for a Move view function * @param args.payload Payload for the view function * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version * * @example * const data = await aptos.view({ * payload: { * function: "0x1::coin::balance", * typeArguments: ["0x1::aptos_coin::AptosCoin"], * functionArguments: [accountAddress], * } * }) * * @returns an array of Move values * @group General */ view>(args: { payload: InputViewFunctionData; options?: LedgerVersionArg; }): Promise; /** * Queries for a Move view function with JSON, this provides compatability with the old `aptos` package * @param args.payload Payload for the view function * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version * * @example * const data = await aptos.view({ * payload: { * function: "0x1::coin::balance", * typeArguments: ["0x1::aptos_coin::AptosCoin"], * functionArguments: [accountAddress.toString()], * } * }) * * @returns an array of Move values * @group General */ viewJson>(args: { payload: InputViewFunctionJsonData; options?: LedgerVersionArg; }): Promise; /** * Queries the top user transactions based on the specified limit. * * @param args - The arguments for querying top user transactions. * @param args.limit - The number of transactions to return. * @returns GetChainTopUserTransactionsResponse * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Fetch the top user transactions with a limit of 5 * const topUserTransactions = await aptos.getChainTopUserTransactions({ limit: 5 }); * * console.log(topUserTransactions); * } * runExample().catch(console.error); * ``` * @group General */ getChainTopUserTransactions(args: { limit: number; }): Promise; /** * Retrieves data from the Aptos Indexer using a GraphQL query. * This function allows you to execute complex queries to fetch specific data from the Aptos blockchain. * * @param args.query.query - A GraphQL query string. * @param args.query.variables - The variables for the query (optional). * * @return The provided T type. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Querying the Aptos Indexer for ledger information * const topUserTransactions = await aptos.queryIndexer({ * query: { query: `query MyQuery { * ledger_infos { * chain_id * } * }`} * }); * * console.log(topUserTransactions); * } * runExample().catch(console.error); * ``` * @group General */ queryIndexer(args: { query: GraphqlQuery; }): Promise; /** * Queries for the last successful indexer version, providing insight into the ledger version the indexer is updated to, which * may lag behind the full nodes. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Get the last successful indexer version * const version = await aptos.getIndexerLastSuccessVersion(); * console.log(`Last successful indexer version: ${version}`); * } * runExample().catch(console.error); * ``` * @group General */ getIndexerLastSuccessVersion(): Promise; /** * Query the processor status for a specific processor type. * * @param processorType The processor type to query. * @returns The status of the specified processor type. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Get the processor status for the account transactions processor * const status = await aptos.getProcessorStatus("account_transactions_processor"); * console.log(status); * } * runExample().catch(console.error); * ``` * @group General */ getProcessorStatus(processorType: ProcessorType): Promise; } /** * This file contains the underlying implementations for exposed API surface in * the {@link api/name}. By moving the methods out into a separate file, * other namespaces and processes can access these methods without depending on the entire * name namespace and without having a dependency cycle error. * @group Implementation */ /** * Parameters for registering a name in the Aptos network. * * @param aptosConfig - Configuration settings for the Aptos network. * @param sender - The account initiating the name registration. * @param name - The name to be registered. * @param expiration - The expiration policy for the name registration. * @param transferable - Whether the name can be transferred to another owner. * @param toAddress - The address that will be set as the owner_address of the name. * @param targetAddress - The address that this name will resolve to. * @group Implementation */ interface RegisterNameParameters { aptosConfig: AptosConfig; sender: AccountAddressInput; name: string; expiration: { policy: "domain"; years?: 1; } | { policy: "subdomain:follow-domain"; } | { policy: "subdomain:independent"; expirationDate: number; }; transferable?: boolean; toAddress?: AccountAddressInput; targetAddress?: AccountAddressInput; options?: InputGenerateTransactionOptions; } /** * Options for querying names, including pagination, ordering, and filtering criteria. * * @param options - Pagination and filtering options for the query. * @group Implementation */ interface QueryNamesOptions { options?: PaginationArgs & OrderByArg & WhereArg; } /** * Arguments for retrieving account names based on the specified account address. * * @param accountAddress - The address of the account for which names are to be retrieved. * @group Implementation */ interface GetAccountNamesArgs extends QueryNamesOptions { accountAddress: AccountAddressInput; } /** * Arguments for retrieving the domains associated with a specific account. * * @param accountAddress - The address of the account for which to fetch domains. * @group Implementation */ interface GetAccountDomainsArgs extends QueryNamesOptions { accountAddress: AccountAddressInput; } /** * Arguments for retrieving subdomains associated with a specific account. * * @param accountAddress - The address of the account for which to fetch subdomains. * @group Implementation */ interface GetAccountSubdomainsArgs extends QueryNamesOptions { accountAddress: AccountAddressInput; } /** * Arguments for retrieving subdomains associated with a specific domain. * * @param domain - The domain for which to fetch subdomains. * @group Implementation */ interface GetDomainSubdomainsArgs extends QueryNamesOptions { domain: string; } /** * A class to handle all `ANS` operations. * @group ANS */ declare class ANS { readonly config: AptosConfig; /** * Initializes a new instance of the Aptos class with the provided configuration. * This allows you to interact with the Aptos blockchain using the specified network settings. * * @param config - The configuration settings for the Aptos client. * @param config.network - The network to connect to (e.g., mainnet, testnet). * @param config.nodeUrl - The URL of the Aptos node to connect to. * @param config.faucetUrl - The URL of the faucet to use for funding accounts. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * async function runExample() { * // Create a configuration for connecting to the Aptos testnet * const config = new AptosConfig({ network: Network.TESTNET }); * * // Initialize the Aptos client with the configuration * const aptos = new Aptos(config); * * console.log("Aptos client initialized:", aptos); * } * runExample().catch(console.error); * ``` * @group ANS */ constructor(config: AptosConfig); /** * Retrieve the owner address of a specified domain name or subdomain name from the contract. * * @param args - The arguments for retrieving the owner address. * @param args.name - A string representing the name of the domain or subdomain to retrieve the owner address for. * * @returns AccountAddress if the name is owned, undefined otherwise. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Retrieve the owner address of "test.aptos" * const owner = await aptos.getOwnerAddress({ name: "test.aptos" }); * console.log(owner); // Logs the owner address or undefined if not owned * } * runExample().catch(console.error); * ``` * @group ANS */ getOwnerAddress(args: { name: string; }): Promise; /** * Retrieve the expiration time of a domain name or subdomain name from the contract. * * @param args - The arguments for retrieving the expiration. * @param args.name - A string of the name to retrieve. * * @returns number as a unix timestamp in milliseconds. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Get the expiration time for the domain "test.aptos" * const exp = await aptos.getExpiration({ name: "test.aptos" }); * * // Log the expiration date * console.log(new Date(exp)); // Outputs the expiration date * } * runExample().catch(console.error); * ``` * @group ANS */ getExpiration(args: { name: string; }): Promise; /** * Retrieve the target address of a domain or subdomain name, which indicates the address the name points to for use on-chain. * Note that the target address can point to addresses that do not own the name. * * @param args - The arguments for retrieving the target address. * @param args.name - A string representing the name, which can be a primary name, a subdomain, or a combination (e.g., * "primary", "primary.apt", "secondary.primary", "secondary.primary.apt"). * * @returns AccountAddress if the name has a target, undefined otherwise. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Retrieve the target address for the specified domain name * const targetAddr = await aptos.getTargetAddress({ name: "test.aptos" }); * * console.log(targetAddr); // Logs the target address, e.g., 0x123... * } * runExample().catch(console.error); * ``` * @group ANS */ getTargetAddress(args: { name: string; }): Promise; /** * Sets the target address of a domain or subdomain name, pointing it to a specified address for use on-chain. * The target address can be different from the owner of the name. * * @param args - The arguments for setting the target address. * @param args.sender - The account initiating the transaction. * @param args.name - A string representing the domain or subdomain name (e.g., "test.aptos"). * @param args.address - The AccountAddressInput of the address to set the domain or subdomain to. * @param args.options - Optional settings for generating the transaction. * * @returns An object containing the transaction and the InputEntryFunctionData * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Setting the target address for a domain name * const sender = Account.generate(); // replace with a real account * const address = "0x1"; // replace with a real account address * * const { transaction, data } = await aptos.setTargetAddress({ * sender, * name: "test.aptos", * address, * }); * * const targetAddress = await aptos.getTargetAddress({ name: "test.aptos" }); * console.log(targetAddress); // Should log the address set for "test.aptos" * } * runExample().catch(console.error); * ``` * @group ANS */ setTargetAddress(args: { sender: AccountAddressInput; name: string; address: AccountAddressInput; options?: InputGenerateTransactionOptions; }): Promise<{ transaction: SimpleTransaction; data: InputEntryFunctionData; }>; /** * Clears the target address of a domain or subdomain name, removing the address association. * After clearing, the name will no longer resolve to a specific address. * * @param args - The arguments for clearing the target address. * @param args.sender - The account initiating the transaction. * @param args.name - A string representing the domain or subdomain name (e.g., "test.aptos"). * @param args.options - Optional settings for generating the transaction. * * @returns An object containing the transaction and the InputEntryFunctionData * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Clearing the target address for a domain name * const sender = Account.generate(); // replace with a real account * * const { transaction, data } = await aptos.clearTargetAddress({ * sender, * name: "test.aptos", * }); * * const targetAddress = await aptos.getTargetAddress({ name: "test.aptos" }); * console.log(targetAddress); // Should log undefined after clearing * } * runExample().catch(console.error); * ``` * @group ANS */ clearTargetAddress(args: { sender: AccountAddressInput; name: string; options?: InputGenerateTransactionOptions; }): Promise<{ transaction: SimpleTransaction; data: InputEntryFunctionData; }>; /** * Retrieve the primary name for an account. An account can have multiple names, but only one primary name, which may not exist. * * @param args - The arguments for retrieving the primary name. * @param args.address - An AccountAddressInput (address) of the account. * * @returns A string if the account has a primary name, undefined otherwise. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Retrieve the primary name for the specified account address * const name = await aptos.getPrimaryName({ address: "0x1" }); // replace with a real account address * console.log(name); * } * runExample().catch(console.error); * ``` * @group ANS */ getPrimaryName(args: { address: AccountAddressInput; }): Promise; /** * Sets the primary name for the sender account, allowing them to designate a single primary name among potentially multiple * names. An account may not have a primary name. * * @param args - The arguments for setting the primary name. * @param args.sender - The sender account. * @param args.name - A string representing the name to set as primary (e.g., "test.aptos"). * @param args.options - Optional transaction options. * * @returns An object containing the transaction and the InputEntryFunctionData * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Set the primary name for the sender account * const sender = Account.generate(); // replace with a real account * const { transaction, data } = await aptos.setPrimaryName({ sender, name: "test.aptos" }); * * const primaryName = await aptos.getPrimaryName({ address: sender.accountAddress }); * console.log("Primary Name:", primaryName); // Should log: "Primary Name: test.aptos" * } * runExample().catch(console.error); * ``` * @group ANS */ setPrimaryName(args: { sender: AccountAddressInput; name?: string; options?: InputGenerateTransactionOptions; }): Promise<{ transaction: SimpleTransaction; data: InputEntryFunctionData; }>; /** * Registers a new name. * * This function allows you to register a domain or subdomain name with specific expiration policies and options. * * @param args.sender - The sender account. * @param args.name - A string of the name to register. This can be inclusive or exclusive of the .apt suffix. Examples include: * "test", "test.apt", "test.aptos.apt", etc. * @param args.expiration - An object with the expiration policy of the name. * @param args.expiration.policy - 'domain' | 'subdomain:follow-domain' | 'subdomain:independent'. * - domain: Years is required and the name will expire after the given number of years. * - subdomain:follow-domain: The name will expire at the same time as the domain name. * - subdomain:independent: The name will expire at the given date. * @param args.expiration.expirationDate - An epoch number in milliseconds of the date when the subdomain will expire. Only * applicable when the policy is set to 'subdomain:independent'. * @param args.transferable - Determines if the subdomain being minted is soul-bound. Applicable only to subdomains. * @param args.targetAddress optional - The address the domain name will resolve to. If not provided, the sender's address will * be used. * @param args.toAddress optional - The address to send the domain name to. If not provided, the transaction will be sent to the * router. * * @returns An object containing the transaction and the InputEntryFunctionData * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Registering a subdomain name assuming def.apt is already registered and belongs to the sender alice. * const { transaction, data } = await aptos.registerName({ * sender: "0x1", // replace with a real sender account * name: "test.aptos.apt", * expiration: { * policy: "subdomain:independent", * expirationDate: Date.now() + 30 * 24 * 60 * 60 * 1000, // expires in 30 days * }, * }); * * console.log("Transaction:", transaction); * } * runExample().catch(console.error); * ``` * @group ANS */ registerName(args: Omit): Promise<{ transaction: SimpleTransaction; data: InputEntryFunctionData; }>; /** * Renews a domain name for one year. * If a domain name was minted with V1 of the contract, it will automatically be upgraded to V2 via this transaction. * * @param args - The arguments for renewing the domain. * @param args.sender - The sender account, which must be the domain owner. * @param args.name - A string representing the domain to renew. Subdomains cannot be renewed. * @param args.years - The number of years to renew the name. Currently, only one year is permitted. * @param args.options - Optional transaction options. * * @returns An object containing the transaction and the InputEntryFunctionData * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Renew the domain "test" for one year * const { transaction, data } = await aptos.renewDomain({ * sender: Account.generate(), // replace with a real account * name: "test" * }); * * console.log(transaction); * } * runExample().catch(console.error); * ``` * @group ANS */ renewDomain(args: { sender: AccountAddressInput; name: string; years?: 1; options?: InputGenerateTransactionOptions; }): Promise<{ transaction: SimpleTransaction; data: InputEntryFunctionData; }>; /** * Fetches a single name from the indexer based on the provided name argument. * * @param args - The arguments for retrieving the name. * @param args.name - A string of the name to retrieve, e.g. "test.aptos.apt" or "test.apt" or "test". * Can be inclusive or exclusive of the .apt suffix and can be a subdomain. * * @returns A promise of an ANSName or undefined if the name is not active. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Fetching a name from the indexer * const name = await aptos.getName({ name: "test.aptos" }); // replace with a real name * console.log(name); * } * runExample().catch(console.error); * ``` * @group ANS */ getName(args: { name: string; }): Promise; /** * Fetches all names for an account, including both top-level domains and subdomains. * * @param args - The arguments for fetching account names. * @param args.accountAddress - An AccountAddressInput of the address to retrieve names for. * @param args.options - Optional parameters for fetching names. * @param args.options.offset - Optional, the offset to start from when fetching names. * @param args.options.limit - Optional, a number of the names to fetch per request. * @param args.options.orderBy - The order to sort the names by. * @param args.options.where - Additional filters to apply to the query. * * @returns A promise of an array of ANSName. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Fetch account names for a specific address * const accountNames = await aptos.getAccountNames({ * accountAddress: "0x1", // replace with a real account address * options: { * limit: 10, // specify how many names to fetch * orderBy: "name", // specify the order by which to sort the names * }, * }); * * console.log(accountNames); * } * runExample().catch(console.error); * ``` * @group ANS */ getAccountNames(args: GetAccountNamesArgs): Promise<{ names: AnsName[]; total: number; }>; /** * Fetches all top-level domain names for a specified account. * * @param args - The arguments for retrieving account domains. * @param args.accountAddress - An AccountAddressInput of the address to retrieve domain names for. * @param args.options.offset - Optional, the offset to start from when fetching names. * @param args.options.limit - Optional, a number of the names to fetch per request. * @param args.options.orderBy - The order to sort the names by. * @param args.options.where - Additional filters to apply to the query. * * @returns A promise of an array of ANSName. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Fetching all top-level domain names for a specific account * const domains = await aptos.getAccountDomains({ * accountAddress: "0x1", // replace with a real account address * options: { * limit: 10, // specify the number of names to fetch * offset: 0, // specify the offset for pagination * orderBy: "created_at", // specify the order by which to sort the names * where: { * // additional filters can be specified here * }, * }, * }); * * console.log(domains); * } * runExample().catch(console.error); * ``` * @group ANS */ getAccountDomains(args: GetAccountDomainsArgs): Promise<{ names: AnsName[]; total: number; }>; /** * Fetches all subdomain names for a specified account. * * @param args - The arguments for retrieving subdomains. * @param args.accountAddress - The address to retrieve subdomain names for. * @param args.options - Optional parameters for fetching subdomains. * @param args.options.offset - The offset to start from when fetching names. * @param args.options.limit - The number of names to fetch per request. * @param args.options.orderBy - The order to sort the names by. * @param args.options.where - Additional filters to apply to the query. * * @returns A promise of an array of ANSName. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Fetching subdomain names for a specific account * const subdomains = await aptos.getAccountSubdomains({ * accountAddress: "0x1", // replace with a real account address * options: { * limit: 10, // specify the number of subdomains to fetch * offset: 0, // specify the offset for pagination * orderBy: "name", // specify the order by which to sort the names * }, * }); * * console.log(subdomains); * } * runExample().catch(console.error); * ``` * @group ANS */ getAccountSubdomains(args: GetAccountSubdomainsArgs): Promise<{ names: AnsName[]; total: number; }>; /** * Fetches all subdomain names for a given domain, excluding the domain itself. * * @param args - The arguments for fetching subdomains. * @param args.domain - A string of the domain name, e.g., "test.apt" or "test" (without the suffix of .apt). * @param args.options - Optional parameters for fetching subdomains. * @param args.options.offset - Optional, the offset to start from when fetching names. * @param args.options.limit - Optional, the number of names to fetch per request. * @param args.options.orderBy - The order to sort the names by. * @param args.options.where - Additional filters to apply to the query. * * @returns A promise that resolves to an array of ANSName. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Fetching subdomains for a specific domain * const subdomains = await aptos.getDomainSubdomains({ * domain: "test", // replace with your domain * options: { * limit: 10, // specify the number of subdomains to fetch * offset: 0, // specify the starting point for fetching * orderBy: "name", // specify the order by which to sort the results * }, * }); * * console.log(subdomains); * } * runExample().catch(console.error); * ``` * @group ANS */ getDomainSubdomains(args: GetDomainSubdomainsArgs): Promise<{ names: AnsName[]; total: number; }>; } /** * A class to query all `Staking` related queries on Aptos. * @group Staking */ declare class Staking { readonly config: AptosConfig; /** * Creates an instance of the Aptos client with the specified configuration. * This allows you to interact with the Aptos blockchain using the provided settings. * * @param config - The configuration settings for the Aptos client. * @param config.network - The network to connect to (e.g., TESTNET, MAINNET). * @param config.nodeUrl - The URL of the Aptos node to connect to. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * async function runExample() { * // Create a configuration for the Aptos client * const config = new AptosConfig({ network: Network.TESTNET }); // Specify your network * * // Initialize the Aptos client with the configuration * const aptos = new Aptos(config); * * console.log("Aptos client initialized:", aptos); * } * runExample().catch(console.error); * ``` * @group Staking */ constructor(config: AptosConfig); /** * Queries the current number of delegators in a specified pool. Throws an error if the pool is not found. * * @param args - The parameters for the query. * @param args.poolAddress - The address of the pool to query. * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying. * @returns The number of delegators for the given pool. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Get the number of delegators for a specific pool * const delegators = await aptos.getNumberOfDelegators({ poolAddress: "0x1" }); // replace with a real pool address * console.log(`Number of delegators: ${delegators}`); * } * runExample().catch(console.error); * ``` * @group Staking */ getNumberOfDelegators(args: { poolAddress: AccountAddressInput; minimumLedgerVersion?: AnyNumber; }): Promise; /** * Retrieves the current number of delegators across all pools. * * @param args Optional parameters for the query. * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying. * @param args.options Optional ordering options for the response. * @returns GetNumberOfDelegatorsForAllPoolsResponse response type containing the number of delegators per pool. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Retrieve the number of delegators for all pools * const delegators = await aptos.getNumberOfDelegatorsForAllPools(); * console.log(delegators); * } * runExample().catch(console.error); * ``` * @group Staking */ getNumberOfDelegatorsForAllPools(args?: { minimumLedgerVersion?: AnyNumber; options?: OrderByArg; }): Promise; /** * Queries delegated staking activities for a specific delegator and pool. * * @param args - The arguments for querying delegated staking activities. * @param args.delegatorAddress - The address of the delegator. * @param args.poolAddress - The address of the staking pool. * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying. * @returns The response containing delegated staking activities. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Get delegated staking activities for a specific delegator and pool * const activities = await aptos.getDelegatedStakingActivities({ * delegatorAddress: "0x1", // replace with a real delegator address * poolAddress: "0x2", // replace with a real pool address * minimumLedgerVersion: 1, // specify your own if needed * }); * * console.log(activities); * } * runExample().catch(console.error); * ``` * @group Staking */ getDelegatedStakingActivities(args: { delegatorAddress: AccountAddressInput; poolAddress: AccountAddressInput; minimumLedgerVersion?: AnyNumber; }): Promise; } /** * This file contains the underlying implementations for exposed submission API surface in * the {@link api/transaction}. By moving the methods out into a separate file, * other namespaces and processes can access these methods without depending on the entire * transaction namespace and without having a dependency cycle error. * @group Implementation */ type FeePayerOrFeePayerAuthenticatorOrNeither = { feePayer: Account; feePayerAuthenticator?: never; } | { feePayer?: never; feePayerAuthenticator: AccountAuthenticator; } | { feePayer?: never; feePayerAuthenticator?: never; }; /** * A class to handle all `Build` transaction operations. * @group Implementation */ declare class Build { readonly config: AptosConfig; /** * Initializes a new instance of the Aptos client with the specified configuration. * This allows you to interact with the Aptos blockchain using the provided settings. * * @param config - The configuration settings for the Aptos client. * @param config.network - The network to connect to (e.g., TESTNET, MAINNET). * @param config.nodeUrl - The URL of the Aptos node to connect to. * @param config.account - The account details for authentication. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * async function runExample() { * // Create a configuration for the Aptos client * const config = new AptosConfig({ * network: Network.TESTNET, // specify the network * nodeUrl: "https://testnet.aptos.dev", // specify the node URL * }); * * // Initialize the Aptos client * const aptos = new Aptos(config); * * console.log("Aptos client initialized:", aptos); * } * runExample().catch(console.error); * ``` * @group Implementation */ constructor(config: AptosConfig); /** * Build a simple transaction. * * This function allows you to create a transaction with specified sender and data. * * @param args.sender - The sender account address. * @param args.data - The transaction data. * @param args.options - Optional transaction configurations. * @param args.withFeePayer - Whether there is a fee payer for the transaction. * * @returns SimpleTransaction * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Build a simple transaction * const transaction = await aptos.transaction.simple({ * sender: "0x1", // replace with a real sender account address * data: { * function: "0x1::aptos_account::transfer", * functionArguments: ["0x2", 100], // replace with a real destination account address * }, * options: { * gasUnitPrice: 100, // specify your own gas unit price if needed * maxGasAmount: 1000, // specify your own max gas amount if needed * }, * }); * * console.log(transaction); * } * runExample().catch(console.error); * ``` * @group Implementation */ simple(args: { sender: AccountAddressInput; data: InputGenerateTransactionPayloadData; options?: InputGenerateTransactionOptions; withFeePayer?: boolean; }): Promise; /** * Build a multi-agent transaction that allows multiple signers to authorize a transaction. * * @param args - The parameters for creating the multi-agent transaction. * @param args.sender - The sender account address. * @param args.data - The transaction data. * @param args.secondarySignerAddresses - An array of the secondary signers' account addresses. * @param args.options - Optional transaction configurations. * @param args.withFeePayer - Whether there is a fee payer for the transaction. * * @returns MultiAgentTransaction * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Build a multi-agent transaction * const transaction = await aptos.multiAgent({ * sender: "0x1", // replace with a real sender account address * data: { * // Transaction data structure * function: "0x1::aptos_account::transfer", * functionArguments: ["0x2", 100], // replace with a real destination account address and amount * }, * secondarySignerAddresses: ["0x3", "0x4"], // replace with real secondary signer addresses * options: { * // Optional transaction configurations * maxGasAmount: "1000", * gasUnitPrice: "1", * }, * }); * * console.log(transaction); * } * runExample().catch(console.error); * ``` * @group Implementation */ multiAgent(args: { sender: AccountAddressInput; data: InputGenerateTransactionPayloadData; secondarySignerAddresses: AccountAddressInput[]; options?: InputGenerateTransactionOptions; withFeePayer?: boolean; }): Promise; } /** * A class to handle all `Simulate` transaction operations. * @group Implementation */ declare class Simulate { readonly config: AptosConfig; /** * Initializes a new instance of the Aptos client with the specified configuration. * This allows you to interact with the Aptos blockchain using the provided settings. * * @param config - The configuration settings for the Aptos client. * @param config.network - The network to connect to (e.g., TESTNET, MAINNET). * @param config.nodeUrl - The URL of the Aptos node to connect to. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * async function runExample() { * // Create a configuration for the Aptos client * const config = new AptosConfig({ network: Network.TESTNET }); // Specify your desired network * * // Initialize the Aptos client with the configuration * const aptos = new Aptos(config); * * console.log("Aptos client initialized:", aptos); * } * runExample().catch(console.error); * ``` * @group Implementation */ constructor(config: AptosConfig); /** * Simulates a transaction based on the provided parameters and returns the result. * This function helps you understand the outcome of a transaction before executing it on the blockchain. * * @param args - The parameters for simulating the transaction. * @param args.signerPublicKey - The public key of the signer for the transaction (optional). * @param args.transaction - The raw transaction data to simulate. * @param args.feePayerPublicKey - The public key of the fee payer (optional). * @param args.options - Additional options for simulating the transaction (optional). * * @example * ```typescript * import { * Account, * Aptos, * AptosConfig, * Network, * } from "@aptos-labs/ts-sdk"; * * async function example() { * let sender = Account.generate(); * let receiver = Account.generate(); * * // 0. Set up the client and test accounts * const config = new AptosConfig({ network: Network.DEVNET }); * const aptos = new Aptos(config); * * await aptos.fundAccount({ * accountAddress: sender.accountAddress, * amount: 100_000_000, * }); * * // 1. Build the transaction to preview the impact of it * const transaction = await aptos.transaction.build.simple({ * sender: sender.accountAddress, * data: { * // All transactions on Aptos are implemented via smart contracts. * function: "0x1::aptos_account::transfer", * functionArguments: [receiver.accountAddress, 100], * }, * }); * * // 2. Simulate to see what would happen if we execute this transaction * const [userTransactionResponse] = await aptos.transaction.simulate.simple({ * signerPublicKey: sender.publicKey, * transaction, * }); * console.log(userTransactionResponse); * * // If the fee looks ok, continue to signing! * // ... * } * * example(); * ``` * @group Implementation */ simple(args: { signerPublicKey?: PublicKey; transaction: AnyRawTransaction; feePayerPublicKey?: PublicKey; options?: InputSimulateTransactionOptions; }): Promise>; /** * Simulates a multi-agent transaction by generating a signed transaction and posting it to the Aptos full node. * This function helps in understanding the outcome of a transaction involving multiple signers before it is executed. * * @param args - The parameters for simulating the transaction. * @param args.signerPublicKey - The public key of the primary signer (optional). * @param args.transaction - The raw transaction to be simulated. * @param args.secondarySignersPublicKeys - An array of public keys for secondary signers (optional). * Each element of the array can be optional, allowing the corresponding key check to be skipped. * @param args.feePayerPublicKey - The public key of the fee payer (optional). * @param args.options - Options for simulating the transaction (optional). * * @example * ```typescript * import { * Account, * Aptos, * AptosConfig, * Network, * } from "@aptos-labs/ts-sdk"; * * async function example() { * let sender1 = Account.generate(); * let sender2 = Account.generate(); * let receiver = Account.generate(); * * // 0. Set up the client and test accounts * const config = new AptosConfig({ network: Network.DEVNET }); * const aptos = new Aptos(config); * * await aptos.fundAccount({ * accountAddress: sender.accountAddress, * amount: 100_000_000, * }); * * // 1. Build * console.log("\n=== 1. Building the transaction ===\n"); * const transaction = await aptos.transaction.build.multiAgent({ * sender: sender1.accountAddress, * secondarySignerAddresses: [sender2.accountAddress], * data: { * // REPLACE WITH YOUR MULTI-AGENT FUNCTION HERE * function: * " (Syntax {address}::{module}::{function})", * functionArguments: [], * }, * }); * console.log("Transaction:", transaction); * * // 2. Simulate (Optional) * console.log("\n === 2. Simulating Response (Optional) === \n"); * const [userTransactionResponse] = await aptos.transaction.simulate.multiAgent( * { * signerPublicKey: sender1.publicKey, * secondarySignersPublicKeys: [sender2.publicKey], * transaction, * }, * ); * console.log(userTransactionResponse); * * // If the fee looks ok, continue to signing! * // ... * } * * example(); * ``` * @group Implementation */ multiAgent(args: { signerPublicKey?: PublicKey; transaction: AnyRawTransaction; secondarySignersPublicKeys?: Array; feePayerPublicKey?: PublicKey; options?: InputSimulateTransactionOptions; }): Promise>; } /** * A class to handle all `Submit` transaction operations. * @group Implementation */ declare class Submit { readonly config: AptosConfig; /** * Initializes a new instance of the Aptos client with the specified configuration. * This allows you to interact with the Aptos blockchain using the provided settings. * * @param config - The configuration settings for the Aptos client. * @param config.network - The network to connect to (e.g., TESTNET, MAINNET). * @param config.nodeUrl - The URL of the Aptos node to connect to. * @param config.faucetUrl - The URL of the faucet for obtaining test tokens. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * async function runExample() { * // Create a configuration for the Aptos client * const config = new AptosConfig({ * network: Network.TESTNET, // Use the TESTNET for testing * nodeUrl: "https://testnet.aptos.dev", // Specify the node URL * faucetUrl: "https://faucet.testnet.aptos.dev" // Specify the faucet URL * }); * * // Initialize the Aptos client with the configuration * const aptos = new Aptos(config); * * console.log("Aptos client initialized:", aptos); * } * runExample().catch(console.error); * ``` * @group Implementation */ constructor(config: AptosConfig); /** * Submits a transaction to the Aptos blockchain using the provided transaction details and authenticators. * This function allows you to execute transactions securely by specifying the sender and optional fee payer authenticators. * * @param args - The arguments for submitting the transaction. * @param args.transaction - The raw transaction data to be submitted. * @param args.senderAuthenticator - The authenticator for the sender's account. * @param [args.feePayerAuthenticator] - The optional authenticator for the fee payer's account. * * @example * ```typescript * import { Aptos, AptosConfig, Network, Account } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * const sender = Account.generate(); // Generate a new sender account * const transaction = await aptos.transaction.build.simple({ * sender: sender.accountAddress, * data: { * function: "0x1::aptos_account::transfer", * functionArguments: [Account.generate().accountAddress, 100], // Replace with a real destination account * }, * }); * * // Submit the transaction * const response = await aptos.simple({ * transaction, * senderAuthenticator: sender.getAuthenticator(), // Use the sender's authenticator * }); * * console.log("Transaction submitted:", response); * } * runExample().catch(console.error); * ``` * @group Implementation */ simple(args: { transaction: AnyRawTransaction; senderAuthenticator: AccountAuthenticator; feePayerAuthenticator?: AccountAuthenticator; } & InputTransactionPluginData): Promise; /** * Submits a multi-agent transaction to the Aptos network, allowing multiple signers to authorize the transaction. * This function is useful for scenarios where a transaction requires approval from multiple accounts. * * @param args - The parameters for the multi-agent transaction. * @param args.transaction - The raw transaction to be submitted. * @param args.senderAuthenticator - The authenticator for the sender account. * @param args.additionalSignersAuthenticators - An array of authenticators for additional signers. * @param [args.feePayerAuthenticator] - An optional authenticator for the fee payer account. * * @example * ```typescript * import { Aptos, AptosConfig, Network, Account } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * const sender = Account.generate(); // Generate a new sender account * const additionalSigner1 = Account.generate(); // Generate an additional signer account * const additionalSigner2 = Account.generate(); // Generate another additional signer account * * const transaction = await aptos.transaction.build.simple({ * sender: sender.accountAddress, * data: { * function: "0x1::aptos_account::transfer", * functionArguments: [additionalSigner1.accountAddress, 100], * }, * }); * * const response = await aptos.multiAgent({ * transaction, * senderAuthenticator: sender.getAuthenticator(), // Use the sender's authenticator * additionalSignersAuthenticators: [ * additionalSigner1.getAuthenticator(), // Use the first additional signer's authenticator * additionalSigner2.getAuthenticator(), // Use the second additional signer's authenticator * ], * }); * * console.log(response); // Log the response from the transaction submission * } * runExample().catch(console.error); * ``` * @group Implementation */ multiAgent(args: { transaction: AnyRawTransaction; senderAuthenticator: AccountAuthenticator; additionalSignersAuthenticators: Array; feePayerAuthenticator?: AccountAuthenticator; } & InputTransactionPluginData): Promise; } /** * A wrapper that handles and manages an account sequence number. * * Submit up to `maximumInFlight` transactions per account in parallel with a timeout of `sleepTime` * If local assumes `maximumInFlight` are in flight, determine the actual committed state from the network * If there are less than `maximumInFlight` due to some being committed, adjust the window * If `maximumInFlight` are in flight, wait `sleepTime` seconds before re-evaluating * If ever waiting more than `maxWaitTime` restart the sequence number to the current on-chain state * * Assumptions: * Accounts are expected to be managed by a single AccountSequenceNumber and not used otherwise. * They are initialized to the current on-chain state, so if there are already transactions in * flight, they may take some time to reset. * Accounts are automatically initialized if not explicitly * * Notes: * This is co-routine safe, that is many async tasks can be reading from this concurrently. * The state of an account cannot be used across multiple AccountSequenceNumber services. * The synchronize method will create a barrier that prevents additional nextSequenceNumber * calls until it is complete. * This only manages the distribution of sequence numbers it does not help handle transaction * failures. * If a transaction fails, you should call synchronize and wait for timeouts. * @group Implementation * @category Transactions */ /** * Represents an account's sequence number management for transaction handling on the Aptos blockchain. * This class provides methods to retrieve the next available sequence number, synchronize with the on-chain sequence number, * and manage local sequence numbers while ensuring thread safety. * * @param aptosConfig - The configuration settings for Aptos. * @param account - The account associated with the sequence number. * @param maxWaitTime - The maximum time to wait for a transaction to commit. * @param maximumInFlight - The maximum number of transactions that can be in flight at once. * @param sleepTime - The time to wait before retrying to get the sequence number. * @group Implementation * @category Transactions */ declare class AccountSequenceNumber { readonly aptosConfig: AptosConfig; readonly account: Account; lastUncommintedNumber: bigint | null; currentNumber: bigint | null; /** * We want to guarantee that we preserve ordering of workers to requests. * * `lock` is used to try to prevent multiple coroutines from accessing a shared resource at the same time, * which can result in race conditions and data inconsistency. * This code actually doesn't do it though, since we aren't giving out a slot, it is still somewhat a race condition. * * The ideal solution is likely that each thread grabs the next number from an incremental integer. * When they complete, they increment that number and that entity is able to enter the `lock`. * That would guarantee ordering. * @group Implementation * @category Transactions */ lock: boolean; maxWaitTime: number; maximumInFlight: number; sleepTime: number; /** * Creates an instance of the class with the specified configuration and account details. * This constructor initializes the necessary parameters for managing Aptos transactions. * * @param aptosConfig - The configuration settings for Aptos. * @param account - The account associated with the Aptos transactions. * @param maxWaitTime - The maximum time to wait for a transaction to be processed, in milliseconds. * @param maximumInFlight - The maximum number of transactions that can be in flight at the same time. * @param sleepTime - The time to sleep between transaction checks, in milliseconds. * @group Implementation * @category Transactions */ constructor(aptosConfig: AptosConfig, account: Account, maxWaitTime: number, maximumInFlight: number, sleepTime: number); /** * Returns the next available sequence number for this account. * This function ensures that the sequence number is updated and synchronized, handling potential delays in transaction commits. * * @returns {BigInt} The next available sequence number. * @group Implementation * @category Transactions */ nextSequenceNumber(): Promise; /** * Initializes this account with the sequence number on chain. * * @returns {Promise} A promise that resolves when the account has been initialized. * * @throws {Error} Throws an error if the account information cannot be retrieved. * @group Implementation * @category Transactions */ initialize(): Promise; /** * Updates this account's sequence number with the one on-chain. * * @returns The on-chain sequence number for this account. * @group Implementation * @category Transactions */ update(): Promise; /** * Synchronizes the local sequence number with the sequence number on-chain for the specified account. * This function polls the network until all submitted transactions have either been committed or until the maximum wait time has elapsed. * * @throws {Error} Throws an error if there is an issue synchronizing the account sequence number with the one on-chain. * @group Implementation * @category Transactions */ synchronize(): Promise; } /** * The AsyncQueue class is an async-aware data structure that provides a queue-like * behavior for managing asynchronous tasks or operations. * It allows to enqueue items and dequeue them asynchronously. * This is not thread-safe, but it is async concurrency safe, and * it does not guarantee ordering for those that call into and await on enqueue. * @group Implementation * @category Transactions */ declare class AsyncQueue { readonly queue: T[]; private pendingDequeue; private cancelled; /** * Adds an item to the queue. If there are pending dequeued promises, it resolves the oldest promise with the enqueued item * immediately; otherwise, it adds the item to the queue. * * @param item - The item to be added to the queue. * @group Implementation * @category Transactions */ enqueue(item: T): void; /** * Dequeues the next item from the queue and returns a promise that resolves to it. * If the queue is empty, it creates a new promise that will be resolved when an item is enqueued. * * @returns Promise * @group Implementation * @category Transactions */ dequeue(): Promise; /** * Determine whether the queue is empty. * * @returns boolean - Returns true if the queue has no elements, otherwise false. * @group Implementation * @category Transactions */ isEmpty(): boolean; /** * Cancels all pending promises in the queue and rejects them with an AsyncQueueCancelledError. * This ensures that any awaiting code can handle the cancellation appropriately. * * @returns {void} * @group Implementation * @category Transactions */ cancel(): void; /** * Determine whether the queue has been cancelled. * * @returns boolean - Returns true if the queue is cancelled, otherwise false. * @group Implementation * @category Transactions */ isCancelled(): boolean; /** * Retrieve the length of the pending dequeue. * * @returns number - The number of items currently in the pending dequeue. * @group Implementation * @category Transactions */ pendingDequeueLength(): number; } /** * @group Implementation * @category Transactions */ declare const promiseFulfilledStatus = "fulfilled"; /** * Events emitted by the transaction worker during its operation, allowing the dapp to respond to various transaction states. * @group Implementation * @category Transactions */ declare enum TransactionWorkerEventsEnum { TransactionSent = "transactionSent", TransactionSendFailed = "transactionSendFailed", TransactionExecuted = "transactionExecuted", TransactionExecutionFailed = "transactionExecutionFailed", ExecutionFinish = "executionFinish" } /** * Defines the events emitted by the transaction worker during various stages of transaction processing. * * @group Implementation * @category Transactions */ interface TransactionWorkerEvents { transactionSent: (data: SuccessEventData) => void; transactionSendFailed: (data: FailureEventData) => void; transactionExecuted: (data: SuccessEventData) => void; transactionExecutionFailed: (data: FailureEventData) => void; executionFinish: (data: ExecutionFinishEventData) => void; } /** * The payload for when the worker has finished its job. * @group Implementation * @category Transactions */ type ExecutionFinishEventData = { message: string; }; /** * The payload for a success event. * @group Implementation * @category Transactions */ type SuccessEventData = { message: string; transactionHash: string; }; /** * The payload for a failure event. * @group Implementation * @category Transactions */ type FailureEventData = { message: string; error: string; }; /** * TransactionWorker provides a simple framework for receiving payloads to be processed. * * Once one `start()` the process and pushes a new transaction, the worker acquires * the current account's next sequence number (by using the AccountSequenceNumber class), * generates a signed transaction and pushes an async submission process into the `outstandingTransactions` queue. * At the same time, the worker processes transactions by reading the `outstandingTransactions` queue * and submits the next transaction to chain, it * 1) waits for resolution of the submission process or get pre-execution validation error * and 2) waits for the resolution of the execution process or get an execution error. * The worker fires events for any submission and/or execution success and/or failure. * @group Implementation * @category Transactions */ declare class TransactionWorker extends EventEmitter { readonly aptosConfig: AptosConfig; readonly account: Account; readonly accountSequnceNumber: AccountSequenceNumber; readonly taskQueue: AsyncQueue<() => Promise>; started: boolean; /** * transactions payloads waiting to be generated and signed * * TODO support entry function payload from ABI builder * @group Implementation * @category Transactions */ transactionsQueue: AsyncQueue<[InputGenerateTransactionPayloadData, InputGenerateTransactionOptions | undefined]>; /** * signed transactions waiting to be submitted * @group Implementation * @category Transactions */ outstandingTransactions: AsyncQueue<[Promise, bigint]>; /** * transactions that have been submitted to chain. * Limited to MAX_TRANSACTION_HISTORY_SIZE entries to prevent unbounded memory growth. * @group Implementation * @category Transactions */ sentTransactions: Array<[string, bigint, any]>; /** * transactions that have been committed to chain. * Limited to MAX_TRANSACTION_HISTORY_SIZE entries to prevent unbounded memory growth. * @group Implementation * @category Transactions */ executedTransactions: Array<[string, bigint, any]>; /** * Adds a transaction to the history array while enforcing the maximum size limit. * Removes the oldest entries when the limit is exceeded. * @private */ private addToTransactionHistory; /** * Initializes a new instance of the class, providing a framework for receiving payloads to be processed. * * @param aptosConfig - A configuration object for Aptos. * @param account - The account that will be used for sending transactions. * @param maxWaitTime - The maximum wait time to wait before re-syncing the sequence number to the current on-chain state, * default is 30 seconds. * @param maximumInFlight - The maximum number of transactions that can be submitted per account, default is 100. * @param sleepTime - The time to wait in seconds before re-evaluating if the maximum number of transactions are in flight, * default is 10 seconds. * @group Implementation * @category Transactions */ constructor(aptosConfig: AptosConfig, account: Account, maxWaitTime?: number, maximumInFlight?: number, sleepTime?: number); /** * Submits the next transaction for the account by generating it with the current sequence number * and adding it to the outstanding transaction queue for processing. * This function continues to submit transactions until there are no more to process. * * @throws {Error} Throws an error if the transaction submission fails. * @group Implementation * @category Transactions */ submitNextTransaction(): Promise; /** * Reads the outstanding transaction queue and submits the transactions to the chain. * This function processes each transaction, checking their status and emitting events based on whether they were successfully * sent or failed. * * @throws {Error} Throws an error if the process execution fails. * @event TransactionWorkerEventsEnum.TransactionSent - Emitted when a transaction has been successfully committed to the chain. * @event TransactionWorkerEventsEnum.TransactionSendFailed - Emitted when a transaction fails to commit, along with the error * reason. * @event TransactionWorkerEventsEnum.ExecutionFinish - Emitted when the execution of transactions is complete. * @group Implementation * @category Transactions */ processTransactions(): Promise; /** * Once a transaction has been sent to the chain, this function checks for its execution status. * @param sentTransaction - The transaction that was sent to the chain and is now waiting to be executed. * @param sequenceNumber - The account's sequence number that was sent with the transaction. * @group Implementation * @category Transactions */ checkTransaction(sentTransaction: PromiseFulfilledResult, sequenceNumber: bigint): Promise; /** * Pushes a transaction to the transactions queue for processing. * * @param transactionData - The transaction payload containing necessary details. * @param transactionData.abi - For all entry function payloads, the ABI to skip remote ABI lookups. * @param options - Optional parameters for transaction configuration. * @param options.maxGasAmount - Maximum gas amount for the transaction. * @param options.gasUnitPrice - Gas unit price for the transaction. * @param options.expireTimestamp - Expiration timestamp on the transaction. * @param options.accountSequenceNumber - The sequence number for the transaction. * @group Implementation * @category Transactions */ push(transactionData: InputGenerateTransactionPayloadData, options?: InputGenerateTransactionOptions): Promise; /** * Generates a signed transaction that can be submitted to the chain. * * @param account - An Aptos account used as the sender of the transaction. * @param sequenceNumber - A sequence number the transaction will be generated with. * @returns A signed transaction object or undefined if the transaction queue is empty. * @group Implementation * @category Transactions */ generateNextTransaction(account: Account, sequenceNumber: bigint): Promise; /** * Starts transaction submission and processing by executing tasks from the queue until it is cancelled. * * @throws {Error} Throws an error if unable to start transaction batching. * @group Implementation * @category Transactions */ run(): Promise; /** * Starts the transaction management process. * * @throws {Error} Throws an error if the worker has already started. * @group Implementation * @category Transactions */ start(): void; /** * Stops the transaction management process. * * @throws {Error} Throws an error if the worker has already stopped. * @group Implementation * @category Transactions */ stop(): void; } declare class TransactionManagement extends EventEmitter { account: Account; transactionWorker: TransactionWorker; readonly config: AptosConfig; /** * Initializes a new instance of the Aptos client with the provided configuration settings. * This allows you to interact with the Aptos blockchain using the specified network and options. * * @param config - The configuration settings for the Aptos client. * @param config.network - The network to connect to (e.g., TESTNET, MAINNET). * @param config.nodeUrl - The URL of the Aptos node to connect to. * @param config.account - Optional account settings for authentication. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * async function runExample() { * // Create a configuration for the Aptos client * const config = new AptosConfig({ * network: Network.TESTNET, // specify the network to use * nodeUrl: "https://testnet.aptos.dev" // replace with your node URL * }); * * // Initialize the Aptos client with the configuration * const aptos = new Aptos(config); * * console.log("Aptos client initialized successfully."); * } * runExample().catch(console.error); * ``` * @group Implementation */ constructor(config: AptosConfig); /** * Initializes the transaction worker using the provided sender account and begins listening for events. * This function is essential for setting up the transaction processing environment. * * @param args - The arguments for starting the transaction worker. * @param args.sender - The sender account to sign and submit the transaction. * * @example * ```typescript * import { Aptos, AptosConfig, Network, Account } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * const sender = Account.generate(); // Generate a new account for sending transactions * * // Start the transaction worker with the sender account * aptos.start({ sender }); * * console.log("Transaction worker started with sender:", sender.accountAddress); * } * runExample().catch(console.error); * ``` * @group Implementation */ private start; /** * Pushes transaction data to the transaction worker for processing. * * @param args.data An array of transaction payloads to be processed. * @param args.options Optional. Transaction generation configurations (excluding accountSequenceNumber). * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Prepare transaction payloads * const payloads = [ * {}, // Build your first transaction payload * {}, // Build your second transaction payload * ]; * * // Push transaction data to the worker * aptos.push({ * data: payloads, * {}, // Specify options as needed * }); * * console.log("Transaction data pushed successfully."); * } * runExample().catch(console.error); * ``` * @group Implementation */ private push; /** * Starts listening to transaction worker events, allowing the application to respond to transaction status changes. * This function enables the application to handle events such as transaction sent, execution success, or failure. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Register to listen for transaction events * aptos.registerToEvents(); * * // You can send a transaction here to see the events in action * const sender = Account.generate(); // replace with a real account * const destination = Account.generate(); // replace with a real account * * const transaction = await aptos.transaction.build.simple({ * sender: sender.accountAddress, * data: { * function: "0x1::aptos_account::transfer", * functionArguments: [destination.accountAddress, 100], * }, * }); * * await aptos.transaction.send(transaction); * * console.log("Transaction sent and events registered."); * } * runExample().catch(console.error); * ``` * @group Implementation */ private registerToEvents; /** * Send batch transactions for a single account. * * This function uses a transaction worker that receives payloads to be processed * and submitted to chain. * Note that this process is best for submitting multiple transactions that * don't rely on each other, i.e. batch funds, batch token mints, etc. * * If any worker failure, the functions throws an error. * * @param args.sender The sender account to sign and submit the transaction * @param args.data An array of transaction payloads * @param args.options optional. Transaction generation configurations (excluding accountSequenceNumber) * * @return void. Throws if any error * @group Implementation */ forSingleAccount(args: { sender: Account; data: InputGenerateTransactionPayloadData[]; options?: Omit; }): void; } /** * Represents a transaction in the Aptos blockchain, * providing methods to build, simulate, submit, and manage transactions. * This class encapsulates functionalities for querying transaction details, * estimating gas prices, signing transactions, and handling transaction states. * * This class is used as part of the Aptos object, so should be called like so: * @example * ```typescript * import { Account, Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const ALICE_INITIAL_BALANCE = 100_000_000; * const TRANSFER_AMOUNT = 100; * * async function example() { * console.log( * "This example will create two accounts (Alice and Bob), fund them, and transfer between them.", * ); * * // Set up the client * const config = new AptosConfig({ network: Network.DEVNET }); * const aptos = new Aptos(config); * * // Generate two account credentials * // Each account has a private key, a public key, and an address * const alice = Account.generate(); * const bob = Account.generate(); * * console.log("=== Addresses ===\n"); * console.log(`Alice's address is: ${alice.accountAddress}`); * console.log(`Bob's address is: ${bob.accountAddress}`); * * // Fund the accounts using a faucet * console.log("\n=== Funding accounts ===\n"); * * await aptos.fundAccount({ * accountAddress: alice.accountAddress, * amount: ALICE_INITIAL_BALANCE, * }); * * // Check initial balance * console.log("\n=== Initial Balance ===\n"); * const aliceBalance = await aptos.getAccountAPTAmount({ * accountAddress: alice.accountAddress, * }); * console.log(`Alice's balance is: ${aliceBalance}`); * * // Send a transaction from Alice's account to Bob's account * const txn = await aptos.transaction.build.simple({ * sender: alice.accountAddress, * data: { * // All transactions on Aptos are implemented via smart contracts. * function: "0x1::aptos_account::transfer", * functionArguments: [bob.accountAddress, TRANSFER_AMOUNT], * }, * options: { maxGasAmount: 100000 }, * }); * * console.log("\n=== Transfer transaction ===\n"); * // Both signs and submits * const committedTxn = await aptos.signAndSubmitTransaction({ * signer: alice, * transaction: txn, * }); * // Waits for Aptos to verify and execute the transaction * const executedTransaction = await aptos.waitForTransaction({ * transactionHash: committedTxn.hash, * }); * console.log("Transaction hash:", executedTransaction.hash); * * console.log("\n=== Balances after transfer ===\n"); * const newAliceBalance = await aptos.getAccountAPTAmount({ * accountAddress: alice.accountAddress, * }); * console.log(`Alice's balance is: ${newAliceBalance}`); * * const newBobBalance = await aptos.getAccountAPTAmount({ * accountAddress: bob.accountAddress, * }); * console.log(`Bob's balance is: ${newBobBalance}`); * } * * example(); * ``` * @group Transaction */ declare class Transaction { readonly config: AptosConfig; readonly build: Build; readonly simulate: Simulate; readonly submit: Submit; readonly batch: TransactionManagement; /** * Creates an instance of the Aptos client with the specified configuration. * This allows you to interact with the Aptos blockchain using the provided settings. * * @param config - The configuration settings for the Aptos client. * @param config.network - The network to connect to (e.g., Testnet, Mainnet). * @param config.nodeUrl - The URL of the Aptos node to connect to. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * async function runExample() { * // Create a new Aptos client instance * const config = new AptosConfig({ network: Network.TESTNET }); // Specify the network * const aptos = new Aptos(config); * * console.log("Aptos client created successfully:", aptos); * } * runExample().catch(console.error); * ``` * @group Transaction */ constructor(config: AptosConfig); /** * Queries on-chain transactions, excluding pending transactions. * Use this function to retrieve historical transactions from the blockchain. * * @param args Optional parameters for pagination. * @param args.options Optional pagination options. * @param args.options.offset The number of the transaction to start with. * @param args.options.limit The number of results to return. * * @returns An array of on-chain transactions. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Fetch transactions with pagination * const transactions = await aptos.getTransactions({ * options: { * offset: 0, // Start from the first transaction * limit: 10, // Limit to 10 results * }, * }); * * console.log(transactions); * } * runExample().catch(console.error); * ``` * @group Transaction */ getTransactions(args?: { options?: PaginationArgs; }): Promise; /** * Queries on-chain transaction by version. This function will not return pending transactions. * * @param args - The arguments for querying the transaction. * @param args.ledgerVersion - Transaction version is an unsigned 64-bit number. * @returns On-chain transaction. Only on-chain transactions have versions, so this * function cannot be used to query pending transactions. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Fetching a transaction by its version * const transaction = await aptos.getTransactionByVersion({ ledgerVersion: 1 }); // replace 1 with a real version * console.log(transaction); * } * runExample().catch(console.error); * ``` * @group Transaction */ getTransactionByVersion(args: { ledgerVersion: AnyNumber; }): Promise; /** * Queries on-chain transactions by their transaction hash, returning both pending and committed transactions. * * @param args - The arguments for querying the transaction. * @param args.transactionHash - The transaction hash should be a hex-encoded bytes string with a 0x prefix. * @returns The transaction from the mempool (pending) or the on-chain (committed) transaction. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Fetch a transaction by its hash * const transaction = await aptos.getTransactionByHash({ transactionHash: "0x123" }); // replace with a real transaction hash * * console.log(transaction); * } * runExample().catch(console.error); * ``` * @group Transaction */ getTransactionByHash(args: { transactionHash: HexInput; }): Promise; /** * Defines if the specified transaction is currently in a pending state. * This function helps you determine the status of a transaction using its hash. * * @param args - The arguments for the function. * @param args.transactionHash - A hash of the transaction in hexadecimal format. * @returns `true` if the transaction is in a pending state and `false` otherwise. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Check if the transaction is pending using its hash * const isPendingTransaction = await aptos.isPendingTransaction({ transactionHash: "0x123" }); // replace with a real transaction hash * console.log("Is the transaction pending?", isPendingTransaction); * } * runExample().catch(console.error); * ``` * @group Transaction */ isPendingTransaction(args: { transactionHash: HexInput; }): Promise; /** * Waits for a transaction to move past the pending state and provides the transaction response. * There are 4 cases. * 1. Transaction is successfully processed and committed to the chain. * - The function will resolve with the transaction response from the API. * 2. Transaction is rejected for some reason, and is therefore not committed to the blockchain. * - The function will throw an AptosApiError with an HTTP status code indicating some problem with the request. * 3. Transaction is committed but execution failed, meaning no changes were * written to the blockchain state. * - If `checkSuccess` is true, the function will throw a FailedTransactionError * If `checkSuccess` is false, the function will resolve with the transaction response where the `success` field is false. * 4. Transaction does not move past the pending state within `args.options.timeoutSecs` seconds. * - The function will throw a WaitForTransactionError * * @param args.transactionHash - The hash of a transaction previously submitted to the blockchain. * @param args.options - Optional parameters for waiting behavior. * @param args.options.timeoutSecs - Timeout in seconds. Defaults to 20 seconds. * @param args.options.checkSuccess - A boolean which controls whether the function will error if the transaction failed. * Defaults to true. * @returns The transaction on-chain response. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Wait for a transaction to complete using its hash * const transactionHash = "0x123"; // replace with a real transaction hash * const transactionResponse = await aptos.waitForTransaction({ * transactionHash, * options: { * timeoutSecs: 30, // specify your own timeout if needed * checkSuccess: true, * }, * }); * * console.log(transactionResponse); * } * runExample().catch(console.error); * ``` * @group Transaction */ waitForTransaction(args: { transactionHash: HexInput; options?: WaitForTransactionOptions; }): Promise; /** * Estimates the gas unit price required to process a transaction on the Aptos blockchain in a timely manner. * This helps users to understand the cost associated with their transactions. * {@link https://api.mainnet.aptoslabs.com/v1/spec#/operations/estimate_gas_price} * * @returns An object containing the estimated gas price. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); // Specify your network * const aptos = new Aptos(config); * * async function runExample() { * // Getting the gas price estimation * const gasPriceEstimation = await aptos.getGasPriceEstimation(); * * console.log("Estimated Gas Price:", gasPriceEstimation); * } * runExample().catch(console.error); * ``` * @group Transaction */ getGasPriceEstimation(): Promise; /** * Returns a signing message for a transaction, allowing a user to sign it using their preferred method before submission to the network. * * @param args - The arguments for obtaining the signing message. * @param args.transaction - A raw transaction for signing elsewhere. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * const transaction = await aptos.transaction.build.simple({ * sender: "0x1", // replace with a real sender address * data: { * function: "0x1::aptos_account::transfer", * functionArguments: ["0x2", 100], // replace with a real destination address * }, * }); * * const message = await aptos.getSigningMessage({ transaction }); * console.log(message); * } * runExample().catch(console.error); * ``` * @group Transaction */ getSigningMessage(args: { transaction: AnyRawTransaction; }): Uint8Array; /** * Generates a transaction to publish a Move package to the blockchain. * This function helps you create a transaction that can be simulated or submitted to the chain for publishing a package. * * To get the `metadataBytes` and `byteCode`, can compile using Aptos CLI with command * `aptos move compile --save-metadata ...`, * * {@link https://aptos.dev/tutorials/your-first-dapp/#step-4-publish-a-move-module} * * @param args The arguments for publishing the package. * @param args.account The publisher account. * @param args.metadataBytes The package metadata bytes. * @param args.moduleBytecode An array of the bytecode of each module in the package in compiler output order. * @param args.options Optional settings for generating the transaction. * * @returns A SimpleTransaction that can be simulated or submitted to the chain. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Replace with a real account address * const account = "0x1"; * const metadataBytes = "0x..."; // replace with real metadata bytes * const byteCode = "0x..."; // replace with real module bytecode * * const transaction = await aptos.publishPackageTransaction({ * account, * metadataBytes, * moduleBytecode: [byteCode], * }); * * console.log(transaction); * } * runExample().catch(console.error); * ``` * @group Transaction */ publishPackageTransaction(args: { account: AccountAddressInput; metadataBytes: HexInput; moduleBytecode: Array; options?: InputGenerateTransactionOptions; }): Promise; /** * Rotates the authentication key for a given account. Once an account is rotated, only the new private key * or keyless signing scheme can be used to sign transactions for the account. * * @param args - The arguments for rotating the authentication key. * @param args.fromAccount - The account from which the authentication key will be rotated. * @param args.toAccount - (Optional) The target account to rotate to. Required if not using toNewPrivateKey. * @param args.toNewPrivateKey - (Optional) The new private key to rotate to. Required if not using toAccount. * * @remarks * This function supports three modes of rotation: * 1. Using a target Account object (toAccount) * 2. Using a new private key (toNewPrivateKey) * * For Ed25519 accounts, the function will use a challenge-based rotation that requires signatures from both the old and new keys. * For multi-key accounts like MultiEd25519Account, the function will use a challenge-based rotation that requires signatures from both keys. * For other account types, the function will use an unverified rotation that only requires the new public key. * * @returns SimpleTransaction that can be submitted to rotate the auth key * * @example * ```typescript * // Create and submit transaction to rotate the auth key * const transaction = await aptos.rotateAuthKey({ * fromAccount, * toAccount: toAccount, * }); * * // Sign and submit the transaction * const pendingTransaction = await aptos.signAndSubmitTransaction({ * signer: fromAccount, * transaction, * }); * ``` * @group Transaction */ rotateAuthKey(args: { fromAccount: Account; options?: InputGenerateTransactionOptions; } & ({ toAccount: Ed25519Account | MultiEd25519Account; } | { toNewPrivateKey: Ed25519PrivateKey; })): Promise; /** * Rotates the authentication key for a given account without verifying the new key. * * Accounts with their auth key rotated via this function will be derivable via the `getAccountsForPublicKey` and * `deriveOwnedAccountsFromSigner` functions however the public key will be unverified (no proof of ownership). Thus * includeUnverified must be set to true to derive the account until the public key is verified via signing a transaction. * * @param args - The arguments for rotating the authentication key. * @param args.fromAccount - The account from which the authentication key will be rotated. * @param args.toNewPublicKey - The new public key to rotate to. * * @returns A simple transaction object that can be submitted to the network. * * @example * ```typescript * // Create and submit transaction to rotate the auth key * const transaction = await aptos.rotateAuthKeyUnverified({ * fromAccount, * toNewPublicKey, * }); * * // Sign and submit the transaction * const pendingTransaction = await aptos.signAndSubmitTransaction({ * signer: fromAccount, * transaction, * }); * ``` * @group Transaction */ rotateAuthKeyUnverified(args: { fromAccount: Account; options?: InputGenerateTransactionOptions; toNewPublicKey: AccountPublicKey; }): Promise; /** * Sign a transaction that can later be submitted to the chain. * This function is essential for ensuring the authenticity of the transaction by using the provided account's signing capabilities. * * @param args - The arguments for signing the transaction. * @param args.signer - The account that will sign the transaction. * @param args.transaction - A raw transaction to sign. * * @returns AccountAuthenticator - The authenticator for the signed transaction. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * const sender = Account.generate(); // Generate a new account for signing * const transaction = await aptos.transaction.build.simple({ * sender: sender.accountAddress, * data: { * function: "0x1::aptos_account::transfer", * functionArguments: [ "0x1", 100 ], // replace with a real account address and amount * }, * }); * * const signedTransaction = await aptos.transaction.sign({ * signer: sender, * transaction, * }); // Sign the transaction * * console.log("Signed Transaction:", signedTransaction); * } * runExample().catch(console.error); * ``` * @group Transaction */ sign(args: { signer: Account; transaction: AnyRawTransaction; }): AccountAuthenticator; /** * Sign a transaction as a fee payer that can later be submitted to the chain. * This function ensures that the transaction is marked with the fee payer's address, allowing it to be processed correctly. * * @param args - The arguments for signing the transaction. * @param args.signer - The fee payer signer account. * @param args.transaction - A raw transaction to sign on. This transaction must include a `feePayerAddress` property. * * @returns AccountAuthenticator - The authenticator for the signed transaction. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * const sender = Account.generate(); // Generate a new account for the fee payer * const transaction = await aptos.transaction.build.simple({ * // All transactions on Aptos are implemented via smart contracts. * function: "0x1::aptos_account::transfer", * functionArguments: [sender.accountAddress, 100], * feePayerAddress: sender.accountAddress, // Set the fee payer address * }); * * const signedTransaction = await aptos.transaction.signAsFeePayer({ * signer: sender, * transaction, * }); * * console.log("Signed transaction as fee payer:", signedTransaction); * } * runExample().catch(console.error); * ``` * @group Transaction */ signAsFeePayer(args: { signer: Account; transaction: AnyRawTransaction; }): AccountAuthenticator; /** * @deprecated Prefer to use `aptos.transaction.batch.forSingleAccount()` * * Batch transactions for a single account by submitting multiple transaction payloads. * This function is useful for efficiently processing and submitting transactions that do not depend on each other, such as * batch funding or batch token minting. * * @param args - The arguments for batching transactions. * @param args.sender - The sender account to sign and submit the transactions. * @param args.data - An array of transaction payloads to be processed. * @param args.options - Optional. Transaction generation configurations (excluding accountSequenceNumber). * * @throws Error if any worker failure occurs during submission. * * @example * ```typescript * import { Aptos, AptosConfig, Network, Account } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * const sender = Account.generate(); // Generate a new account for sending transactions * * async function runExample() { * const transactions = [ * { }, // Build your first transaction payload * { }, // Build your second transaction payload * ]; * * // Batch transactions for the single account * await aptos.batchTransactionsForSingleAccount({ * sender, * data: transactions, * }); * * console.log("Batch transactions submitted successfully."); * } * runExample().catch(console.error); * ``` * @group Transaction */ batchTransactionsForSingleAccount(args: { sender: Account; data: InputGenerateTransactionPayloadData[]; options?: Omit; }): Promise; /** * Sign and submit a single signer transaction to the blockchain. * This function allows you to execute a transaction after signing it with the specified account. * * @param args The arguments for signing and submitting the transaction. * @param args.signer The signer account to sign the transaction. * @param args.transaction An instance of a RawTransaction, plus optional secondary/fee payer addresses. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * const sender = Account.generate(); // Generate a new account for sending the transaction * const transaction = await aptos.transaction.build.simple({ * sender: sender.accountAddress, * data: { * function: "0x1::aptos_account::transfer", * functionArguments: [ "0x1", 100 ], // replace with a real account address * }, * }); * * // Sign and submit the transaction * const pendingTransaction = await aptos.signAndSubmitTransaction({ * signer: sender, * transaction, * }); * * console.log(pendingTransaction); * } * runExample().catch(console.error); * ``` * @return PendingTransactionResponse * @group Transaction */ signAndSubmitTransaction(args: FeePayerOrFeePayerAuthenticatorOrNeither & { signer: Account; transaction: AnyRawTransaction; } & InputTransactionPluginData): Promise; /** * Sign and submit a single signer transaction as the fee payer to chain given an authenticator by the sender of the transaction. * * @param args.feePayer The fee payer account to sign the transaction * @param args.senderAuthenticator The AccountAuthenticator signed by the sender of the transaction * @param args.transaction An instance of a RawTransaction, plus optional secondary/fee payer addresses * * @example * const transaction = await aptos.transaction.build.simple({sender: alice.accountAddress, feePayer: true ...}) * const senderAuthenticator = alice.signTransactionWithAuthenticator(transaction) * const pendingTransaction = await aptos.signAndSubmitAsFeePayer({ * senderAuthenticator, * feePayer: bob, * transaction, * }) * * @return PendingTransactionResponse * @group Transaction */ signAndSubmitAsFeePayer(args: { feePayer: Account; senderAuthenticator: AccountAuthenticator; transaction: AnyRawTransaction; } & InputTransactionPluginData): Promise; } /** * A class to query all `Table` Aptos related queries. * @group Table */ declare class Table { readonly config: AptosConfig; /** * Initializes a new instance of the Aptos client with the specified configuration. * This allows you to interact with the Aptos blockchain using the provided settings. * * @param config - The configuration settings for the Aptos client. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * async function runExample() { * // Create a new Aptos client with testnet configuration * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * console.log("Aptos client initialized:", aptos); * } * runExample().catch(console.error); * ``` * @group Table */ constructor(config: AptosConfig); /** * Queries for a specific item in a table identified by the handle and the key for the item. * This function allows you to retrieve structured data from a table in the Aptos blockchain. * * @param args.handle A pointer to where that table is stored. * @param args.data Object that describes the table item, including key and value types. * @param args.data.key_type The Move type of the table key. * @param args.data.value_type The Move type of the table value. * @param args.data.key The value of the table key. * @param args.options.ledgerVersion The ledger version to query; if not provided, it will get the latest version. * * @returns Table item value rendered in JSON. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Retrieve a table item from the Aptos blockchain * const tableItem = await aptos.getTableItem({ * handle: "0x1b854694ae746cdbd8d44186ca4929b2b337df21d1c74633be19b2710552fdca", * data: { * key_type: "address", // Move type of table key * value_type: "u128", // Move type of table value * key: "0x619dc29a0aac8fa146714058e8dd6d2d0f3bdf5f6331907bf91f3acd81e6935" // Value of table key * }, * }); * * console.log(tableItem); * } * runExample().catch(console.error); * ``` * @group Table */ getTableItem(args: { handle: string; data: TableItemRequest; options?: LedgerVersionArg; }): Promise; /** * Queries for table items data with optional filtering and pagination. * This function allows you to retrieve specific data from a table based on provided criteria. * * @param args - The arguments for querying table items data. * @param args.minimumLedgerVersion - Optional minimum ledger version to wait for before querying. * @param args.options - Optional parameters for pagination and filtering. * @param args.options.where - Conditions to filter the response. * @param args.options.offset - The number of items to skip before starting to collect the result set. * @param args.options.limit - The maximum number of items to return. * @param args.options.orderBy - The criteria to order the results. * * Note: This query calls the indexer server. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Retrieve table items data with specific filtering options * const data = await aptos.getTableItemsData({ * minimumLedgerVersion: 1, // specify your own minimum ledger version if needed * options: { * where: { * table_handle: { _eq: "0x1b854694ae746cdbd8d44186ca4929b2b337df21d1c74633be19b2710552fdca" }, * transaction_version: { _eq: "0" } * }, * limit: 10, // specify your own limit if needed * }, * }); * * console.log(data); * } * runExample().catch(console.error); * ``` * * @returns GetTableItemsDataResponse * @group Table */ getTableItemsData(args: { minimumLedgerVersion?: AnyNumber; options?: PaginationArgs & WhereArg & OrderByArg; }): Promise; /** * Queries for the metadata of table items, allowing for filtering and pagination. * * @param args - The parameters for the query. * @param args.minimumLedgerVersion - Optional minimum ledger version to wait for before querying. * @param args.options - Optional parameters for pagination and filtering. * @param args.options.where - Conditions to filter the response. * @param args.options.offset - The offset for pagination. * @param args.options.limit - The maximum number of items to return. * @param args.options.orderBy - The order in which to return the items. * * Note that this query calls the indexer server. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Fetching table items metadata with a filter condition * const data = await aptos.getTableItemsMetadata({ * minimumLedgerVersion: 1, // specify your own minimum ledger version if needed * options: { * where: { handle: { _eq: "0x1b854694ae746cdbd8d44186ca4929b2b337df21d1c74633be19b2710552fdca" } }, * limit: 10, // specify your own limit if needed * }, * }); * * console.log(data); * } * runExample().catch(console.error); * ``` * * @returns GetTableItemsMetadataResponse * @group Table */ getTableItemsMetadata(args: { minimumLedgerVersion?: AnyNumber; options?: PaginationArgs & WhereArg & OrderByArg; }): Promise; } /** * Represents an ephemeral key pair used for signing transactions via the Keyless authentication scheme. * This key pair is temporary and includes an expiration time. * For more details on how this class is used, refer to the documentation: * https://aptos.dev/guides/keyless-accounts/#1-present-the-user-with-a-sign-in-with-idp-button-on-the-ui * @group Implementation * @category Account (On-Chain Model) */ declare class EphemeralKeyPair extends Serializable { static readonly BLINDER_LENGTH: number; /** * A byte array of length BLINDER_LENGTH used to obfuscate the public key from the IdP. * Used in calculating the nonce passed to the IdP and as a secret witness in proof generation. * @group Implementation * @category Account (On-Chain Model) */ readonly blinder: Uint8Array; /** * A timestamp in seconds indicating when the ephemeral key pair is expired. After expiry, a new * EphemeralKeyPair must be generated and a new JWT needs to be created. * @group Implementation * @category Account (On-Chain Model) */ readonly expiryDateSecs: number; /** * The value passed to the IdP when the user authenticates. It consists of a hash of the * ephemeral public key, expiry date, and blinder. * @group Implementation * @category Account (On-Chain Model) */ readonly nonce: string; /** * A private key used to sign transactions. This private key is not tied to any account on the chain as it * is ephemeral (not permanent) in nature. * @group Implementation * @category Account (On-Chain Model) */ private privateKey; /** * A public key used to verify transactions. This public key is not tied to any account on the chain as it * is ephemeral (not permanent) in nature. * @group Implementation * @category Account (On-Chain Model) */ private publicKey; /** * Whether the ephemeral key pair has been cleared from memory. * @private */ private cleared; /** * Creates an instance of the class with a specified private key, optional expiry date, and optional blinder. * This constructor initializes the public key, sets the expiry date to a default value if not provided, * generates a blinder if not supplied, and calculates the nonce based on the public key, expiry date, and blinder. * * @param args - The parameters for constructing the instance. * @param args.privateKey - The private key used for creating the instance. * @param args.expiryDateSecs - Optional expiry date in seconds from the current time. Defaults to two weeks from now. * @param args.blinder - Optional blinder value. If not provided, a new blinder will be generated. * @group Implementation * @category Account (On-Chain Model) */ constructor(args: { privateKey: PrivateKey; expiryDateSecs?: number; blinder?: HexInput; }); /** * Returns the public key of the key pair. * @return EphemeralPublicKey * @group Implementation * @category Account (On-Chain Model) */ getPublicKey(): EphemeralPublicKey; /** * Checks if the current time has surpassed the expiry date of the key pair. * @return boolean - Returns true if the key pair is expired, otherwise false. * @group Implementation * @category Account (On-Chain Model) */ isExpired(): boolean; /** * Clears the ephemeral private key from memory by overwriting it with random bytes. * After calling this method, the ephemeral key pair can no longer be used for signing. * * Note: Due to JavaScript's memory management, this cannot guarantee complete removal of * sensitive data from memory, but it significantly reduces the window of exposure. * * @group Implementation * @category Account (On-Chain Model) */ clear(): void; /** * Returns whether the ephemeral key pair has been cleared from memory. * * @returns true if the key pair has been cleared, false otherwise * @group Implementation * @category Account (On-Chain Model) */ isCleared(): boolean; /** * Serializes the object's properties into a format suitable for transmission or storage. * This function is essential for preparing the object data for serialization processes. * * @param serializer - The serializer instance used to serialize the object's properties. * @group Implementation * @category Account (On-Chain Model) */ serialize(serializer: Serializer): void; /** * Deserializes an ephemeral key pair from the provided deserializer. * This function helps in reconstructing an ephemeral key pair, which is essential for cryptographic operations. * * @param deserializer - The deserializer instance used to read the serialized data. * @group Implementation * @category Account (On-Chain Model) */ static deserialize(deserializer: Deserializer): EphemeralKeyPair; /** * Deserialize a byte array into an EphemeralKeyPair object. * This function allows you to reconstruct an EphemeralKeyPair from its serialized byte representation. * * @param bytes - The byte array representing the serialized EphemeralKeyPair. * @group Implementation * @category Account (On-Chain Model) */ static fromBytes(bytes: Uint8Array): EphemeralKeyPair; /** * Generates a new ephemeral key pair with an optional expiry date. * This function allows you to create a temporary key pair for secure operations. * * @param args - Optional parameters for key pair generation. * @param args.scheme - The type of key pair to use for the EphemeralKeyPair. Only Ed25519 is supported for now. * @param args.expiryDateSecs - The date of expiry for the key pair in seconds. * @returns An instance of EphemeralKeyPair containing the generated private key and expiry date. * @group Implementation * @category Account (On-Chain Model) */ static generate(args?: { scheme?: EphemeralPublicKeyVariant; expiryDateSecs?: number; }): EphemeralKeyPair; /** * Sign the given data using the private key, returning an ephemeral signature. * This function is essential for creating a secure signature that can be used for authentication or verification purposes. * * @param data - The data to be signed, provided in HexInput format. * @returns EphemeralSignature - The resulting ephemeral signature. * @throws Error - Throws an error if the EphemeralKeyPair has expired or been cleared from memory. * @group Implementation * @category Account (On-Chain Model) */ sign(data: HexInput): EphemeralSignature; } /** * An interface which defines if an Account utilizes SingleKey signing. * * Such an account will use the AnyPublicKey enum to represent its public key when deriving the auth key. */ interface SingleKeySigner extends Account { getAnyPublicKey(): AnyPublicKey; } declare function isSingleKeySigner(obj: unknown): obj is SingleKeySigner; type SingleKeySignerOrLegacyEd25519Account = SingleKeySigner | Ed25519Account; /** * Arguments required to create a single key signer. * * @param privateKey - The private key used for signing. * @param address - Optional account address associated with the signer. * @group Implementation * @category Account (On-Chain Model) */ interface SingleKeySignerConstructorArgs { privateKey: PrivateKeyInput; address?: AccountAddressInput; } /** * Arguments for generating a single key signer. * * @param scheme - The signing scheme to be used. * @group Implementation * @category Account (On-Chain Model) */ interface SingleKeySignerGenerateArgs { scheme?: SigningSchemeInput; } /** * The arguments for generating a single key signer from a specified derivation path. * @group Implementation * @category Account (On-Chain Model) */ type SingleKeySignerFromDerivationPathArgs = SingleKeySignerGenerateArgs & { path: string; mnemonic: string; }; /** * Arguments required to verify a single key signature for a given message. * * @param message - The message to be verified, represented in hexadecimal format. * @param signature - The signature that corresponds to the message. * @group Implementation * @category Account (On-Chain Model) */ interface VerifySingleKeySignatureArgs { message: HexInput; signature: AnySignature; } /** * Signer implementation for the SingleKey authentication scheme. * This class extends a SingleKeyAccount by adding signing capabilities through a valid private key. * Currently, the only supported signature schemes are Ed25519 and Secp256k1. * * Note: Generating a signer instance does not create the account on-chain. * @group Implementation * @category Account (On-Chain Model) */ declare class SingleKeyAccount implements Account, SingleKeySigner { /** * Private key associated with the account * @group Implementation * @category Account (On-Chain Model) */ readonly privateKey: PrivateKeyInput; readonly publicKey: AnyPublicKey; readonly accountAddress: AccountAddress; readonly signingScheme = SigningScheme.SingleKey; /** * Creates an instance of the SingleKeySigner using the provided private key and address. * This allows for signing transactions and messages with the specified private key. * * @param args - The constructor arguments for initializing the SingleKeySigner. * @param args.privateKey - The private key used for signing. * @param args.address - The optional account address; if not provided, it will derive the address from the public key. * @group Implementation * @category Account (On-Chain Model) */ constructor(args: SingleKeySignerConstructorArgs); getAnyPublicKey(): AnyPublicKey; /** * Derives an account from a randomly generated private key based on the specified signing scheme. * The default generation scheme is Ed25519, but it can also support Secp256k1Ecdsa. * * @param args - The arguments for generating the account. * @param args.scheme - The signing scheme to use for generating the private key. Defaults to SigningSchemeInput.Ed25519. * @returns An account with the generated private key based on the specified signing scheme. * @throws Error if an unsupported signature scheme is provided. * @group Implementation * @category Account (On-Chain Model) */ static generate(args?: SingleKeySignerGenerateArgs): SingleKeyAccount; /** * Derives an account using a specified BIP44 path and mnemonic seed phrase, defaulting to the Ed25519 signature scheme. * This function allows you to create a single key account based on the provided derivation path and mnemonic. * * @param args - The arguments for deriving the account. * @param args.scheme - The signature scheme to derive the private key with. Defaults to Ed25519. * @param args.path - The BIP44 derive hardened path (e.g. m/44'/637'/0'/0'/0') for Ed25519, or non-hardened path * (e.g. m/44'/637'/0'/0/0) for secp256k1. * Detailed description: {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki} * @param args.mnemonic - The mnemonic seed phrase of the account. * @group Implementation * @category Account (On-Chain Model) */ static fromDerivationPath(args: SingleKeySignerFromDerivationPathArgs): SingleKeyAccount; /** * Verify the given message and signature with the public key. * * @param args - The arguments for verifying the signature. * @param args.message - The raw message data in HexInput format. * @param args.signature - The signed message signature. * @returns A boolean indicating whether the signature is valid. * @group Implementation * @category Account (On-Chain Model) */ verifySignature(args: VerifySingleKeySignatureArgs): boolean; /** * Verify the given message and signature with the account's public key. * * This function checks if the provided signature is valid for the given message using the account's public key. * * @param args - The arguments for verifying the signature. * @param args.message - The raw message data in HexInput format. * @param args.signature - The signed message signature. * @param args.options.throwErrorWithReason - Whether to throw an error with the reason for the verification failure. * @returns A boolean indicating whether the signature is valid for the message. * @group Implementation * @category Account (On-Chain Model) */ verifySignatureAsync(args: { aptosConfig: AptosConfig; message: HexInput; signature: Signature; options?: { throwErrorWithReason?: boolean; }; }): Promise; /** * Sign a message using the account's private key and return an AccountAuthenticator containing the signature along with the * account's public key. * @param message - The signing message, represented as binary input in hexadecimal format. * @returns An instance of AccountAuthenticatorSingleKey containing the signature and the public key. * @group Implementation * @category Account (On-Chain Model) */ signWithAuthenticator(message: HexInput): AccountAuthenticatorSingleKey; /** * Sign a transaction using the account's private key. * This function returns an AccountAuthenticator that contains the signature of the transaction along with the account's public key. * @param transaction - The raw transaction to be signed. * @returns An AccountAuthenticatorSingleKey containing the signature of the transaction and the account's public key. * @group Implementation * @category Account (On-Chain Model) */ signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorSingleKey; /** * Sign the given message using the account's private key. * @param message - The message to be signed in HexInput format. * @returns A new AnySignature containing the signature of the message. * @group Implementation * @category Account (On-Chain Model) */ sign(message: HexInput): AnySignature; /** * Sign the given transaction using the account's private key. * This function generates a signing message for the transaction and then signs it. * * @param transaction - The transaction to be signed. * @returns Signature - The resulting signature for the signed transaction. * @group Implementation * @category Account (On-Chain Model) */ signTransaction(transaction: AnyRawTransaction): AnySignature; static fromEd25519Account(account: Ed25519Account): SingleKeyAccount; } /** * Arguments for creating an `Ed25519Account` from an `Ed25519PrivateKey`. * To use the SingleKey authentication scheme, set `legacy` to false. * * @param privateKey - The private key used to create the account. * @param address - Optional address for the account. * @param legacy - Indicates whether to use legacy authentication (default is true). * @group Implementation * @category Account (On-Chain Model) */ interface CreateEd25519AccountFromPrivateKeyArgs { privateKey: Ed25519PrivateKey; address?: AccountAddressInput; legacy?: true; } /** * Arguments for creating a `SingleKeyAccount` using an `Ed25519PrivateKey`. * The `legacy` property must be set to false to utilize the `SingleKey` authentication scheme. * * @param privateKey - The Ed25519 private key used for account creation. * @param address - Optional account address input. * @param legacy - Must be false to enable the `SingleKey` authentication scheme. * @group Implementation * @category Account (On-Chain Model) */ interface CreateEd25519SingleKeyAccountFromPrivateKeyArgs { privateKey: Ed25519PrivateKey; address?: AccountAddressInput; legacy: false; } /** * Arguments for creating a `SingleKeyAccount` from a supported private key, excluding `Ed25519PrivateKey`. * The `legacy` argument is always false and cannot be set to true. * * @param privateKey - The private key used to create the account. * @param address - Optional address input for the account. * @param legacy - Always false; cannot be explicitly set to true. * @group Implementation * @category Account (On-Chain Model) */ interface CreateSingleKeyAccountFromPrivateKeyArgs { privateKey: PrivateKeyInput; address?: AccountAddressInput; legacy?: false; } /** * Arguments for creating an `Account` from a private key when the key type is unknown at compile time. * * @param privateKey - The private key used to create the account. * @param address - Optional address for the account. * @param legacy - Optional flag indicating if the account is a legacy account. * @group Implementation * @category Account (On-Chain Model) */ interface CreateAccountFromPrivateKeyArgs { privateKey: PrivateKeyInput; address?: AccountAddressInput; legacy?: boolean; } /** * Arguments for generating an Ed25519 account, specifying the signing scheme and legacy option. * * @param scheme - The signing scheme to use for the account. * @param legacy - Indicates if the account should be created in legacy mode. * @group Implementation * @category Account (On-Chain Model) */ interface GenerateEd25519AccountArgs { scheme?: SigningSchemeInput.Ed25519; legacy?: true; } /** * Arguments for generating a `SingleKeyAccount` with an underlying `Ed25519PrivateKey`. * The `legacy` argument must be set to false to ensure an `Ed25519SingleKeyAccount` is returned. * * @param scheme - Optional signing scheme input for the account. * @param legacy - Indicates whether to use legacy account generation. * @group Implementation * @category Account (On-Chain Model) */ interface GenerateEd25519SingleKeyAccountArgs { scheme?: SigningSchemeInput.Ed25519; legacy: false; } /** * Arguments for generating a `SingleKeyAccount` using a supported private key other than `Ed25519PrivateKey`. * The `legacy` argument is optional and defaults to false, and cannot be set to true. * * @param scheme - The signing scheme to use for the account. * @param legacy - Indicates whether to use legacy account generation (defaults to false). * @group Implementation * @category Account (On-Chain Model) */ interface GenerateSingleKeyAccountArgs { scheme: Exclude; legacy?: false; } /** * Arguments for generating an opaque `Account` when the input signature scheme is unknown at compile time. * * @param scheme - The signing scheme to use for account generation. * @param legacy - Indicates whether to use legacy account generation methods. * @group Implementation * @category Account (On-Chain Model) */ interface GenerateAccountArgs { scheme?: SigningSchemeInput; legacy?: boolean; } /** * Arguments for deriving a private key using a mnemonic phrase and a specified BIP44 path. * * @param path - The BIP44 derivation path for the key. * @param mnemonic - The mnemonic phrase used for key generation. * @group Implementation * @category Account (On-Chain Model) */ interface PrivateKeyFromDerivationPathArgs { path: string; mnemonic: string; } /** * Abstract class representing a generic Aptos account. * * This class serves as a single entry point for account generation, allowing accounts to be created * either through `Account.generate()` or `Account.fromDerivationPath`. Although it is defined as an * abstract class, it should be treated as an interface and enforced using the `implements` keyword. * * Note: Generating an account instance does not create the account on-chain. * @group Implementation * @category Account (On-Chain Model) */ declare abstract class Account { /** * Public key associated with the account * @group Implementation * @category Account (On-Chain Model) */ abstract readonly publicKey: AccountPublicKey; /** * Account address associated with the account * @group Implementation * @category Account (On-Chain Model) */ abstract readonly accountAddress: AccountAddress; /** * Signing scheme used to sign transactions * @group Implementation * @category Account (On-Chain Model) */ abstract signingScheme: SigningScheme; /** * Generates a new account based on the specified signing scheme and legacy option. * This function allows you to create an account with either the Ed25519 signing scheme or a different scheme as specified. * * @param args - The arguments for generating the account. * @param args.scheme - The signing scheme to use for account generation. Defaults to Ed25519. * @param args.legacy - Indicates whether to use the legacy account generation method. Defaults to true. * @group Implementation * @category Account (On-Chain Model) */ static generate(args?: GenerateEd25519AccountArgs): Ed25519Account; static generate(args: GenerateEd25519SingleKeyAccountArgs): SingleKeyAccount; static generate(args: GenerateSingleKeyAccountArgs): SingleKeyAccount; static generate(args: GenerateAccountArgs): Account; /** * Creates an account from a given private key and address. * This function allows you to instantiate an account based on the provided private key, * and it can differentiate between legacy and non-legacy accounts. * * @param args - The arguments for creating the account. * @param args.privateKey - The private key used to create the account. * @param args.address - The address associated with the account. * @param args.legacy - A boolean indicating whether to create a legacy account (default is true). * @returns An instance of either Ed25519Account or SingleKeyAccount based on the provided private key. * @group Implementation * @category Account (On-Chain Model) */ static fromPrivateKey(args: CreateEd25519AccountFromPrivateKeyArgs): Ed25519Account; static fromPrivateKey(args: CreateSingleKeyAccountFromPrivateKeyArgs): SingleKeyAccount; static fromPrivateKey(args: CreateAccountFromPrivateKeyArgs): SingleKeyAccount; /** * @deprecated use `fromPrivateKey` instead. * Instantiates an account using a private key and a specified account address. This is primarily used to instantiate an * `Account` that has had its authentication key rotated. * * @param args - The arguments required to create an account from a private key. * @param args.privateKey - The underlying private key for the account. * @param args.address - The account address the `Account` will sign for. * @param args.legacy - Optional. If set to false, the keypair generated is a Unified keypair. Defaults to generating a Legacy * Ed25519 keypair. * * @returns Account * @group Implementation * @category Account (On-Chain Model) */ static fromPrivateKeyAndAddress(args: CreateAccountFromPrivateKeyArgs): SingleKeyAccount; /** * Generates an account from a specified derivation path and mnemonic. * This function allows you to create an account using different signing schemes based on the provided arguments. * * @param args - The arguments for generating the account. * @param args.scheme - The signing scheme to use for account generation. Defaults to Ed25519. * @param args.mnemonic - The mnemonic phrase used to derive the account. * @param args.path - The derivation path used to generate the account. * @param args.legacy - A boolean indicating whether to use the legacy account generation method. Defaults to true. * @group Implementation * @category Account (On-Chain Model) */ static fromDerivationPath(args: GenerateEd25519AccountArgs & PrivateKeyFromDerivationPathArgs): Ed25519Account; static fromDerivationPath(args: GenerateEd25519SingleKeyAccountArgs & PrivateKeyFromDerivationPathArgs): SingleKeyAccount; static fromDerivationPath(args: GenerateSingleKeyAccountArgs & PrivateKeyFromDerivationPathArgs): SingleKeyAccount; static fromDerivationPath(args: GenerateAccountArgs & PrivateKeyFromDerivationPathArgs): Account; /** * Retrieve the authentication key for the associated account using the provided public key. * This key enables account owners to rotate their private key(s) associated with the account without changing the address that * hosts their account. * See here for more info: {@link https://aptos.dev/concepts/accounts#single-signer-authentication} * * @param args - The arguments for retrieving the authentication key. * @param args.publicKey - The public key of the account. * @returns The authentication key for the associated account. * @group Implementation * @category Account (On-Chain Model) */ static authKey(args: { publicKey: AccountPublicKey; }): AuthenticationKey; /** * Sign a message using the available signing capabilities. * @param message the signing message, as binary input * @return the AccountAuthenticator containing the signature, together with the account's public key * @group Implementation * @category Account (On-Chain Model) */ abstract signWithAuthenticator(message: HexInput): AccountAuthenticator; /** * Sign a transaction using the available signing capabilities. * @param transaction the raw transaction * @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key * @group Implementation * @category Account (On-Chain Model) */ abstract signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticator; /** * Sign the given message using the available signing capabilities. * @param message in HexInput format * @returns Signature * @group Implementation * @category Account (On-Chain Model) */ abstract sign(message: HexInput): Signature; /** * Sign the given transaction using the available signing capabilities. * @param transaction the transaction to be signed * @returns Signature * @group Implementation * @category Account (On-Chain Model) */ abstract signTransaction(transaction: AnyRawTransaction): Signature; /** * Verify the given message and signature with the public key. * This function helps ensure the integrity and authenticity of a message by validating its signature. * * @param args - The arguments for verifying the signature. * @param args.message - The raw message data in HexInput format. * @param args.signature - The signed message signature. * @returns A boolean indicating whether the signature is valid. * @group Implementation * @category Account (On-Chain Model) */ verifySignature(args: VerifySignatureArgs): boolean; /** * Verify the given message and signature with the public key. It fetches any on chain state if needed for verification. * * @param args - The arguments for verifying the signature. * @param args.aptosConfig - The configuration object for connecting to the Aptos network * @param args.message - Raw message data in HexInput format. * @param args.signature - Signed message signature. * @returns A boolean indicating whether the signature is valid. * @group Implementation * @category Account (On-Chain Model) */ verifySignatureAsync(args: { aptosConfig: AptosConfig; message: HexInput; signature: Signature; }): Promise; } /** * An interface which defines if an Account utilizes Keyless signing. */ interface KeylessSigner extends Account { checkKeylessAccountValidity(aptosConfig: AptosConfig): Promise; } declare function isKeylessSigner(obj: any): obj is KeylessSigner; /** * Account implementation for the Keyless authentication scheme. This abstract class is used for standard Keyless Accounts * and Federated Keyless Accounts. * @group Implementation * @category Account (On-Chain Model) */ declare abstract class AbstractKeylessAccount extends Serializable implements KeylessSigner, SingleKeySigner { static readonly PEPPER_LENGTH: number; /** * The KeylessPublicKey associated with the account * @group Implementation * @category Account (On-Chain Model) */ readonly publicKey: KeylessPublicKey | FederatedKeylessPublicKey; /** * The EphemeralKeyPair used to generate sign. * @group Implementation * @category Account (On-Chain Model) */ readonly ephemeralKeyPair: EphemeralKeyPair; /** * The claim on the JWT to identify a user. This is typically 'sub' or 'email'. * @group Implementation * @category Account (On-Chain Model) */ readonly uidKey: string; /** * The value of the uidKey claim on the JWT. This intended to be a stable user identifier. * @group Implementation * @category Account (On-Chain Model) */ readonly uidVal: string; /** * The value of the 'aud' claim on the JWT, also known as client ID. This is the identifier for the dApp's * OIDC registration with the identity provider. * @group Implementation * @category Account (On-Chain Model) */ readonly aud: string; /** * A value contains 31 bytes of entropy that preserves privacy of the account. Typically fetched from a pepper provider. * @group Implementation * @category Account (On-Chain Model) */ readonly pepper: Uint8Array; /** * Account address associated with the account * @group Implementation * @category Account (On-Chain Model) */ readonly accountAddress: AccountAddress; /** * The zero knowledge signature (if ready) which contains the proof used to validate the EphemeralKeyPair. * @group Implementation * @category Account (On-Chain Model) */ proof: ZeroKnowledgeSig | undefined; /** * The proof of the EphemeralKeyPair or a promise that provides the proof. This is used to allow for awaiting on * fetching the proof. * @group Implementation * @category Account (On-Chain Model) */ readonly proofOrPromise: ZeroKnowledgeSig | Promise; /** * Signing scheme used to sign transactions * @group Implementation * @category Account (On-Chain Model) */ readonly signingScheme: SigningScheme; /** * The JWT token used to derive the account * @group Implementation * @category Account (On-Chain Model) */ readonly jwt: string; /** * The hash of the verification key used to verify the proof. This is optional and can be used to check verifying key * rotations which may invalidate the proof. */ readonly verificationKeyHash?: Uint8Array; /** * An event emitter used to assist in handling asynchronous proof fetching. * @group Implementation * @category Account (On-Chain Model) */ private readonly emitter; /** * Use the static generator `create(...)` instead. * Creates an instance of the KeylessAccount with an optional proof. * * @param args - The parameters for creating a KeylessAccount. * @param args.address - Optional account address associated with the KeylessAccount. * @param args.publicKey - A KeylessPublicKey or FederatedKeylessPublicKey. * @param args.ephemeralKeyPair - The ephemeral key pair used in the account creation. * @param args.iss - A JWT issuer. * @param args.uidKey - The claim on the JWT to identify a user. This is typically 'sub' or 'email'. * @param args.uidVal - The unique id for this user, intended to be a stable user identifier. * @param args.aud - The value of the 'aud' claim on the JWT, also known as client ID. This is the identifier for the dApp's * OIDC registration with the identity provider. * @param args.pepper - A hexadecimal input used for additional security. * @param args.proof - A Zero Knowledge Signature or a promise that resolves to one. * @param args.proofFetchCallback - Optional callback function for fetching proof. * @param args.jwt - A JSON Web Token used for authentication. * @param args.verificationKeyHash Optional 32-byte verification key hash as hex input used to check proof validity. */ protected constructor(args: { address?: AccountAddress; publicKey: KeylessPublicKey | FederatedKeylessPublicKey; ephemeralKeyPair: EphemeralKeyPair; iss: string; uidKey: string; uidVal: string; aud: string; pepper: HexInput; proof: ZeroKnowledgeSig | Promise; proofFetchCallback?: ProofFetchCallback; jwt: string; verificationKeyHash?: HexInput; }); getAnyPublicKey(): AnyPublicKey; /** * This initializes the asynchronous proof fetch * @return Emits whether the proof succeeds or fails, but has no return. * @group Implementation * @category Account (On-Chain Model) */ init(promise: Promise): Promise; /** * Serializes the jwt data into a format suitable for transmission or storage. * This function ensures that both the jwt data and the proof are properly serialized. * * @param serializer - The serializer instance used to convert the jwt data into bytes. */ serialize(serializer: Serializer): void; static partialDeserialize(deserializer: Deserializer): { address: AccountAddress; jwt: string; uidKey: string; pepper: Uint8Array; ephemeralKeyPair: EphemeralKeyPair; proof: ZeroKnowledgeSig; verificationKeyHash?: Uint8Array; }; /** * Checks if the proof is expired. If so the account must be re-derived with a new EphemeralKeyPair * and JWT token. * @return boolean * @group Implementation * @category Account (On-Chain Model) */ isExpired(): boolean; /** * Sign a message using Keyless. * @param message the message to sign, as binary input * @return the AccountAuthenticator containing the signature, together with the account's public key * @group Implementation * @category Account (On-Chain Model) */ signWithAuthenticator(message: HexInput): AccountAuthenticatorSingleKey; /** * Sign a transaction using Keyless. * @param transaction the raw transaction * @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key * @group Implementation * @category Account (On-Chain Model) */ signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorSingleKey; /** * Waits for asynchronous proof fetching to finish. * @return * @group Implementation * @category Account (On-Chain Model) */ waitForProofFetch(): Promise; /** * Validates that the Keyless Account can be used to sign transactions. * @return */ checkKeylessAccountValidity(aptosConfig: AptosConfig): Promise; /** * Sign the given message using Keyless. * @param message in HexInput format * @returns Signature * @group Implementation * @category Account (On-Chain Model) */ sign(message: HexInput): KeylessSignature; /** * Sign the given transaction with Keyless. * Signs the transaction and proof to guard against proof malleability. * @param transaction the transaction to be signed * @returns KeylessSignature * @group Implementation * @category Account (On-Chain Model) */ signTransaction(transaction: AnyRawTransaction): KeylessSignature; getSigningMessage(transaction: AnyRawTransaction): Uint8Array; /** * Note - This function is currently incomplete and should only be used to verify ownership of the KeylessAccount * * Verifies a signature given the message. * * @param args.message the message that was signed. * @param args.signature the KeylessSignature to verify * @returns boolean * @group Implementation * @category Account (On-Chain Model) */ verifySignature(args: { message: HexInput; signature: KeylessSignature; jwk: MoveJWK; keylessConfig: KeylessConfiguration; }): boolean; verifySignatureAsync(args: { aptosConfig: AptosConfig; message: HexInput; signature: KeylessSignature; options?: { throwErrorWithReason?: boolean; }; }): Promise; /** * Fetches the JWK from the issuer's well-known JWKS endpoint. * * @param args.publicKey The keyless public key to query * @param args.kid The kid of the JWK to fetch * @returns A JWK matching the `kid` in the JWT header. * @throws {KeylessError} If the JWK cannot be fetched */ static fetchJWK(args: { aptosConfig: AptosConfig; publicKey: KeylessPublicKey | FederatedKeylessPublicKey; kid: string; }): Promise; } /** * A container class to hold a transaction and a proof. It implements CryptoHashable which is used to create * the signing message for Keyless transactions. We sign over the proof to ensure non-malleability. * @group Implementation * @category Account (On-Chain Model) */ declare class TransactionAndProof extends Serializable { /** * The transaction to sign. * @group Implementation * @category Account (On-Chain Model) */ transaction: AnyRawTransactionInstance; /** * The zero knowledge proof used in signing the transaction. * @group Implementation * @category Account (On-Chain Model) */ proof?: ZkProof; /** * The domain separator prefix used when hashing. * @group Implementation * @category Account (On-Chain Model) */ readonly domainSeparator = "APTOS::TransactionAndProof"; constructor(transaction: AnyRawTransactionInstance, proof?: ZkProof); /** * Serializes the transaction data into a format suitable for transmission or storage. * This function ensures that both the transaction bytes and the proof are properly serialized. * * @param serializer - The serializer instance used to convert the transaction data into bytes. */ serialize(serializer: Serializer): void; /** * Hashes the bcs serialized from of the class. This is the typescript corollary to the BCSCryptoHash macro in aptos-core. * * @returns Uint8Array * @group Implementation * @category Account (On-Chain Model) */ hash(): Uint8Array; } /** * @group Implementation * @category Account (On-Chain Model) */ type ProofFetchSuccess = { status: "Success"; }; /** * @group Implementation * @category Account (On-Chain Model) */ type ProofFetchFailure = { status: "Failed"; error: string; }; /** * @group Implementation * @category Account (On-Chain Model) */ type ProofFetchStatus = ProofFetchSuccess | ProofFetchFailure; /** * @group Implementation * @category Account (On-Chain Model) */ type ProofFetchCallback = (status: ProofFetchStatus) => Promise; /** * @group Implementation * @category Account (On-Chain Model) */ interface ProofFetchEvents { proofFetchFinish: (status: ProofFetchStatus) => void; } /** * Account implementation for the FederatedKeyless authentication scheme. * * Used to represent a FederatedKeyless based account and sign transactions with it. * * Use `FederatedKeylessAccount.create()` to instantiate a KeylessAccount with a JSON Web Token (JWT), proof, EphemeralKeyPair and the * address the JSON Web Key Set (JWKS) are installed that will be used to verify the JWT. * * When the proof expires or the JWT becomes invalid, the KeylessAccount must be instantiated again with a new JWT, * EphemeralKeyPair, and corresponding proof. * @group Implementation * @category Account (On-Chain Model) */ declare class FederatedKeylessAccount extends AbstractKeylessAccount { /** * The FederatedKeylessPublicKey associated with the account * @group Implementation * @category Account (On-Chain Model) */ readonly publicKey: FederatedKeylessPublicKey; readonly audless: boolean; /** * Use the static generator `FederatedKeylessAccount.create(...)` instead. * Creates a KeylessAccount instance using the provided parameters. * This function allows you to set up a KeylessAccount with specific attributes such as address, proof, and JWT. * * @param args - The parameters for creating a KeylessAccount. * @param args.address - Optional account address associated with the KeylessAccount. * @param args.proof - A Zero Knowledge Signature or a promise that resolves to one. * @param args.jwt - A JSON Web Token used for authentication. * @param args.ephemeralKeyPair - The ephemeral key pair used in the account creation. * @param args.jwkAddress - The address which stores the JSON Web Key Set (JWKS) used to verify the JWT. * @param args.uidKey - Optional key for user identification, defaults to "sub". * @param args.proofFetchCallback - Optional callback function for fetching proof. */ constructor(args: { address?: AccountAddress; ephemeralKeyPair: EphemeralKeyPair; iss: string; uidKey: string; uidVal: string; aud: string; pepper: HexInput; jwkAddress: AccountAddress; proof: ZeroKnowledgeSig | Promise; proofFetchCallback?: ProofFetchCallback; jwt: string; verificationKeyHash?: HexInput; audless?: boolean; }); /** * Serializes the transaction data into a format suitable for transmission or storage. * This function ensures that both the transaction bytes and the proof are properly serialized. * * @param serializer - The serializer instance used to convert the transaction data into bytes. */ serialize(serializer: Serializer): void; /** * Deserializes the provided deserializer to create a KeylessAccount instance. * This function extracts necessary components such as the JWT, UID key, pepper, ephemeral key pair, and proof from the deserializer. * * @param deserializer - The deserializer instance used to retrieve the serialized data. * @returns A KeylessAccount instance created from the deserialized data. */ static deserialize(deserializer: Deserializer): FederatedKeylessAccount; /** * Deserialize bytes using this account's information. * * @param bytes The bytes being interpreted. * @returns */ static fromBytes(bytes: HexInput): FederatedKeylessAccount; /** * Creates a KeylessAccount instance using the provided parameters. * This function allows you to set up a KeylessAccount with specific attributes such as address, proof, and JWT. * This is used instead of the KeylessAccount constructor. * * @param args - The parameters for creating a KeylessAccount. * @param args.address - Optional account address associated with the KeylessAccount. * @param args.proof - A Zero Knowledge Signature or a promise that resolves to one. * @param args.jwt - A JSON Web Token used for authentication. * @param args.ephemeralKeyPair - The ephemeral key pair used in the account creation. * @param args.jwkAddress - The address which stores the JSON Web Key Set (JWKS) used to verify the JWT. * @param args.uidKey - Optional key for user identification, defaults to "sub". * @param args.proofFetchCallback - Optional callback function for fetching proof. */ static create(args: { address?: AccountAddress; proof: ZeroKnowledgeSig | Promise; jwt: string; ephemeralKeyPair: EphemeralKeyPair; pepper: HexInput; jwkAddress: AccountAddressInput; uidKey?: string; proofFetchCallback?: ProofFetchCallback; verificationKey?: Groth16VerificationKey; verificationKeyHash?: Uint8Array; }): FederatedKeylessAccount; } /** * A class to query all `Keyless` related queries on Aptos. * * More documentation on how to integrate Keyless Accounts see the below * [Aptos Keyless Integration Guide](https://aptos.dev/guides/keyless-accounts/#aptos-keyless-integration-guide). * @group Keyless */ declare class Keyless { readonly config: AptosConfig; /** * Initializes a new instance of the Aptos class with the provided configuration. * This allows you to interact with the Aptos blockchain using the specified network settings. * * @param config - The configuration settings for connecting to the Aptos network. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * async function runExample() { * // Create a new configuration for the Aptos client * const config = new AptosConfig({ network: Network.TESTNET }); // Specify your desired network * * // Initialize the Aptos client with the configuration * const aptos = new Aptos(config); * * console.log("Aptos client initialized:", aptos); * } * runExample().catch(console.error); * ``` * @group Keyless */ constructor(config: AptosConfig); /** * Fetches the pepper from the Aptos pepper service API. * * @param args - The arguments for fetching the pepper. * @param args.jwt - JWT token. * @param args.ephemeralKeyPair - The EphemeralKeyPair used to generate the nonce in the JWT token. * @param args.derivationPath - A derivation path used for creating multiple accounts per user via the BIP-44 standard. Defaults * to "m/44'/637'/0'/0'/0". * @returns The pepper which is a Uint8Array of length 31. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * const ephemeralKeyPair = new EphemeralKeyPair(); // create a new ephemeral key pair * const jwt = "your_jwt_token"; // replace with a real JWT token * * // Fetching the pepper using the provided JWT and ephemeral key pair * const pepper = await aptos.getPepper({ * jwt, * ephemeralKeyPair, * // derivationPath: "m/44'/637'/0'/0'/0" // specify your own if needed * }); * * console.log("Fetched pepper:", pepper); * } * runExample().catch(console.error); * ``` * @group Keyless */ getPepper(args: { jwt: string; ephemeralKeyPair: EphemeralKeyPair; derivationPath?: string; }): Promise; /** * Fetches a proof from the Aptos prover service API. * * @param args - The arguments for fetching the proof. * @param args.jwt - JWT token. * @param args.ephemeralKeyPair - The EphemeralKeyPair used to generate the nonce in the JWT token. * @param args.pepper - The pepper used for the account. If not provided, it will be fetched from the Aptos pepper service. * @param args.uidKey - A key in the JWT token to use to set the uidVal in the IdCommitment. * * @returns The proof which is represented by a ZeroKnowledgeSig. * * @example * ```typescript * import { Aptos, AptosConfig, Network, EphemeralKeyPair, getPepper } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * const jwt = "your_jwt_token"; // replace with a real JWT token * const ephemeralKeyPair = new EphemeralKeyPair(); // create a new ephemeral key pair * * // Fetch the proof using the getProof function * const proof = await aptos.getProof({ * jwt, * ephemeralKeyPair, * pepper: await getPepper({}), // fetch the pepper if not provided * uidKey: "sub", // specify the uid key * }); * * console.log("Fetched proof:", proof); * } * runExample().catch(console.error); * ``` * @group Keyless */ getProof(args: { jwt: string; ephemeralKeyPair: EphemeralKeyPair; pepper?: HexInput; uidKey?: string; }): Promise; deriveKeylessAccount(args: { jwt: string; ephemeralKeyPair: EphemeralKeyPair; uidKey?: string; pepper?: HexInput; proofFetchCallback?: ProofFetchCallback; }): Promise; deriveKeylessAccount(args: { jwt: string; ephemeralKeyPair: EphemeralKeyPair; jwkAddress: AccountAddressInput; uidKey?: string; pepper?: HexInput; proofFetchCallback?: ProofFetchCallback; }): Promise; /** * This installs a set of FederatedJWKs at an address for a given iss. * * It will fetch the JSON Web Keyset (JWK) set from the well-known endpoint and update the FederatedJWKs at the sender's address * to reflect it. * * @param args.sender The account that will install the JWKs * @param args.iss the iss claim of the federated OIDC provider. * @param args.jwksUrl the URL to find the corresponding JWKs. For supported IDP providers this parameter in not necessary. * * @returns The pending transaction that results from submission. * @group Keyless */ updateFederatedKeylessJwkSetTransaction(args: { sender: Account; iss: string; jwksUrl?: string; options?: InputGenerateTransactionOptions; }): Promise; } /** * A class to query all `Object` related queries on Aptos. * @group Object */ declare class AptosObject { readonly config: AptosConfig; /** * Creates an instance of the Aptos client with the provided configuration. * This allows interaction with the Aptos blockchain using the specified settings. * * @param config - The configuration settings for the Aptos client. * @param config.network - The network to connect to (e.g., mainnet, testnet). * @param config.nodeUrl - The URL of the Aptos node to connect to. * @param config.faucetUrl - The URL of the faucet for funding accounts (optional). * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * async function runExample() { * // Create a configuration for the Aptos client * const config = new AptosConfig({ * network: Network.TESTNET, // Specify the desired network * nodeUrl: "https://testnet.aptos.dev", // Replace with your node URL * }); * * // Create an instance of the Aptos client * const aptos = new Aptos(config); * * console.log("Aptos client created successfully", aptos); * } * runExample().catch(console.error); * ``` * @group Object */ constructor(config: AptosConfig); /** * Fetches the object data based on the specified object address. * * @param args.objectAddress - The object address to retrieve data for. * @param args.minimumLedgerVersion - Optional minimum ledger version to wait for. * @param args.options - Optional configuration options for pagination and ordering. * * @returns The object data corresponding to the provided address. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * const config = new AptosConfig({ network: Network.TESTNET }); * const aptos = new Aptos(config); * * async function runExample() { * // Fetching object data by object address * const objectData = await aptos.getObjectDataByObjectAddress({ * objectAddress: "0x1", // replace with a real object address * }); * * console.log(objectData); * } * runExample().catch(console.error); * ``` * @group Object */ getObjectDataByObjectAddress(args: { objectAddress: AccountAddressInput; minimumLedgerVersion?: AnyNumber; options?: PaginationArgs & OrderByArg; }): Promise; } /** * The main entry point for interacting with the Aptos APIs, * providing access to various functionalities organized into * distinct namespaces. * * To utilize the SDK, instantiate a new Aptos object to gain * access to the complete range of SDK features. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * async function runExample() { * // Create a configuration for connecting to the Aptos testnet * const config = new AptosConfig({ network: Network.TESTNET }); * * // Initialize the Aptos client with the configuration * const aptos = new Aptos(config); * * console.log("Aptos client initialized:", aptos); * } * runExample().catch(console.error); * ``` * @group Client */ declare class Aptos { readonly config: AptosConfig; readonly account: Account$1; readonly ans: ANS; readonly coin: Coin; readonly digitalAsset: DigitalAsset; readonly faucet: Faucet; readonly fungibleAsset: FungibleAsset; readonly general: General; readonly staking: Staking; readonly transaction: Transaction; readonly table: Table; readonly keyless: Keyless; readonly object: AptosObject; /** * Initializes a new instance of the Aptos client with the provided configuration settings. * This allows you to interact with various Aptos functionalities such as accounts, transactions, and events. * * @param settings - Configuration settings for the Aptos client. * * @example * ```typescript * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk"; * * async function runExample() { * // Create a new Aptos client with default settings * const config = new AptosConfig({ network: Network.TESTNET }); // Specify your own settings if needed * const aptos = new Aptos(config); * * console.log("Aptos client initialized:", aptos); * } * runExample().catch(console.error); * ``` * @group Client */ constructor(config?: AptosConfig); setIgnoreTransactionSubmitter(ignore: boolean): void; } interface Aptos extends Account$1, ANS, Coin, DigitalAsset, Faucet, FungibleAsset, General, Keyless, Staking, Table, AptosObject, Omit { } type RawANSName = GetANSNameResponse[0]; /** * The token standard for the ANS name. v1 is the original token standard, v2 is * the new token standard. v1 has been deprecated. */ type AnsTokenStandard = "v1" | "v2"; /** * Policy for determining how subdomains expire in relation to their parent domain. */ declare enum SubdomainExpirationPolicy { /** * The subdomain will expire independently of the domain. The owner of the * domain can manually set when the subdomain expires. */ Independent = 0, /** * The subdomain will expire at the same time as the domain. */ FollowsDomain = 1 } /** * The status of the name. */ declare enum ExpirationStatus { /** * The name no longer functions as a primary or target name. It is open to * being claimed by the public. */ Expired = "expired", /** * The name is past it's expiration date, but only claimable by the current * owner of the name. It does not function as a primary or target name. */ InGracePeriod = "in_grace_period", /** * The name is in good standing. */ Active = "active" } interface AnsName extends RawANSName { /** * The domain name. ie "aptos.apt" would have a domain of "aptos" */ domain: string; /** * The subdomain name, if the name is a subdomain. ie "name.aptos.apt" would have a subdomain of "name" */ subdomain?: string; /** * The expiration timestamp of the name in milliseconds since epoch. Note, if * the name is not a subdomain, this will be the same as the domain expiration * timestamp. */ expiration_timestamp: string; /** * The expiration timestamp of the domain in milliseconds since epoch. */ domain_expiration_timestamp: string; /** * This is a derived date value. It takes into consideration if the name is a * subdomain and its expiration policy. */ expiration: Date; /** * The status of the name's expiration. * * 1. Expired: The name has expired and is no longer resolvable. * 2. InGracePeriod: The name is within the grace period and is still * resolvable if it is renewed. * 3. Active: The name is active and is resolvable. * * @see {@link ExpirationStatus} */ expiration_status: ExpirationStatus; /** * The address that the name points to. For example, if you send a transaction * to "aptos.apt" with a target address of "0x1", the registered_address will * be "0x1". */ registered_address?: string; /** * The token standard for the name. See {@link AnsTokenStandard} for more details. */ token_standard: AnsTokenStandard; /** * If the name is registered as a primary name for _any_ account. It is * possible to have multiple primary names returned in a single query. */ is_primary: boolean; /** * The address of the wallet that owns the name. */ owner_address?: string; /** * The expiration policy for the subdomain. See {@link SubdomainExpirationPolicy} for more details. */ subdomain_expiration_policy: SubdomainExpirationPolicy; /** * Whether the name is in the renewable period. This incorporates leading time * before the name expires and the grace period after the name expires. */ isInRenewablePeriod: boolean; } /** * This class exists solely to represent a sequence of fixed bytes as a serialized entry function, because * serializing an entry function appends a prefix that's *only* used for entry function arguments. * * NOTE: Using this class for serialized script functions will lead to erroneous and unexpected behavior. * * If you wish to convert this class back to a TransactionArgument, you must know the type * of the argument beforehand, and use the appropriate class to deserialize the bytes within * an instance of this class. * @group Implementation * @category BCS */ declare class EntryFunctionBytes extends Serializable implements EntryFunctionArgument { readonly value: FixedBytes; /** * Creates an instance of the class with a specified hexadecimal input value. * * @param value - The hexadecimal input to be converted into FixedBytes. * @group Implementation * @category BCS */ private constructor(); /** * Serializes the value using the provided serializer. * This function is essential for accurately representing a sequence of bytes that are already BCS-serialized as a type. * * Note that to see the Move, BCS-serialized representation of the underlying fixed byte vector, * we must not serialize the length prefix. * * @param serializer - The serializer instance used to perform the serialization. * @group Implementation * @category BCS */ serialize(serializer: Serializer): void; /** * Serializes the current instance for use as an entry function argument by converting the underlying fixed byte vector to a * type-agnostic byte vector. * This process includes serializing the length prefix of the byte vector. * * @param serializer - The serializer instance used to perform the serialization. * @group Implementation * @category BCS */ serializeForEntryFunction(serializer: Serializer): void; /** * The only way to create an instance of this class is to use this static method. * This function should only be used when deserializing a sequence of EntryFunctionPayload arguments. * @param deserializer - The deserializer instance with the buffered bytes. * @param length - The length of the bytes to deserialize. * @returns An instance of this class, which will now only be usable as an EntryFunctionArgument. * @group Implementation * @category BCS */ static deserialize(deserializer: Deserializer, length: number): EntryFunctionBytes; } /** * Arguments required to create an instance of an Ed25519 signer. * * @param privateKey - The private key used for signing. * @param address - Optional account address associated with the signer. * @group Implementation * @category Account (On-Chain Model) */ interface Ed25519SignerConstructorArgs { privateKey: Ed25519PrivateKey; address?: AccountAddressInput; } /** * Arguments for creating an Ed25519 signer from a derivation path. * * @param path - The derivation path for the Ed25519 key. * @param mnemonic - The mnemonic phrase used to generate the key. * @group Implementation * @category Account (On-Chain Model) */ interface Ed25519SignerFromDerivationPathArgs { path: string; mnemonic: string; } /** * Arguments required to verify an Ed25519 signature against a given message. * * @param message - The message to be verified, represented in hexadecimal format. * @param signature - The Ed25519 signature to validate. * @group Implementation * @category Account (On-Chain Model) */ interface VerifyEd25519SignatureArgs { message: HexInput; signature: Ed25519Signature; } /** * Represents an Ed25519 account that provides signing capabilities through an Ed25519 private key. * This class allows for the creation of accounts, signing messages and transactions, and verifying signatures. * * Note: Generating an instance of this class does not create the account on-chain. * @group Implementation * @category Account (On-Chain Model) */ declare class Ed25519Account implements Account { /** * Private key associated with the account * @group Implementation * @category Account (On-Chain Model) */ readonly privateKey: Ed25519PrivateKey; readonly publicKey: Ed25519PublicKey; readonly accountAddress: AccountAddress; readonly signingScheme = SigningScheme.Ed25519; /** * Creates an instance of the Ed25519Signer with the specified parameters. * This constructor initializes the private key, public key, and account address for the signer. * * @param args - The constructor arguments for the Ed25519Signer. * @param args.privateKey - The private key used for signing. * @param args.address - The optional account address; if not provided, it will derive the address from the public key. * @group Implementation * @category Account (On-Chain Model) */ constructor(args: Ed25519SignerConstructorArgs); /** * Generates a new Ed25519 account using a randomly generated private key. * This function is useful for creating a signer that can be used for cryptographic operations. * * @returns {Ed25519Account} The newly generated Ed25519 account. * @group Implementation * @category Account (On-Chain Model) */ static generate(): Ed25519Account; /** * Derives an Ed25519 account using a specified BIP44 path and mnemonic seed phrase. * * @param args - The arguments for deriving the account. * @param args.path - The BIP44 derive hardened path, e.g., m/44'/637'/0'/0'/0'. * Detailed description: {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki} * @param args.mnemonic - The mnemonic seed phrase of the account. * @group Implementation * @category Account (On-Chain Model) */ static fromDerivationPath(args: Ed25519SignerFromDerivationPathArgs): Ed25519Account; /** * Verify the given message and signature with the public key. * * @param args - The arguments for verifying the signature. * @param args.message - Raw message data in HexInput format. * @param args.signature - Signed message signature. * @returns A boolean indicating whether the signature is valid. * @group Implementation * @category Account (On-Chain Model) */ verifySignature(args: VerifyEd25519SignatureArgs): boolean; /** * Verify the given message and signature with the public key. * * Ed25519 signatures do not depend on chain state, so this function is equivalent to the synchronous verifySignature method. * * @param args - The arguments for verifying the signature. * @param args.aptosConfig - The configuration object for connecting to the Aptos network * @param args.message - Raw message data in HexInput format. * @param args.signature - Signed message signature. * @returns A boolean indicating whether the signature is valid. * @group Implementation * @category Account (On-Chain Model) */ verifySignatureAsync(args: { aptosConfig: AptosConfig; message: HexInput; signature: Signature; }): Promise; /** * Sign a message using the account's Ed25519 private key. * This function returns an AccountAuthenticator containing the signature along with the account's public key. * * @param message - The signing message, represented as hexadecimal input. * @returns An AccountAuthenticator containing the signature and the account's public key. * @group Implementation * @category Account (On-Chain Model) */ signWithAuthenticator(message: HexInput): AccountAuthenticatorEd25519; /** * Sign a transaction using the account's Ed25519 private key. * This function returns an AccountAuthenticator that contains the signature of the transaction along with the account's public key. * * @param transaction - The raw transaction to be signed. * @returns An AccountAuthenticator containing the signature and the public key. * @group Implementation * @category Account (On-Chain Model) */ signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorEd25519; /** * Sign the given message using the account's Ed25519 private key. * @param message - The message to be signed in HexInput format. * @returns Signature - The resulting signature of the signed message. * @group Implementation * @category Account (On-Chain Model) */ sign(message: HexInput): Ed25519Signature; /** * Sign the given transaction using the available signing capabilities. * This function helps ensure that the transaction is properly authenticated before submission. * * @param transaction - The transaction to be signed. * @returns Signature - The resulting signature for the transaction. * @group Implementation * @category Account (On-Chain Model) */ signTransaction(transaction: AnyRawTransaction): Ed25519Signature; } /** * Account implementation for the Keyless authentication scheme. * * Used to represent a Keyless based account and sign transactions with it. * * Use `KeylessAccount.create()` to instantiate a KeylessAccount with a JWT, proof and EphemeralKeyPair. * * When the proof expires or the JWT becomes invalid, the KeylessAccount must be instantiated again with a new JWT, * EphemeralKeyPair, and corresponding proof. * @group Implementation * @category Account (On-Chain Model) */ declare class KeylessAccount extends AbstractKeylessAccount { /** * The KeylessPublicKey associated with the account * @group Implementation * @category Account (On-Chain Model) */ readonly publicKey: KeylessPublicKey; /** * Use the static generator `create(...)` instead. * Creates an instance of the KeylessAccount with an optional proof. * * @param args - The parameters for creating a KeylessAccount. * @param args.address - Optional account address associated with the KeylessAccount. * @param args.ephemeralKeyPair - The ephemeral key pair used in the account creation. * @param args.iss - A JWT issuer. * @param args.uidKey - The claim on the JWT to identify a user. This is typically 'sub' or 'email'. * @param args.uidVal - The unique id for this user, intended to be a stable user identifier. * @param args.aud - The value of the 'aud' claim on the JWT, also known as client ID. This is the identifier for the dApp's * OIDC registration with the identity provider. * @param args.pepper - A hexadecimal input used for additional security. * @param args.proof - A Zero Knowledge Signature or a promise that resolves to one. * @param args.proofFetchCallback - Optional callback function for fetching proof. * @param args.jwt - A JSON Web Token used for authentication. * @group Implementation * @category Account (On-Chain Model) */ constructor(args: { address?: AccountAddress; ephemeralKeyPair: EphemeralKeyPair; iss: string; uidKey: string; uidVal: string; aud: string; pepper: HexInput; proof: ZeroKnowledgeSig | Promise; proofFetchCallback?: ProofFetchCallback; jwt: string; verificationKeyHash?: HexInput; }); /** * Serializes the transaction data into a format suitable for transmission or storage. * This function ensures that both the transaction bytes and the proof are properly serialized. * * @param serializer - The serializer instance used to convert the transaction data into bytes. * @group Implementation * @category Account (On-Chain Model) */ serialize(serializer: Serializer): void; /** * Deserializes the provided deserializer to create a KeylessAccount instance. * This function extracts necessary components such as the JWT, UID key, pepper, ephemeral key pair, and proof from the deserializer. * * @param deserializer - The deserializer instance used to retrieve the serialized data. * @returns A KeylessAccount instance created from the deserialized data. * @group Implementation * @category Account (On-Chain Model) */ static deserialize(deserializer: Deserializer): KeylessAccount; /** * Deserialize bytes using this account's information. * * @param bytes The bytes being interpreted. * @returns */ static fromBytes(bytes: HexInput): KeylessAccount; /** * Creates a KeylessAccount instance using the provided parameters. * This function allows you to set up a KeylessAccount with specific attributes such as address, proof, and JWT. * This is used instead of the KeylessAccount constructor. * * @param args - The parameters for creating a KeylessAccount. * @param args.address - Optional account address associated with the KeylessAccount. * @param args.proof - A Zero Knowledge Signature or a promise that resolves to one. * @param args.jwt - A JSON Web Token used for authentication. * @param args.ephemeralKeyPair - The ephemeral key pair used in the account creation. * @param args.pepper - A hexadecimal input used for additional security. * @param args.uidKey - Optional key for user identification, defaults to "sub". * @param args.proofFetchCallback - Optional callback function for fetching proof. * @group Implementation * @category Account (On-Chain Model) */ static create(args: { address?: AccountAddress; proof: ZeroKnowledgeSig | Promise; jwt: string; ephemeralKeyPair: EphemeralKeyPair; pepper: HexInput; uidKey?: string; proofFetchCallback?: ProofFetchCallback; verificationKey?: Groth16VerificationKey; verificationKeyHash?: Uint8Array; }): KeylessAccount; } /** * Arguments required to verify a multi-key signature against a given message. * * @param message - The original message that was signed. * @param signature - The multi-key signature to be verified. * @group Implementation * @category Account (On-Chain Model) */ interface VerifyMultiKeySignatureArgs { message: HexInput; signature: MultiKeySignature; } /** * Signer implementation for the MultiKey authentication scheme. * * This account utilizes an M of N signing scheme, where M and N are specified in the {@link MultiKey}. * It signs messages using an array of M accounts, each corresponding to a public key in the {@link MultiKey}. * * Note: Generating a signer instance does not create the account on-chain. * @group Implementation * @category Account (On-Chain Model) */ declare class MultiKeyAccount implements Account, KeylessSigner { /** * Public key associated with the account * @group Implementation * @category Account (On-Chain Model) */ readonly publicKey: MultiKey; /** * Account address associated with the account * @group Implementation * @category Account (On-Chain Model) */ readonly accountAddress: AccountAddress; /** * Signing scheme used to sign transactions * @group Implementation * @category Account (On-Chain Model) */ readonly signingScheme: SigningScheme; /** * The signers used to sign messages. These signers should correspond to public keys in the * MultiKeyAccount's public key. The number of signers should be equal to this.publicKey.signaturesRequired. * @group Implementation * @category Account (On-Chain Model) */ readonly signers: Account[]; /** * An array of indices where for signer[i], signerIndicies[i] is the index of the corresponding public key in * publicKey.publicKeys. Used to derive the right public key to use for verification. * @group Implementation * @category Account (On-Chain Model) */ readonly signerIndicies: number[]; readonly signaturesBitmap: Uint8Array; /** * Constructs a MultiKeyAccount instance, which requires multiple signatures for transactions. * * @param args - The arguments for creating a MultiKeyAccount. * @param args.multiKey - The multikey of the account consisting of N public keys and a number M representing the required signatures. * @param args.signers - An array of M signers that will be used to sign the transaction. * @param args.address - An optional account address input. If not provided, the derived address from the public key will be used. * @group Implementation * @category Account (On-Chain Model) */ constructor(args: { multiKey: MultiKey; signers: SingleKeySignerOrLegacyEd25519Account[]; address?: AccountAddressInput; }); /** * Static constructor to create a MultiKeyAccount using the provided public keys and signers. * * @param args - The arguments for creating a MultiKeyAccount. * @param args.publicKeys - The N public keys of the MultiKeyAccount. * @param args.signaturesRequired - The number of signatures required to authorize a transaction. * @param args.signers - An array of M signers that will be used to sign the transaction. * @returns MultiKeyAccount - The newly created MultiKeyAccount. * @group Implementation * @category Account (On-Chain Model) */ static fromPublicKeysAndSigners(args: { address?: AccountAddressInput; publicKeys: PublicKey[]; signaturesRequired: number; signers: SingleKeySignerOrLegacyEd25519Account[]; }): MultiKeyAccount; /** * Determines if the provided account is a multi-key account. * * @param account - The account to check. * @returns A boolean indicating whether the account is a multi-key account. * @group Implementation * @category Account (On-Chain Model) */ static isMultiKeySigner(account: Account): account is MultiKeyAccount; /** * Sign a message using the account's signers and return an AccountAuthenticator containing the signature along with the * account's public key. * @param message - The signing message, represented as binary input in hexadecimal format. * @returns An instance of AccountAuthenticatorMultiKey that includes the signature and the public key. * @group Implementation * @category Account (On-Chain Model) */ signWithAuthenticator(message: HexInput): AccountAuthenticatorMultiKey; /** * Sign a transaction using the account's signers, returning an AccountAuthenticator that contains the signature and the * account's public key. * @param transaction - The raw transaction to be signed. * @returns An AccountAuthenticatorMultiKey containing the signature of the transaction along with the account's public key. * @group Implementation * @category Account (On-Chain Model) */ signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorMultiKey; /** * Waits for any proofs on KeylessAccount signers to be fetched. This ensures that signing with the KeylessAccount does not * fail due to missing proofs. * @return {Promise} A promise that resolves when all proofs have been fetched. * @group Implementation * @category Account (On-Chain Model) */ waitForProofFetch(): Promise; /** * Validates that the Keyless Account can be used to sign transactions. * @return * @group Implementation * @category Account (On-Chain Model) */ checkKeylessAccountValidity(aptosConfig: AptosConfig): Promise; /** * Sign the given message using the MultiKeyAccount's signers * @param data - The data to be signed in HexInput format. * @returns MultiKeySignature * @group Implementation * @category Account (On-Chain Model) */ sign(data: HexInput): MultiKeySignature; /** * Sign the given transaction using the MultiKeyAccount's signers. * This function aggregates signatures from all signers associated with the MultiKeyAccount. * * @param transaction - The transaction to be signed. * @returns MultiKeySignature - An object containing the aggregated signatures and a bitmap of the signatures. * @group Implementation * @category Account (On-Chain Model) */ signTransaction(transaction: AnyRawTransaction): MultiKeySignature; /** * Verify the given message and signature with the public keys. * * This function checks if the provided signatures are valid for the given message using the corresponding public keys. * Note: If you are using KeylessAccounts, you must use `verifySignatureAsync` instead. * * @param args - The arguments for verifying the signature. * @param args.message - The raw message data in HexInput format. * @param args.signature - The signed message MultiKeySignature containing multiple signatures. * @returns A boolean indicating whether the signatures are valid for the message. * @group Implementation * @category Account (On-Chain Model) */ verifySignature(args: { message: HexInput; signature: MultiKeySignature; }): boolean; /** * Verify the given message and signature with the public keys. * * This function checks if the provided signatures are valid for the given message using the corresponding public keys. * * @param args - The arguments for verifying the signature. * @param args.message - The raw message data in HexInput format. * @param args.signature - The signed message MultiKeySignature containing multiple signatures. * @param args.options.throwErrorWithReason - Whether to throw an error with the reason for the verification failure. * @returns A boolean indicating whether the signatures are valid for the message. * @group Implementation * @category Account (On-Chain Model) */ verifySignatureAsync(args: { aptosConfig: AptosConfig; message: HexInput; signature: MultiKeySignature; options?: { throwErrorWithReason?: boolean; }; }): Promise; } interface MultiEd25519SignerConstructorArgs { publicKey: MultiEd25519PublicKey; signers: Ed25519PrivateKey[]; address?: AccountAddressInput; } interface VerifyMultiEd25519SignatureArgs { message: HexInput; signature: MultiEd25519Signature; } /** * Signer implementation for the Multi-Ed25519 authentication scheme. * * Note: This authentication scheme is a legacy authentication scheme. Prefer using MultiKeyAccounts as a * MultiKeyAccount can support any type of signer, not just Ed25519. Generating a signer instance does not * create the account on-chain. */ declare class MultiEd25519Account implements Account { readonly publicKey: MultiEd25519PublicKey; readonly accountAddress: AccountAddress; readonly signingScheme = SigningScheme.MultiEd25519; /** * The signers used to sign messages. These signers should correspond to public keys in the * MultiEd25519Account. The number of signers should be equal to this.publicKey.threshold. * @group Implementation * @category Account (On-Chain Model) */ readonly signers: Ed25519PrivateKey[]; /** * An array of indices where for signer[i], signerIndicies[i] is the index of the corresponding public key in * publicKey.publicKeys. Used to derive the right public key to use for verification. * @group Implementation * @category Account (On-Chain Model) */ readonly signerIndices: number[]; readonly signaturesBitmap: Uint8Array; constructor(args: MultiEd25519SignerConstructorArgs); /** * Verify the given message and signature with the public key. * * @param args.message raw message data in HexInput format * @param args.signature signed message Signature * @returns */ verifySignature(args: VerifyMultiEd25519SignatureArgs): boolean; /** * Verify the given message and signature with the public key. * * MultiEd25519 signatures do not depend on chain state, so this function is * equivalent to the synchronous verifySignature method. * * @param args - The arguments for verifying the signature. * @param args.aptosConfig - The configuration object for connecting to the Aptos network * @param args.message - Raw message data in HexInput format. * @param args.signature - Signed message signature. * @returns A boolean indicating whether the signature is valid. * @group Implementation * @category Account (On-Chain Model) */ verifySignatureAsync(args: { aptosConfig: AptosConfig; message: HexInput; signature: Signature; options?: { throwErrorWithReason?: boolean; }; }): Promise; /** * Sign a message using the account's Ed25519 private key. * @param message the signing message, as binary input * @return the AccountAuthenticator containing the signature, together with the account's public key */ signWithAuthenticator(message: HexInput): AccountAuthenticatorMultiEd25519; /** * Sign a transaction using the account's Ed25519 private keys. * @param transaction the raw transaction * @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key */ signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorMultiEd25519; /** * Sign the given message using the account's Ed25519 private keys. * @param message in HexInput format * @returns MultiEd25519Signature */ sign(message: HexInput): MultiEd25519Signature; /** * Sign the given transaction using the available signing capabilities. * @param transaction the transaction to be signed * @returns Signature */ signTransaction(transaction: AnyRawTransaction): MultiEd25519Signature; } /** * Utility functions for working with accounts. */ declare namespace AccountUtils { function toBytes(account: Account): Uint8Array; function toHexStringWithoutPrefix(account: Account): string; function toHexString(account: Account): string; function deserialize(deserializer: Deserializer): Account; function keylessAccountFromHex(hex: HexInput): KeylessAccount; function federatedKeylessAccountFromHex(hex: HexInput): FederatedKeylessAccount; function multiKeyAccountFromHex(hex: HexInput): MultiKeyAccount; function singleKeyAccountFromHex(hex: HexInput): SingleKeyAccount; function ed25519AccountFromHex(hex: HexInput): Ed25519Account; function fromHex(hex: HexInput): Account; function fromBytes(bytes: Uint8Array): Account; } type AbstractedAccountConstructorArgs = { /** * The account address of the account. */ accountAddress: AccountAddress; /** * The signer function signs transactions and returns the `authenticator` bytes in the `AbstractionAuthData`. * * @param digest - The SHA256 hash of the transaction signing message * @returns The `authenticator` bytes that can be used to verify the signature. */ signer: (digest: HexInput) => Uint8Array; /** * The authentication function that will be used to verify the signature. * * @example * ```ts * const authenticationFunction = `${accountAddress}::permissioned_delegation::authenticate`; * ``` */ authenticationFunction: string; }; declare class AbstractedAccount extends Account { readonly publicKey: AbstractPublicKey; readonly accountAddress: AccountAddress; readonly authenticationFunction: string; readonly signingScheme = SigningScheme.SingleKey; constructor({ signer, accountAddress, authenticationFunction }: AbstractedAccountConstructorArgs); /** * Creates an `AbstractedAccount` from an `Ed25519Account` that has a permissioned signer function and * using the `0x1::permissioned_delegation::authenticate` function to verify the signature. * * @param signer - The `Ed25519Account` that can be used to sign permissioned transactions. * @returns The `AbstractedAccount` */ static fromPermissionedSigner({ signer, accountAddress, }: { signer: Ed25519Account; accountAddress?: AccountAddress; }): AbstractedAccount; static generateAccountAbstractionMessage(message: HexInput, functionInfo: string): HexInput; signWithAuthenticator(message: HexInput): AccountAuthenticatorAbstraction; signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorAbstraction; sign: (message: HexInput) => AbstractSignature; signTransaction(transaction: AnyRawTransaction): AbstractSignature; /** * Update the signer function for the account. This can be done after asynchronous operations are complete * to update the context of the signer function. * * @param signer - The new signer function to use for the account. */ setSigner(signer: (digest: HexInput) => HexInput): void; } type DerivableAbstractedAccountArgs = { /** * The signer function signs transactions and returns the `authenticator` bytes in the `AbstractionAuthData`. * * @param digest - The SHA256 hash of the transaction signing message * @returns The `authenticator` bytes that can be used to verify the signature. */ signer: (digest: HexInput) => Uint8Array; /** * The authentication function that will be used to verify the signature. * * @example * ```ts * const authenticationFunction = `${accountAddress}::permissioned_delegation::authenticate`; * ``` */ authenticationFunction: string; /** * The abstract public key that is used to identify the account. * Depends on the use cases, most of the time it is the public key of the source wallet */ abstractPublicKey: Uint8Array; }; declare class DerivableAbstractedAccount extends AbstractedAccount { /** * The abstract public key that is used to identify the account. * Depends on the use cases, most of the time it is the public key of the source wallet */ readonly abstractPublicKey: Uint8Array; /** * The domain separator used to calculate the DAA account address. */ static readonly ADDRESS_DOMAIN_SEPERATOR: number; constructor({ signer, authenticationFunction, abstractPublicKey }: DerivableAbstractedAccountArgs); /** * Compute the account address of the DAA * The DAA account address is computed by hashing the function info and the account identity * and appending the domain separator (5) * * @param functionInfo - The authentication function * @param accountIdentifier - The account identity * @returns The account address */ static computeAccountAddress(functionInfo: string, accountIdentifier: Uint8Array): Uint8Array; signWithAuthenticator(message: HexInput): AccountAuthenticatorAbstraction; } /** * @group Implementation * @category Utils */ type DeserializableClass = { /** * Deserializes a serialized object using the provided deserializer. * This function allows you to reconstruct an object from its serialized form. * * @param deserializer - An instance of the Deserializer used to read the serialized data. * @group Implementation * @category Utils */ deserialize(deserializer: Deserializer): T; }; /** * Normalizes an instance of a class by deserializing it from its byte representation. * This function allows the `instanceof` operator to work correctly when the input objects originate from a different bundle. * * @param cls - The class of the object to normalize. * @param value - The instance to normalize. * @group Implementation * @category Utils */ declare function normalizeBundle(cls: DeserializableClass, value: T): T; /** * Checks if the current runtime environment is Bun. * This is useful for detecting Bun-specific compatibility issues. * * @returns true if running in Bun, false otherwise. * @group Implementation * @category Utils */ declare function isBun(): boolean; /** * Logs a warning message to the console only in development environments. * This function helps reduce information leakage in production while maintaining * helpful warnings during development. * * @param message - The warning message to log. * @group Implementation * @category Utils */ declare function warnIfDevelopment(message: string): void; /** * Sleep for the specified amount of time in milliseconds. * This function can be used to introduce delays in asynchronous operations. * * @param timeMs - The time in milliseconds to sleep. * @group Implementation * @category Utils */ declare function sleep(timeMs: number): Promise; /** * Get the error message from an unknown error. * * @param error The error to get the message from * @returns The error message * @group Implementation * @category Utils */ declare function getErrorMessage(error: unknown): string; /** * @group Implementation * @category Utils */ declare const nowInSeconds: () => number; /** * Floors the given timestamp to the nearest whole hour. * This function is useful for normalizing timestamps to hourly intervals. * * @param timestampInSeconds - The timestamp in seconds to be floored. * @group Implementation * @category Utils */ declare function floorToWholeHour(timestampInSeconds: number): number; /** * Decodes a base64 URL-encoded string into its original form. * This function is useful for converting base64 URL-encoded data back to a readable format. * * @param base64Url - The base64 URL-encoded string to decode. * @returns The decoded string. * @group Implementation * @category Utils */ declare function base64UrlDecode(base64Url: string): string; declare function base64UrlToBytes(base64Url: string): Uint8Array; /** * Amount is represented in the smallest unit format on chain, this function converts * a human-readable amount format to the smallest unit format * @example * human-readable amount format: 500 * on chain amount format when decimal is 8: 50000000000 * * @param value The value in human-readable format * @param decimal The token decimal * @returns The value in the smallest units * @group Implementation * @category Utils */ declare const convertAmountFromHumanReadableToOnChain: (value: number, decimal: number) => number; /** * Amount is represented in the smallest unit format on chain, this function converts * the smallest unit format to a human-readable amount format * @example * human-readable amount format: 500 * on chain amount format when decimal is 8: 50000000000 * * @param value The value in human-readable format * @param decimal The token decimal * @returns The value in the smallest units * @group Implementation * @category Utils */ declare const convertAmountFromOnChainToHumanReadable: (value: number, decimal: number) => number; /** * Convert an encoded struct to a MoveStructId. * * @example * const structObj = { * account_address: "0x1", * module_name: "0x6170746f735f636f696e", * struct_name: "0x4170746f73436f696e", * }; * // structId is "0x1::aptos_coin::AptosCoin" * const structId = parseEncodedStruct(structObj); * * @param structObj The struct with account_address, module_name, and struct_name properties * @returns The MoveStructId * @group Implementation * @category Utils */ declare const parseEncodedStruct: (structObj: { account_address: string; module_name: string; struct_name: string; }) => MoveStructId; /** * Determines whether the given object is an encoded struct type with the following properties: * - account_address: string * - module_name: string * - struct_name: string * * @param structObj The object to check * @returns Whether the object is an encoded struct type * @group Implementation * @category Utils */ declare const isEncodedStruct: (structObj: any) => structObj is { account_address: string; module_name: string; struct_name: string; }; /** * Splits a function identifier into its constituent parts: module address, module name, and function name. * This function helps in validating and extracting details from a function identifier string. * * @param functionArg - The function identifier string in the format "moduleAddress::moduleName::functionName". * @returns An object containing the module address, module name, and function name. * @throws Error if the function identifier does not contain exactly three parts. * @group Implementation * @category Transactions */ declare function getFunctionParts(functionArg: MoveFunctionId): { moduleAddress: string; moduleName: string; functionName: string; }; /** * Validates the provided function information. * * @param functionInfo - The function information to validate. * @returns Whether the function information is valid. * @group Implementation * @category Utils */ declare function isValidFunctionInfo(functionInfo: string): boolean; /** * Truncates the provided wallet address at the middle with an ellipsis. * * @param address - The wallet address to truncate. * @param start - The number of characters to show at the beginning of the address. * @param end - The number of characters to show at the end of the address. * @returns The truncated address. * @group Implementation * @category Utils */ declare function truncateAddress(address: string, start?: number, end?: number): string; /** * Calculates the paired FA metadata address for a given coin type. * This function is tolerant of various address formats in the coin type string, * including complex nested types. * * @example * // All these formats are valid and will produce the same result: * pairedFaMetadataAddress("0x1::aptos_coin::AptosCoin") // simple form * pairedFaMetadataAddress("0x0000000000000000000000000000000000000000000000000000000000000001::aptos_coin::AptosCoin") // long form * pairedFaMetadataAddress("0x00001::aptos_coin::AptosCoin") // with leading zeros * pairedFaMetadataAddress("0x1::coin::Coin<0x1412::a::struct<0x0001::aptos_coin::AptosCoin>>") // nested type parameters * * @param coinType - The coin type string in any of these formats: * - Short form address: "0x1::aptos_coin::AptosCoin" * - Long form address: "0x0000000000000000000000000000000000000000000000000000000000000001::aptos_coin::AptosCoin" * - With leading zeros: "0x00001::aptos_coin::AptosCoin" * - With nested types: "0x1::coin::Coin<0x1412::a::struct<0x0001::aptos_coin::AptosCoin>>" * @returns The calculated metadata address as an AccountAddress instance */ declare function pairedFaMetadataAddress(coinType: `0x${string}::${string}::${string}`): AccountAddress; /** * Sends a request using the specified options and returns the response. * * @param options - The options for the request. * @param options.url - The URL to send the request to. * @param options.method - The HTTP method to use for the request. * @param options.body - The body of the request. * @param options.contentType - The content type of the request. * @param options.params - The query parameters to include in the request. * @param options.overrides - Additional overrides for the request. * @param options.overrides.HEADERS - Custom headers to include in the request. * @param options.overrides.AUTH_TOKEN - The authorization token for the request. * @param options.overrides.API_KEY - The API key for the request. * @param options.overrides.http2 - Whether to use HTTP/2 for the request. * @param options.originMethod - The origin method for the request. * @param client - The client used to make the request. * * @returns The response from the request. * @group Implementation * @category Client */ declare function request(options: ClientRequest, client: Client): Promise>; /** * The main function to use when making an API request, returning the response or throwing an AptosApiError on failure. * * @param aptosRequestOpts - Options for the Aptos request, including the URL and path. * @param aptosConfig - The configuration information for the SDK client instance. * @param apiType - The type of API being accessed, which determines how the response is handled. * @returns The response from the API request or throws an AptosApiError if the request fails. * @group Implementation * @category Client */ declare function aptosRequest(aptosRequestOpts: AptosRequest, aptosConfig: AptosConfig, apiType: AptosApiType): Promise>; /** * Options for making a GET request, including configuration for the API client. * @group Implementation * @category Client */ type GetRequestOptions = { /** * The config for the API client * @group Implementation * @category Client */ aptosConfig: AptosConfig; /** * The type of API endpoint to call e.g. fullnode, indexer, etc * @group Implementation * @category Client */ type: AptosApiType; /** * The name of the API method * @group Implementation * @category Client */ originMethod: string; /** * The URL path to the API method * @group Implementation * @category Client */ path: string; /** * The content type of the request body * @group Implementation * @category Client */ contentType?: MimeType; /** * The accepted content type of the response of the API * @group Implementation * @category Client */ acceptType?: MimeType; /** * The query parameters for the request * @group Implementation * @category Client */ params?: Record; /** * Specific client overrides for this request to override aptosConfig * @group Implementation * @category Client */ overrides?: ClientConfig; }; /** * Options for making a request to the Aptos API, excluding the "type" field. * @group Implementation * @category Client */ type GetAptosRequestOptions = Omit; /** * Executes a GET request to retrieve data based on the provided options. * * @param options - The options for the GET request. * @param options.aptosConfig - The configuration object for Aptos requests. * @param options.overrides - Optional overrides for the request configuration. * @param options.params - Query parameters to include in the request. * @param options.contentType - The content type of the request. * @param options.acceptType - The accepted response type. * @param options.path - The specific path for the request. * @param options.originMethod - The original method of the request. * @param options.type - The type of request being made. * @returns The response from the GET request. * @group Implementation * @category Client */ declare function get(options: GetRequestOptions): Promise>; /** * Retrieves data from the Aptos full node using the provided options. * * @param options - The options for the request to the Aptos full node. * @param options.aptosConfig - Configuration settings specific to the Aptos client and full node. * @param options.aptosConfig.clientConfig - The client configuration settings. * @param options.aptosConfig.fullnodeConfig - The full node configuration settings. * @param options.overrides - Additional overrides for the request. * @param options.type - The type of API request being made. * * @returns A promise that resolves with the response from the Aptos full node. * @group Implementation * @category Client */ declare function getAptosFullNode(options: GetAptosRequestOptions): Promise>; /** * Makes a GET request to the Aptos Pepper service to retrieve data. * * @param options - The options for the request. * @param options.param1 - Description of param1. * @param options.param2 - Description of param2. * @returns AptosResponse - The response from the Aptos Pepper service. * @group Implementation * @category Client */ declare function getAptosPepperService(options: GetAptosRequestOptions): Promise>; /** * This function is a helper for paginating using a function wrapping an API * @group Implementation * @category Client */ declare function paginateWithCursor, Res extends Array<{}>>(options: GetAptosRequestOptions): Promise; declare function paginateWithObfuscatedCursor, Res extends Array<{}>>(options: GetAptosRequestOptions): Promise; declare function getPageWithObfuscatedCursor, Res extends Array<{}>>(options: GetAptosRequestOptions): Promise<{ response: AptosResponse; cursor: string | undefined; }>; /** * Options for making a POST request, including the API client configuration. * @group Implementation * @category Client */ type PostRequestOptions = { /** * The config for the API client * @group Implementation * @category Client */ aptosConfig: AptosConfig; /** * The type of API endpoint to call e.g. fullnode, indexer, etc * @group Implementation * @category Client */ type: AptosApiType; /** * The name of the API method * @group Implementation * @category Client */ originMethod: string; /** * The URL path to the API method * @group Implementation * @category Client */ path: string; /** * The content type of the request body * @group Implementation * @category Client */ contentType?: MimeType; /** * The accepted content type of the response of the API * @group Implementation * @category Client */ acceptType?: MimeType; /** * The query parameters for the request * @group Implementation * @category Client */ params?: Record; /** * The body of the request, should match the content type of the request * @group Implementation * @category Client */ body?: any; /** * Specific client overrides for this request to override aptosConfig * @group Implementation * @category Client */ overrides?: ClientConfig; }; /** * Options for posting a request to Aptos, excluding the type field. * @group Implementation * @category Client */ type PostAptosRequestOptions = Omit; /** * Executes a POST request to the specified URL with the provided options. * * @param options - The options for the POST request. * @param options.type - The type of the request. * @param options.originMethod - The original method that initiated the request. * @param options.path - The path for the request. * @param options.body - The body content to be sent with the request. * @param options.acceptType - The type of response expected from the server. * @param options.contentType - The content type of the request body. * @param options.params - Additional parameters to include in the request. * @param options.aptosConfig - Configuration settings for the Aptos request. * @param options.overrides - Any overrides for the default request behavior. * @returns The response from the POST request. * @group Implementation * @category Client */ declare function post(options: PostRequestOptions): Promise>; /** * Sends a request to the Aptos full node using the specified options. * This function allows you to interact with the Aptos blockchain by sending requests to the full node. * * @param options - The options for the request. * @param options.aptosConfig - Configuration settings for the Aptos client. * @param options.aptosConfig.clientConfig - Client-specific configuration settings. * @param options.aptosConfig.fullnodeConfig - Full node-specific configuration settings. * @param options.overrides - Additional overrides for the request. * @group Implementation * @category Client */ declare function postAptosFullNode(options: PostAptosRequestOptions): Promise>; /** * Sends a request to the Aptos indexer with the specified options. * This function allows you to interact with the Aptos indexer and customize the request using various configurations. * * @param options - The options for the request to the Aptos indexer. * @param options.aptosConfig - Configuration settings specific to the Aptos client and indexer. * @param options.aptosConfig.clientConfig - The client configuration settings. * @param options.aptosConfig.indexerConfig - The indexer configuration settings. * @param options.overrides - Additional overrides for the request. * @param options.overrides.HEADERS - Custom headers to include in the request. * @group Implementation * @category Client */ declare function postAptosIndexer(options: PostAptosRequestOptions): Promise>; /** * Sends a request to the Aptos faucet to obtain test tokens. * This function modifies the provided configuration to ensure that the API_KEY is not included in the request. * * Note that only devnet has a publicly accessible faucet. For testnet, you must use * the minting page at https://aptos.dev/network/faucet. * * @param options - The options for the request. * @param options.aptosConfig - The configuration settings for the Aptos client. * @param options.aptosConfig.clientConfig - The client-specific configuration settings. * @param options.aptosConfig.clientConfig.HEADERS - Optional headers to include in the request. * @param options.aptosConfig.faucetConfig - The configuration settings specific to the faucet. * @param options.overrides - Additional overrides for the request configuration. * @group Implementation * @category Client */ declare function postAptosFaucet(options: PostAptosRequestOptions): Promise>; /** * Makes a post request to the pepper service. * * @param options - The options for the request. * @param options.url - The URL to which the request is sent. * @param options.headers - The headers to include in the request. * @param options.body - The body of the request. * @returns A promise that resolves to the response from the pepper service. * @group Implementation * @category Client */ declare function postAptosPepperService(options: PostAptosRequestOptions): Promise>; /** * Sends a request to the Aptos proving service with the specified options. * * @param options - The options for the request to the Aptos proving service. * @param options.type - The type of the request, which should be set to AptosApiType.PROVER. * @param options.data - The data to be included in the request. * @group Implementation * @category Client */ declare function postAptosProvingService(options: PostAptosRequestOptions): Promise>; declare enum KeylessErrorCategory { API_ERROR = 0, EXTERNAL_API_ERROR = 1, SESSION_EXPIRED = 2, INVALID_STATE = 3, INVALID_SIGNATURE = 4, UNKNOWN = 5 } declare enum KeylessErrorResolutionTip { REAUTHENTICATE = "Re-authentiate to continue using your keyless account", REAUTHENTICATE_UNSURE = "Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support", UPDATE_REQUEST_PARAMS = "Update the invalid request parameters and reauthenticate.", RATE_LIMIT_EXCEEDED = "Cache the keyless account and reuse it to avoid making too many requests. Keyless accounts are valid until either the EphemeralKeyPair expires, when the JWK is rotated, or when the proof verifying key is changed, whichever comes soonest.", SERVER_ERROR = "Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx", CALL_PRECHECK = "Call `await account.checkKeylessAccountValidity()` to wait for asyncronous changes and check for account validity before signing or serializing.", REINSTANTIATE = "Try instantiating the account again. Avoid manipulating the account object directly", JOIN_SUPPORT_GROUP = "For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx", UNKNOWN = "Error unknown. For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx" } declare enum KeylessErrorType { EPHEMERAL_KEY_PAIR_EXPIRED = 0, PROOF_NOT_FOUND = 1, ASYNC_PROOF_FETCH_FAILED = 2, INVALID_PROOF_VERIFICATION_FAILED = 3, INVALID_PROOF_VERIFICATION_KEY_NOT_FOUND = 4, INVALID_JWT_SIG = 5, INVALID_JWT_JWK_NOT_FOUND = 6, INVALID_JWT_ISS_NOT_RECOGNIZED = 7, INVALID_JWT_FEDERATED_ISS_NOT_SUPPORTED = 8, INVALID_TW_SIG_VERIFICATION_FAILED = 9, INVALID_TW_SIG_PUBLIC_KEY_NOT_FOUND = 10, INVALID_EXPIRY_HORIZON = 11, JWT_PARSING_ERROR = 12, JWK_FETCH_FAILED = 13, JWK_FETCH_FAILED_FEDERATED = 14, RATE_LIMIT_EXCEEDED = 15, PEPPER_SERVICE_INTERNAL_ERROR = 16, PEPPER_SERVICE_BAD_REQUEST = 17, PEPPER_SERVICE_OTHER = 18, PROVER_SERVICE_INTERNAL_ERROR = 19, PROVER_SERVICE_BAD_REQUEST = 20, PROVER_SERVICE_OTHER = 21, FULL_NODE_CONFIG_LOOKUP_ERROR = 22, FULL_NODE_VERIFICATION_KEY_LOOKUP_ERROR = 23, FULL_NODE_JWKS_LOOKUP_ERROR = 24, FULL_NODE_OTHER = 25, SIGNATURE_TYPE_INVALID = 26, SIGNATURE_EXPIRED = 27, MAX_EXPIRY_HORIZON_EXCEEDED = 28, EPHEMERAL_SIGNATURE_VERIFICATION_FAILED = 29, TRAINING_WHEELS_SIGNATURE_MISSING = 30, TRAINING_WHEELS_SIGNATURE_VERIFICATION_FAILED = 31, PROOF_VERIFICATION_FAILED = 32, UNKNOWN = 33 } declare class KeylessError extends Error { readonly innerError?: unknown; readonly category: KeylessErrorCategory; readonly resolutionTip: KeylessErrorResolutionTip; readonly type: KeylessErrorType; readonly details?: string; /** @internal this constructor is for sdk internal use - do not instantiate outside of the SDK codebase */ constructor(args: { innerError?: unknown; category: KeylessErrorCategory; resolutionTip: KeylessErrorResolutionTip; type: KeylessErrorType; message?: string; details?: string; }); static constructMessage(message: string, tip: KeylessErrorResolutionTip, innerError?: unknown, details?: string): string; /** * Static constructor that creates a KeylessError instance using the KeylessErrors constant * @param args.type The type of KeylessError * @param args.aptosApiError optional AptosApiError supplied for api errors * @param args.details optional details to include in the error message * @returns A new KeylessError instance */ static fromErrorType(args: { type: KeylessErrorType; error?: unknown; details?: string; }): KeylessError; } /** * Options for handling errors in the Aptos API. */ type AptosApiErrorOpts = { apiType: AptosApiType; aptosRequest: AptosRequest; aptosResponse: AptosResponse; }; /** * Represents an error returned from the Aptos API. * This class encapsulates the details of the error, including the request URL, response status, and additional data. * * @param name - The name of the error, which is always "AptosApiError". * @param url - The URL to which the request was made. * @param status - The HTTP response status code (e.g., 400). * @param statusText - The message associated with the response status. * @param data - The response data returned from the API. * @param request - The original AptosRequest that triggered the error. */ declare class AptosApiError extends Error { readonly url: string; readonly status: number; readonly statusText: string; readonly data: any; readonly request: AptosRequest; /** * Constructs an instance of AptosApiError with relevant error details. * * @param opts - The options for creating the AptosApiError. * @param opts.apiType - The type of API that generated the error. * @param opts.aptosRequest - The request object that caused the error. * @param opts.aptosResponse - The response object containing error details. * * @internal This constructor is for SDK internal use - do not instantiate outside the SDK codebase. */ constructor({ apiType, aptosRequest, aptosResponse }: AptosApiErrorOpts); } export { APTOS_BIP44_REGEX, APTOS_HARDENED_REGEX, AbstractKeylessAccount, AbstractPublicKey, AbstractSignature, AbstractedAccount, Account, AccountAddress, AccountAddressInput, AccountAuthenticator, AccountAuthenticatorAbstraction, AccountAuthenticatorEd25519, AccountAuthenticatorMultiEd25519, AccountAuthenticatorMultiKey, AccountAuthenticatorNoAccountAuthenticator, AccountAuthenticatorSingleKey, AccountData, AccountPublicKey, AccountSequenceNumber, AccountUtils, type AnsName, type AnsTokenStandard, AnyNumber, AnyPublicKey, AnyRawTransaction, AnyRawTransactionInstance, AnySignature, AnyTransactionPayloadInstance, Aptos, AptosApiError, AptosApiType, AptosConfig, AptosRequest, AptosResponse, AuthenticationKey, type BaseAccountPublicKey, Block, Bool, CKDPriv, Client, ClientConfig, ClientRequest, ClientResponse, CommittedTransactionResponse, type CreateAccountFromPrivateKeyArgs, type CreateEd25519AccountFromPrivateKeyArgs, type CreateEd25519SingleKeyAccountFromPrivateKeyArgs, type CreateSingleKeyAccountFromPrivateKeyArgs, CursorPaginationArgs, DerivableAbstractedAccount, type DerivedKeys, type DeserializableClass, Deserializer, EPK_HORIZON_SECS, Ed25519Account, Ed25519PrivateKey, Ed25519PublicKey, Ed25519Signature, type Ed25519SignerConstructorArgs, type Ed25519SignerFromDerivationPathArgs, EntryFunction, EntryFunctionABI, EntryFunctionArgument, EntryFunctionArgumentTypes, EntryFunctionBytes, EphemeralCertificate, EphemeralCertificateVariant, EphemeralKeyPair, EphemeralPublicKey, EphemeralPublicKeyVariant, EphemeralSignature, type ExecutionFinishEventData, ExpirationStatus, type FailureEventData, FederatedKeylessAccount, FederatedKeylessPublicKey, FixedBytes, FunctionABI, GasEstimation, type GenerateAccountArgs, type GenerateEd25519AccountArgs, type GenerateEd25519SingleKeyAccountArgs, type GenerateSingleKeyAccountArgs, GetANSNameResponse, GetAccountCoinsDataResponse, GetAccountCollectionsWithOwnedTokenResponse, GetAccountOwnedTokensFromCollectionResponse, GetAccountOwnedTokensQueryResponse, type GetAptosRequestOptions, GetChainTopUserTransactionsResponse, GetCollectionDataResponse, GetCurrentFungibleAssetBalancesResponse, GetCurrentTokenOwnershipResponse, GetDelegatedStakingActivitiesResponse, GetFungibleAssetActivitiesResponse, GetFungibleAssetMetadataResponse, GetNumberOfDelegatorsResponse, GetObjectDataQueryResponse, GetOwnedTokensResponse, GetProcessorStatusResponse, type GetRequestOptions, GetTableItemsDataResponse, GetTableItemsMetadataResponse, GetTokenActivityResponse, GetTokenDataResponse, GraphqlQuery, Groth16ProofAndStatement, Groth16VerificationKey, Groth16Zkp, HARDENED_OFFSET, Hex, HexInput, I128, I16, I256, I32, I64, I8, InputEntryFunctionData, InputEntryFunctionDataWithABI, InputEntryFunctionDataWithRemoteABI, InputGenerateMultiAgentRawTransactionArgs, InputGenerateSingleSignerRawTransactionArgs, InputGenerateTransactionOptions, InputGenerateTransactionPayloadData, InputGenerateTransactionPayloadDataWithRemoteABI, InputMultiSigDataWithABI, InputMultiSigDataWithRemoteABI, InputScriptData, InputSimulateTransactionData, InputSimulateTransactionOptions, InputSubmitTransactionData, InputTransactionPluginData, InputViewFunctionData, InputViewFunctionDataWithABI, InputViewFunctionDataWithRemoteABI, InputViewFunctionJsonData, KeyType, KeylessAccount, KeylessConfiguration, KeylessError, KeylessErrorCategory, KeylessErrorResolutionTip, KeylessErrorType, KeylessPublicKey, KeylessSignature, type KeylessSigner, LedgerInfo, LedgerVersionArg, MAX_AUD_VAL_BYTES, MAX_COMMITED_EPK_BYTES, MAX_EXTRA_FIELD_BYTES, MAX_ISS_VAL_BYTES, MAX_JWT_HEADER_B64_BYTES, MAX_UID_KEY_BYTES, MAX_UID_VAL_BYTES, MimeType, MoveFunction, MoveFunctionId, MoveJWK, MoveModule, MoveModuleBytecode, MoveResource, MoveString, MoveStructId, MoveValue, MoveVector, MultiAgentTransaction, MultiEd25519Account, MultiEd25519PublicKey, MultiEd25519Signature, type MultiEd25519SignerConstructorArgs, MultiKey, MultiKeyAccount, MultiKeySignature, OrderByArg, PaginationArgs, PendingTransactionResponse, type PostAptosRequestOptions, type PostRequestOptions, PrivateKey, type PrivateKeyFromDerivationPathArgs, PrivateKeyInput, ProcessorType, type ProofFetchCallback, type ProofFetchEvents, type ProofFetchFailure, type ProofFetchStatus, type ProofFetchSuccess, PublicKey, type RawANSName, RawTransaction, RotationProofChallenge, Secp256r1PrivateKey, Secp256r1PublicKey, Secp256r1Signature, Serializable, Serializer, Signature, SignedTransaction, SigningScheme, SigningSchemeInput, SimpleEntryFunctionArgumentTypes, SimpleTransaction, SingleKeyAccount, type SingleKeySigner, type SingleKeySignerConstructorArgs, type SingleKeySignerFromDerivationPathArgs, type SingleKeySignerGenerateArgs, type SingleKeySignerOrLegacyEd25519Account, SubdomainExpirationPolicy, type SuccessEventData, TableItemRequest, TokenStandardArg, TransactionAndProof, TransactionAuthenticator, TransactionAuthenticatorEd25519, TransactionAuthenticatorFeePayer, TransactionAuthenticatorMultiAgent, TransactionAuthenticatorMultiEd25519, TransactionAuthenticatorSingleSender, TransactionInnerPayload, TransactionPayloadEntryFunction, TransactionPayloadMultiSig, TransactionPayloadScript, TransactionResponse, TransactionWorker, type TransactionWorkerEvents, TransactionWorkerEventsEnum, TypeArgument, TypeTag, TypeTagParserError, TypeTagParserErrorType, U128, U16, U256, U32, U64, U8, UserTransactionResponse, type VerifyEd25519SignatureArgs, type VerifyMultiEd25519SignatureArgs, type VerifyMultiKeySignatureArgs, VerifySignatureArgs, VerifySignatureAsyncArgs, type VerifySingleKeySignatureArgs, ViewFunctionABI, WaitForTransactionOptions, WebAuthnSignature, WhereArg, ZeroKnowledgeSig, ZkProof, ZkpVariant, aptosRequest, base64UrlDecode, base64UrlToBytes, bigIntToBytesLE, buildTransaction, bytesToBigIntLE, checkOrConvertArgument, convertAmountFromHumanReadableToOnChain, convertAmountFromOnChainToHumanReadable, convertArgument, convertNumber, convertPayloadToInnerPayload, createObjectAddress, createResourceAddress, createTokenAddress, createUserDerivedObjectAddress, deriveKey, deriveTransactionType, deserializePublicKey, deserializeSignature, fetchEntryFunctionAbi, fetchFunctionAbi, fetchJWK, fetchModuleAbi, fetchMoveFunctionAbi, fetchViewFunctionAbi, findFirstNonSignerArg, floorToWholeHour, generateRawTransaction, generateSignedTransaction, generateSignedTransactionForSimulation, generateSigningMessage, generateSigningMessageForSerializable, generateSigningMessageForTransaction, generateTransactionPayload, generateTransactionPayloadWithABI, generateUserTransactionHash, generateViewFunctionPayload, generateViewFunctionPayloadWithABI, get, getAptosFullNode, getAptosPepperService, getAuthenticatorForSimulation, getErrorMessage, getFunctionParts, getIssAudAndUidVal, getKeylessConfig, getKeylessJWKs, getPageWithObfuscatedCursor, hashStrToField, hashValues, isBcsAddress, isBcsBool, isBcsFixedBytes, isBcsI128, isBcsI16, isBcsI256, isBcsI32, isBcsI64, isBcsI8, isBcsString, isBcsU128, isBcsU16, isBcsU256, isBcsU32, isBcsU64, isBcsU8, isBool, isBun, isEmptyOption, isEncodedEntryFunctionArgument, isEncodedStruct, isKeylessSigner, isLargeNumber, isNumber, isScriptDataInput, isSingleKeySigner, isString, isValidBIP44Path, isValidFunctionInfo, isValidHardenedPath, mnemonicToSeed, normalizeBundle, nowInSeconds, padAndPackBytesWithLen, paginateWithCursor, paginateWithObfuscatedCursor, pairedFaMetadataAddress, parseEncodedStruct, parseJwtHeader, parseTypeTag, poseidonHash, post, postAptosFaucet, postAptosFullNode, postAptosIndexer, postAptosPepperService, postAptosProvingService, promiseFulfilledStatus, request, sleep, splitPath, standardizeTypeTags, throwTypeMismatch, truncateAddress, verifyKeylessSignature, verifyKeylessSignatureWithJwkAndConfig, warnIfDevelopment };