/** * 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 */ import { AptosConfig } from "../api/aptosConfig.js"; import { AccountAddress, AccountAddressInput } from "../core/index.js"; import { InputGenerateTransactionOptions, InputEntryFunctionData } from "../transactions/types.js"; import { AnsName, ExpirationStatus, OrderByArg, PaginationArgs, RawANSName, WhereArg } from "../types/index.js"; import { CurrentAptosNamesBoolExp } from "../types/generated/types.js"; import { SimpleTransaction } from "../transactions/instances/simpleTransaction.js"; export declare const VALIDATION_RULES_DESCRIPTION: string; /** * Validate if a given fragment is a valid ANS segment. * This function checks the length and character constraints of the fragment to ensure it meets the ANS standards. * * @param fragment - A fragment of a name, either the domain or subdomain. * @returns A boolean indicating if the fragment is a valid fragment. * @group Implementation */ export declare function isValidANSSegment(fragment: string): boolean; /** * Checks if an ANS name is valid or not. * * @param name - A string of the domain name, which can include or exclude the .apt suffix. * @group Implementation */ export declare function isValidANSName(name: string): { domainName: string; subdomainName?: string; }; /** * Determines the status of an ANS name's expiration. * * @param name - An ANS name returned from one of the functions of the SDK. * @param gracePeriod - grace period after expiration * @returns An ExpirationStatus indicating whether the name is Active, InGracePeriod, or Expired. * @group Implementation */ export declare function getANSExpirationStatus({ name, gracePeriod, }: { name: RawANSName; aptosConfig: AptosConfig; gracePeriod: number; }): ExpirationStatus; export declare const LOCAL_ANS_ACCOUNT_PK: string; export declare const LOCAL_ANS_ACCOUNT_ADDRESS: string; /** * Retrieve the owner address of a specified domain or subdomain. * * @param args - The arguments for retrieving the owner address. * @param args.aptosConfig - The Aptos configuration object. * @param args.name - The name of the domain or subdomain to query. * @returns The account address of the owner, or undefined if not found. * @group Implementation */ export declare function getOwnerAddress(args: { aptosConfig: AptosConfig; name: string; }): Promise; /** * 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 */ export 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; } /** * Registers a domain or subdomain with the specified parameters. This function ensures that the provided names and expiration * policies are valid before proceeding with the registration process. * * @param args - The parameters required for registering a name. * @param args.aptosConfig - The configuration settings for Aptos. * @param args.expiration - The expiration details for the registration. * @param args.name - The name to be registered, which can be a domain or subdomain. * @param args.sender - The account details of the sender initiating the registration. * @param args.targetAddress - The target address for the registration, which is the address the name will resolve to. * @param args.toAddress - The address that will be set as the owner_address in records, defaults to sender if not provided. * @param args.options - Additional options for the registration process. * @param args.transferable - Indicates whether the registered name is transferable to another account. * * @throws Error if the provided expiration policy is invalid for subdomains. * @throws Error if the domain does not exist. * @throws Error if the subdomain expiration time exceeds the domain expiration time. * * @returns A transaction object representing the registration process. * @group Implementation */ export declare function registerName(args: RegisterNameParameters): Promise<{ transaction: SimpleTransaction; data: InputEntryFunctionData; }>; /** * Retrieves the expiration time of a specified domain or subdomain in epoch milliseconds. * * @param args - The arguments for the function. * @param args.aptosConfig - The configuration object for Aptos. * @param args.name - The name of the domain or subdomain to check. * @returns The expiration time in epoch milliseconds, or undefined if an error occurs. * @group Implementation */ export declare function getExpiration(args: { aptosConfig: AptosConfig; name: string; }): Promise; /** * Retrieves the primary name associated with a given account address. * This function helps in obtaining the complete domain name by combining the subdomain and domain names. * * @param args - The arguments for retrieving the primary name. * @param args.aptosConfig - The Aptos configuration object. * @param args.address - The account address for which to retrieve the primary name. * @returns The primary name as a string, or undefined if no domain name exists. * @group Implementation */ export declare function getPrimaryName(args: { aptosConfig: AptosConfig; address: AccountAddressInput; }): Promise; /** * Sets the primary name for the specified account, allowing for the association of a domain or subdomain with the account. * If no name is provided, it clears the existing primary name. * * @param args - The arguments for setting the primary name. * @param args.aptosConfig - The Aptos configuration object. * @param args.sender - The account that is sending the transaction. * @param args.name - The name to set as the primary name. If omitted, the function will clear the primary name. * @param args.options - Optional transaction generation options. * @returns A transaction object representing the operation. * @group Implementation */ export declare function setPrimaryName(args: { aptosConfig: AptosConfig; sender: AccountAddressInput; name?: string; options?: InputGenerateTransactionOptions; }): Promise<{ transaction: SimpleTransaction; data: InputEntryFunctionData; }>; /** * Retrieves the target address associated with a given domain name and subdomain name. * The target address is different from the owner address - it's the address this name * resolves to, which may be different from who owns the name. * * @param args - The arguments for retrieving the target address. * @param args.aptosConfig - The Aptos configuration object. * @param args.name - The name of the domain, which may include a subdomain. * @returns The target address as an AccountAddress, or undefined if not found. * @group Implementation */ export declare function getTargetAddress(args: { aptosConfig: AptosConfig; name: string; }): Promise; /** * Sets the target address for a specified domain and subdomain in the Aptos network. * This function helps to associate a given address with a domain name, allowing for easier access and management of resources. * * @param args - The arguments for setting the target address. * @param args.aptosConfig - The configuration settings for the Aptos network. * @param args.sender - The account that is sending the transaction. * @param args.name - The name of the domain or subdomain to be set. * @param args.address - The address to be associated with the domain or subdomain. * @param args.options - Optional parameters for generating the transaction. * * @returns A transaction object representing the set target address operation. * @group Implementation */ export declare function setTargetAddress(args: { aptosConfig: AptosConfig; sender: AccountAddressInput; name: string; address: AccountAddressInput; options?: InputGenerateTransactionOptions; }): Promise<{ transaction: SimpleTransaction; data: InputEntryFunctionData; }>; /** * Clears the target address for a specified domain and subdomain in the Aptos network. * This function removes the target address association, effectively clearing where the name resolves to. * * @param args - The arguments for clearing the target address. * @param args.aptosConfig - The configuration settings for the Aptos network. * @param args.sender - The account that is sending the transaction. * @param args.name - The name of the domain or subdomain to clear the target address for. * @param args.options - Optional parameters for generating the transaction. * * @returns A transaction object representing the clear target address operation. * @group Implementation */ export declare function clearTargetAddress(args: { aptosConfig: AptosConfig; sender: AccountAddressInput; name: string; options?: InputGenerateTransactionOptions; }): Promise<{ transaction: SimpleTransaction; data: InputEntryFunctionData; }>; /** * Retrieves the active Aptos name associated with the specified domain and subdomain. * * @param args - The parameters for the function. * @param args.aptosConfig - The configuration object for Aptos. * @param args.name - The name to look up, which includes the domain and optional subdomain. * @returns The active Aptos name if it exists; otherwise, returns undefined. * @group Implementation */ export declare function getName(args: { aptosConfig: AptosConfig; name: string; }): Promise; /** * 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 */ export interface GetAccountNamesArgs extends QueryNamesOptions { accountAddress: AccountAddressInput; } /** * Retrieves all the current Aptos names owned by an account. This uses the * owner_address field, not the registered_address field. * * @param args - The arguments for retrieving account names. * @param args.aptosConfig - The configuration object for Aptos. * @param args.options - Optional parameters for querying account names. * @param args.options.limit - The maximum number of names to retrieve. * @param args.options.offset - The number of names to skip before starting to collect the result set. * @param args.options.orderBy - The field by which to order the results. * @param args.options.where - Additional conditions to filter the results. * @param args.accountAddress - The address of the account for which to retrieve names. * * @returns An array of sanitized Aptos names associated with the specified account address. * @group Implementation */ export declare function getAccountNames(args: { aptosConfig: AptosConfig; } & GetAccountNamesArgs): Promise<{ names: AnsName[]; total: number; }>; /** * Arguments for retrieving the domains associated with a specific account. * * @param accountAddress - The address of the account for which to fetch domains. * @group Implementation */ export interface GetAccountDomainsArgs extends QueryNamesOptions { accountAddress: AccountAddressInput; } /** * Retrieves the list of top-level domains owned by a specified account, * using the owner_address field. * * @param args - The arguments for retrieving account domains. * @param args.aptosConfig - The Aptos configuration object. * @param args.options - Optional parameters for the query. * @param args.options.limit - The maximum number of results to return. * @param args.options.offset - The number of results to skip before starting to collect the result set. * @param args.options.orderBy - The field by which to order the results. * @param args.options.where - Additional conditions to filter the results. * @param args.options.where.owner_address - The address of the account whose domains are being queried. * @param args.options.where.expiration_timestamp - The minimum expiration timestamp for the domains. * @param args.options.where.subdomain - The specific subdomain to filter by. * * @returns An array of sanitized domain names owned by the specified account. * @group Implementation */ export declare function getAccountDomains(args: { aptosConfig: AptosConfig; } & GetAccountDomainsArgs): Promise<{ names: AnsName[]; total: number; }>; /** * Arguments for retrieving subdomains associated with a specific account. * * @param accountAddress - The address of the account for which to fetch subdomains. * @group Implementation */ export interface GetAccountSubdomainsArgs extends QueryNamesOptions { accountAddress: AccountAddressInput; } /** * Retrieves a list of subdomains owned by a specified account address, determined * by the owner_address field. * * @param args - The arguments for retrieving account subdomains. * @param args.aptosConfig - The configuration object for Aptos. * @param args.options - Optional parameters for the query. * @param args.options.limit - The maximum number of results to return. * @param args.options.offset - The number of results to skip before starting to collect the result set. * @param args.options.orderBy - The field by which to order the results. * @param args.options.where - Additional conditions to filter the results. * @param args.options.where.owner_address - The address of the account to filter by. * @param args.options.where.expiration_timestamp - The expiration timestamp to filter by. * @param args.options.where.subdomain - The subdomain condition to filter by. * @param args.accountAddress - The address of the account whose subdomains are being queried. * @group Implementation */ export declare function getAccountSubdomains(args: { aptosConfig: AptosConfig; } & GetAccountSubdomainsArgs): Promise<{ names: AnsName[]; total: number; }>; /** * Arguments for retrieving subdomains associated with a specific domain. * * @param domain - The domain for which to fetch subdomains. * @group Implementation */ export interface GetDomainSubdomainsArgs extends QueryNamesOptions { domain: string; } /** * Retrieve the active subdomains associated with a specified domain, * regardless of who is in possession of the domain. * * This function queries by domain name only, not by owner, so it will return * all subdomains of a domain even if they're owned by different accounts. * * @param args - The arguments for retrieving subdomains. * @param args.aptosConfig - The configuration settings for Aptos. * @param args.options - Optional parameters for the query. * @param args.options.limit - The maximum number of results to return. * @param args.options.offset - The number of results to skip before starting to collect the results. * @param args.options.orderBy - The field by which to order the results. * @param args.options.where - Additional conditions to filter the results. * @param args.domain - The domain for which to retrieve subdomains. * * @returns An array of active subdomain names. * @group Implementation */ export declare function getDomainSubdomains(args: { aptosConfig: AptosConfig; } & GetDomainSubdomainsArgs): Promise<{ names: AnsName[]; total: number; }>; /** * This function returns the grace period in seconds as defined by the contract. * A name that is past expiration but within the grace period is considered in * grace period and can't be claimed by others. * * @param args - The arguments for the function. * @param args.aptosConfig - An AptosConfig object containing the configuration settings. * @returns The grace period in seconds. * @group Implementation */ export declare function getANSGracePeriod(args: { aptosConfig: AptosConfig; }): Promise; /** * Renews a domain for a specified duration. This function allows you to extend the registration of a domain for one year. * * @param args - The parameters required to renew the domain. * @param args.aptosConfig - The configuration settings for Aptos. * @param args.sender - The account that is sending the renewal transaction. * @param args.name - The name of the domain to renew. * @param args.years - The number of years to renew the domain for. Currently, only 1 year renewals are supported. (optional, default is 1) * @param args.options - Additional options for generating the transaction. (optional) * @throws Error if the name contains a subdomain or if the years parameter is not equal to 1. * @group Implementation */ export declare function renewDomain(args: { aptosConfig: AptosConfig; sender: AccountAddressInput; name: string; years?: 1; options?: InputGenerateTransactionOptions; }): Promise<{ transaction: SimpleTransaction; data: InputEntryFunctionData; }>; export {}; //# sourceMappingURL=ans.d.ts.map