/** * 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 */ import { AptosConfig } from "../api/aptosConfig.js"; import { AccountData, CommittedTransactionResponse, CursorPaginationArgs, GetAccountCoinsDataResponse, GetAccountCollectionsWithOwnedTokenResponse, GetAccountOwnedTokensFromCollectionResponse, GetAccountOwnedTokensQueryResponse, GetObjectDataQueryResponse, LedgerVersionArg, MoveModuleBytecode, MoveResource, MoveStructId, OrderByArg, PaginationArgs, TokenStandardArg, WhereArg } from "../types/index.js"; import { AccountAddress, AccountAddressInput } from "../core/accountAddress.js"; import { Account, Ed25519Account, MultiEd25519Account } from "../account/index.js"; import { AccountPublicKey } from "../core/crypto/publicKey.js"; import { PrivateKeyInput } from "../core/crypto/singleKey.js"; import { BaseAccountPublicKey } from "../core/crypto/types.js"; import { Ed25519PrivateKey } from "../core/crypto/ed25519.js"; import { AuthenticationKey } from "../core/authenticationKey.js"; import { CurrentFungibleAssetBalancesBoolExp } from "../types/generated/types.js"; import { InputGenerateTransactionOptions, SimpleTransaction } from "../transactions/index.js"; /** * Retrieves account information for a specified account address. * * @param args - The arguments for retrieving account information. * @param args.aptosConfig - The configuration object for Aptos. * @param args.accountAddress - The address of the account to retrieve information for. * @group Implementation */ export declare function getInfo(args: { aptosConfig: AptosConfig; accountAddress: AccountAddressInput; }): Promise; /** * Retrieves the modules associated with a specified account address. * * @param args - The arguments for retrieving modules. * @param args.aptosConfig - The configuration for connecting to the Aptos blockchain. * @param args.accountAddress - The address of the account whose modules are to be retrieved. * @param args.options - Optional parameters for pagination and ledger version. * @param args.options.limit - The maximum number of modules to retrieve (default is 1000). * @param args.options.offset - The starting point for pagination. Note, this is obfuscated and is not an index. * @param args.options.ledgerVersion - The specific ledger version to query. * @group Implementation */ export declare function getModules(args: { aptosConfig: AptosConfig; accountAddress: AccountAddressInput; options?: { limit?: number; } & LedgerVersionArg; }): Promise; /** * Retrieves the modules associated with a specified account address. * * @param args - The arguments for retrieving modules. * @param args.aptosConfig - The configuration for connecting to the Aptos blockchain. * @param args.accountAddress - The address of the account whose modules are to be retrieved. * @param args.options - Optional parameters for pagination and ledger version. * @param args.options.cursor - The starting point for pagination. Note, this is obfuscated and is not an index. * @param args.options.limit - The maximum number of modules to retrieve (default is 100). * @param args.options.ledgerVersion - The specific ledger version to query. * @group Implementation */ export declare function getModulesPage(args: { aptosConfig: AptosConfig; accountAddress: AccountAddressInput; options?: CursorPaginationArgs & LedgerVersionArg; }): Promise<{ modules: MoveModuleBytecode[]; cursor: string | undefined; }>; /** * Queries for a move module given an account address and module name. * This function can help you retrieve the module's ABI and other relevant information. * * @param args - The arguments for retrieving the module. * @param args.aptosConfig - The configuration for the Aptos client. * @param args.accountAddress - The account address in hex-encoded 32 byte format. * @param args.moduleName - The name of the module to retrieve. * @param args.options - Optional parameters for the request. * @param args.options.ledgerVersion - Specifies the ledger version of transactions. By default, the latest version will be used. * @returns The move module. * @group Implementation */ export declare function getModule(args: { aptosConfig: AptosConfig; accountAddress: AccountAddressInput; moduleName: string; options?: LedgerVersionArg; }): Promise; /** * Retrieves a list of transactions associated with a specific account address. * This function allows you to paginate through the transactions for better performance and usability. * * @param args - The arguments for retrieving transactions. * @param args.aptosConfig - The configuration settings for Aptos. * @param args.accountAddress - The account address for which to retrieve transactions. * @param args.options - Optional pagination parameters. * @param args.options.offset - The starting point for pagination. * @param args.options.limit - The maximum number of transactions to retrieve. * @group Implementation */ export declare function getTransactions(args: { aptosConfig: AptosConfig; accountAddress: AccountAddressInput; options?: PaginationArgs; }): Promise; /** * Retrieves a list of resources associated with a specific account address. * * @param args - The arguments for retrieving resources. * @param args.aptosConfig - The configuration settings for Aptos. * @param args.accountAddress - The address of the account to fetch resources for. * @param args.options - Optional pagination and ledger version parameters. * @param args.options.limit - The maximum number of resources to retrieve (default is 999). * @param args.options.ledgerVersion - The specific ledger version to query. * @group Implementation */ export declare function getResources(args: { aptosConfig: AptosConfig; accountAddress: AccountAddressInput; options?: { limit?: number; } & LedgerVersionArg; }): Promise; /** * Retrieves a page of resources associated with a specific account address. * * @param args - The arguments for retrieving resources. * @param args.aptosConfig - The configuration settings for Aptos. * @param args.accountAddress - The address of the account to fetch resources for. * @param args.options - Optional pagination and ledger version parameters. * @param args.options.cursor - The starting point for pagination. Note, this is obfuscated and is not an index. * @param args.options.limit - The maximum number of resources to retrieve (default is 100). * @param args.options.ledgerVersion - The specific ledger version to query. * @group Implementation */ export declare function getResourcesPage(args: { aptosConfig: AptosConfig; accountAddress: AccountAddressInput; options?: CursorPaginationArgs & LedgerVersionArg; }): Promise<{ resources: MoveResource[]; cursor: string | undefined; }>; /** * Retrieves a specific resource of a given type for the specified account address. * * @param args - The arguments for retrieving the resource. * @param args.aptosConfig - The configuration settings for Aptos. * @param args.accountAddress - The address of the account from which to retrieve the resource. * @param args.resourceType - The type of the resource to retrieve, specified as a MoveStructId. * @param args.options - Optional parameters for specifying the ledger version. * @group Implementation */ export declare function getResource(args: { aptosConfig: AptosConfig; accountAddress: AccountAddressInput; resourceType: MoveStructId; options?: LedgerVersionArg; }): Promise; export declare function getResourceFallible(args: { aptosConfig: AptosConfig; accountAddress: AccountAddressInput; resourceType: MoveStructId; options?: LedgerVersionArg; }): Promise; /** * Retrieves the original account address associated with a given authentication key, which is useful for handling key rotations. * * @param args - The arguments for the lookup. * @param args.aptosConfig - The configuration for the Aptos client. * @param args.authenticationKey - The authentication key for which to look up the original address. * @param args.options - Optional parameters for specifying the ledger version. * @returns The original account address or the provided authentication key address if not found. * @throws Throws an error if the lookup fails for reasons other than the address not being found. * @group Implementation */ export declare function lookupOriginalAccountAddress(args: { aptosConfig: AptosConfig; authenticationKey: AccountAddressInput; options?: LedgerVersionArg; }): Promise; /** * Fetches the on-chain `authentication_key` for an account address and memoizes it for ~1 hour, * keyed by `(network or fullnode URL, address)`. Used by the encrypted-transaction builder to * derive auth keys when the caller does not pass them explicitly. Callers that just rotated their * key and need an immediate fresh read should pass the auth key explicitly instead of relying on * this cache. * * If the address has no `0x1::account::Account` resource on chain (a brand-new account, or a light * account with balance/objects but no explicit resource), returns the address bytes as the * authentication key — matching the chain's account-creation convention (see * [`doesAccountExistAtAddress`]). This makes encrypted-transaction builds work for not-yet-created * signers (e.g., fee-payer sponsorship of an uncreated sender). */ export declare function fetchAndCacheAuthKeyForAddress(args: { aptosConfig: AptosConfig; accountAddress: AccountAddressInput; }): Promise; /** * Retrieves the count of tokens owned by a specific account address. * * @param args - The arguments for retrieving the account tokens count. * @param args.aptosConfig - The configuration settings for the Aptos network. * @param args.accountAddress - The address of the account for which to count the tokens. * @returns The count of tokens owned by the specified account. * @group Implementation */ export declare function getAccountTokensCount(args: { aptosConfig: AptosConfig; accountAddress: AccountAddressInput; }): Promise; /** * Retrieves the tokens owned by a specified account address. * * @param args - The arguments for retrieving the account's tokens. * @param args.aptosConfig - The configuration for the Aptos client. * @param args.accountAddress - The address of the account whose tokens are being queried. * @param args.options - Optional parameters for filtering and pagination. * @param args.options.tokenStandard - The specific token standard to filter the results. * @param args.options.offset - The number of records to skip before starting to collect the result set. * @param args.options.limit - The maximum number of records to return. * @param args.options.orderBy - The criteria for ordering the results. * @returns A promise that resolves to the current token ownerships of the specified account. * @group Implementation */ export declare function getAccountOwnedTokens(args: { aptosConfig: AptosConfig; accountAddress: AccountAddressInput; options?: TokenStandardArg & PaginationArgs & OrderByArg; }): Promise; /** * Retrieves the tokens owned by a specific account from a particular collection address. * * @param args - The parameters required to fetch the owned tokens. * @param args.aptosConfig - The Aptos configuration object. * @param args.accountAddress - The address of the account whose tokens are being queried. * @param args.collectionAddress - The address of the collection from which tokens are being retrieved. * @param args.options - Optional parameters for filtering and pagination, including token standard, pagination arguments, and * order by options. * @group Implementation */ export declare function getAccountOwnedTokensFromCollectionAddress(args: { aptosConfig: AptosConfig; accountAddress: AccountAddressInput; collectionAddress: AccountAddressInput; options?: TokenStandardArg & PaginationArgs & OrderByArg; }): Promise; /** * Retrieves the collections owned by a specified account along with the tokens in those collections. * * @param args - The arguments for the function. * @param args.aptosConfig - The configuration for the Aptos client. * @param args.accountAddress - The address of the account whose collections are being queried. * @param args.options - Optional parameters for filtering and pagination. * @param args.options.tokenStandard - An optional token standard to filter the collections. * @param args.options.offset - An optional offset for pagination. * @param args.options.limit - An optional limit for the number of results returned. * @param args.options.orderBy - An optional parameter to specify the order of the results. * @group Implementation */ export declare function getAccountCollectionsWithOwnedTokens(args: { aptosConfig: AptosConfig; accountAddress: AccountAddressInput; options?: TokenStandardArg & PaginationArgs & OrderByArg; }): Promise; /** * Retrieves the count of transactions associated with a specified account. * * @param args - The arguments for the function. * @param args.aptosConfig - The configuration settings for Aptos. * @param args.accountAddress - The address of the account for which to retrieve the transaction count. * @returns The number of transactions associated with the specified account. * @group Implementation */ export declare function getAccountTransactionsCount(args: { aptosConfig: AptosConfig; accountAddress: AccountAddressInput; }): Promise; /** * Retrieves the amount of a specific coin held by an account. * * @param args - The parameters for the request. * @param args.aptosConfig - The Aptos configuration object. * @param args.accountAddress - The address of the account to query. * @param args.coinType - Optional; the type of coin to check the amount for. * @param args.faMetadataAddress - Optional; the address of the fungible asset metadata. * @returns The amount of the specified coin held by the account, or 0 if none is found. * @throws Error if neither coinType nor faMetadataAddress is provided. * @group Implementation */ export declare function getAccountCoinAmount(args: { aptosConfig: AptosConfig; accountAddress: AccountAddressInput; coinType?: MoveStructId; faMetadataAddress?: AccountAddressInput; }): Promise; /** * Retrieves the current fungible asset balances for a specified account. * * @param args - The arguments for retrieving account coins data. * @param args.aptosConfig - The configuration for connecting to the Aptos network. * @param args.accountAddress - The address of the account for which to retrieve coin data. * @param args.options - Optional parameters for pagination and filtering the results. * @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 for ordering the results. * @param args.options.where - Conditions to filter the results based on the current fungible asset balances. * @group Implementation */ export declare function getAccountCoinsData(args: { aptosConfig: AptosConfig; accountAddress: AccountAddressInput; options?: PaginationArgs & OrderByArg & WhereArg; }): Promise; /** * Retrieves the count of fungible asset coins held by a specified account. * * @param args - The arguments for the function. * @param args.aptosConfig - The configuration settings for the Aptos network. * @param args.accountAddress - The address of the account for which to retrieve the coin count. * @throws Error if the count of account coins cannot be retrieved. * @group Implementation */ export declare function getAccountCoinsCount(args: { aptosConfig: AptosConfig; accountAddress: AccountAddressInput; }): Promise; /** * Retrieves an account's balance for the given asset via the fullnode REST API. * * - `asset` may be a coin type (Move struct ID, e.g. `0x1::aptos_coin::AptosCoin`) or an FA metadata address. * - Calls: `GET /accounts/{accountAddress}/balance/{asset}` and returns the numeric balance. * * @param args - The parameters for the request. * @param args.aptosConfig - The Aptos configuration object. * @param args.accountAddress - The account address to query. * @param args.asset - The asset identifier (coin type or FA metadata address). * @returns The balance as a number. * @group Implementation */ export declare function getBalance(args: { aptosConfig: AptosConfig; accountAddress: AccountAddressInput; asset: MoveStructId | AccountAddressInput; }): Promise; /** * Retrieves the objects owned by a specified account. * * @param args - The parameters for the request. * @param args.aptosConfig - The configuration for the Aptos client. * @param args.accountAddress - The address of the account whose owned objects are to be retrieved. * @param args.options - Optional parameters for pagination and ordering of the results. * @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 by. * @returns A promise that resolves to the current objects owned by the specified account. * @group Implementation */ export declare function getAccountOwnedObjects(args: { aptosConfig: AptosConfig; accountAddress: AccountAddressInput; options?: PaginationArgs & OrderByArg; }): Promise; /** * Derives an account from the provided private key and Aptos configuration. * * This function queries all owned accounts for the provided private key and returns the most * recently used account. If no account is found, it will throw an error unless `throwIfNoAccountFound` is set to false. * * If `throwIfNoAccountFound` is set to false, the function will return the default account for the private key via `Account.fromPrivateKey`. * * NOTE: There is a potential issue once the unified single signer scheme is adopted by the community. * Because one could create two accounts with the same private key with this new authenticator type, * we'll need to determine the order in which we look up the accounts: first unified scheme and then legacy scheme, * or first legacy scheme and then unified scheme. * * @param args - The arguments for deriving the account. * @param args.aptosConfig - The Aptos configuration used for account lookup. * @param args.privateKey - The private key used to derive the account. * @param args.options.throwIfNoAccountFound - If true, throw an error if no existing account is found on chain. Default is false. * @throws Error if the account cannot be derived from the private key. * @group Implementation * @deprecated Note that more inspection is needed by the user to determine which account exists on-chain */ export declare function deriveAccountFromPrivateKey(args: { aptosConfig: AptosConfig; privateKey: PrivateKeyInput; options?: { throwIfNoAccountFound?: boolean; }; }): Promise; /** * Checks if an account exists by verifying its information against the Aptos blockchain. * * @param args - The arguments for the function. * @param args.aptosConfig - The configuration for connecting to the Aptos blockchain. * @param args.authKey - The authentication key used to derive the account address. * @returns A promise that resolves to a boolean indicating whether the account exists. * * @throws Throws an Error if there is an issue while looking for account information. * @group Implementation */ export declare function isAccountExist(args: { aptosConfig: AptosConfig; authKey: AuthenticationKey; }): Promise; /** * Rotates the authentication key for a given account. * * @param args - The arguments for rotating the authentication key. * @param args.aptosConfig - The configuration settings for the Aptos network. * @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) * * @returns A simple transaction object that can be submitted to the network. * @throws Error if the rotation fails or verification fails. * * @group Implementation */ export declare function rotateAuthKey(args: { aptosConfig: AptosConfig; fromAccount: Account; options?: InputGenerateTransactionOptions; } & ({ toAccount: Ed25519Account | MultiEd25519Account; } | { toNewPrivateKey: Ed25519PrivateKey; })): Promise; /** * Rotates the authentication key for a given account without verifying the new key. * * @param args - The arguments for rotating the authentication key. * @param args.aptosConfig - The configuration settings for the Aptos network. * @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. * @throws Error if the rotation fails or verification fails. * * @group Implementation */ export declare function rotateAuthKeyUnverified(args: { aptosConfig: AptosConfig; fromAccount: Account; toNewPublicKey: AccountPublicKey; options?: InputGenerateTransactionOptions; }): Promise; export type AccountInfo = { accountAddress: AccountAddress; publicKey: BaseAccountPublicKey; lastTransactionVersion: number; }; export declare function getAccountsForPublicKey(args: { aptosConfig: AptosConfig; publicKey: BaseAccountPublicKey; options?: { includeUnverified?: boolean; noMultiKey?: boolean; }; }): Promise; export declare function deriveOwnedAccountsFromSigner(args: { aptosConfig: AptosConfig; signer: Account | PrivateKeyInput; options?: { includeUnverified?: boolean; noMultiKey?: boolean; }; }): Promise; //# sourceMappingURL=account.d.ts.map