import { Network, AptosConfig, Aptos, AccountAddress, Ed25519PrivateKey, Ed25519Account } from "@aptos-labs/ts-sdk"; export declare enum AptosProviderType { APTOS = "APTOS", ALCHEMY = "ALCHEMY" } /** * Configuration interface for the AptosProvider. * * @interface AptosProviderConfig * * @property {Network} network - The network configuration for the AptosProvider. * @property {AptosProviderType} providerType - The provider type (e.g., APTOS, ALCHEMY). * @property {string} apiKey - The API key for the provider. * @property {Object} addresses - The contract addresses used by the AptosProvider. * @property {string} addresses.UNDERLYING_TOKENS - The address for underlying tokens. * @property {string} addresses.AAVE_ACL - The address for AAVE ACL. * @property {string} addresses.AAVE_CONFIG - The address for AAVE configuration. * @property {string} addresses.AAVE_ORACLE - The address for AAVE oracle. * @property {string} addresses.AAVE_POOL - The address for AAVE pool. * @property {string} addresses.AAVE_DATA - The address for AAVE data. * @property {string} addresses.AAVE_MATH - The address for AAVE math. */ export interface AptosProviderConfig { network: Network; providerType: AptosProviderType; apiKey?: string; addresses: { AAVE_MOCK_UNDERLYINGS: AccountAddress; AAVE_ACL: AccountAddress; AAVE_CONFIG: AccountAddress; AAVE_ORACLE: AccountAddress; AAVE_POOL: AccountAddress; AAVE_DATA: AccountAddress; AAVE_MATH: AccountAddress; }; assets: { APT: AccountAddress; USDC: AccountAddress; USDT: AccountAddress; sUSDe: AccountAddress; GHO: AccountAddress; }; } /** * Configuration interface for an Aptos account. * * @interface AptosAccountConfig * * @property {string} network - The network to which the account belongs (e.g., mainnet, testnet). * @property {string} private_key - The private key associated with the account. * @property {string} public_key - The public key associated with the account. * @property {string} account - The account address. * @property {string} rest_url - The REST API URL for interacting with the Aptos blockchain. * @property {string} faucet_url - The URL for the faucet service to fund the account with test tokens. */ export interface AptosAccountConfig { network: string; private_key: string; public_key: string; account: string; rest_url: string; faucet_url: string; } export declare enum AAVE_PROFILES { AAVE_MOCK_UNDERLYINGS = "aave_mock_underlyings", AAVE_ACL = "aave_acl", AAVE_CONFIG = "aave_config", AAVE_ORACLE = "aave_oracle", AAVE_POOL = "aave_pool", AAVE_LARGE_PACKAGES = "aave_large_packages", AAVE_MATH = "aave_math", AAVE_DATA = "aave_data", AAVE_DATA_FEEDS = "data_feeds", AAVE_PLATFORM = "platform", DEFAULT_FUNDER = "default", TEST_ACCOUNT_0 = "test_account_0", TEST_ACCOUNT_1 = "test_account_1", TEST_ACCOUNT_2 = "test_account_2", TEST_ACCOUNT_3 = "test_account_3", TEST_ACCOUNT_4 = "test_account_4", TEST_ACCOUNT_5 = "test_account_5" } /** * The `AptosProvider` class is responsible for managing the configuration and profiles * for interacting with the Aptos blockchain. It allows setting up network configurations, * adding profile addresses and accounts, and initializing the Aptos instance. * * @class */ export declare class AptosProvider { private network; private profileAddressMap; private profileAccountMap; private aptos; private aptosProviderType; private constructor(); private static buildAptosConfig; /** * Sets the network for the Aptos provider. * * @param network - The network to set, represented by the `Network` type. */ setNetwork(network: Network): void; /** * Adds a profile address to the profile address map. * * @param aptosProviderType - The provider type to set. */ setProviderType(aptosProviderType: AptosProviderType): void; /** * Gets the provider type for the Aptos provider. * * @param profileName - The name of the profile to associate with the address. * @param address - The account address to be added. */ addProfileAddress(profileName: string, address: AccountAddress): void; /** * Adds a profile account to the profile account map. * * @param profileName - The name of the profile to associate with the account. * @param account - The Ed25519 private key of the account to add. */ addProfileAccount(profileName: string, account: Ed25519PrivateKey): void; /** * Sets the Aptos configuration for the client. * * @param aptosConfig - The configuration object for Aptos. */ setAptos(aptosConfig: AptosConfig): void; /** * Creates an instance of `AptosProvider` from the given configuration. * * @param config - The configuration object for the `AptosProvider`. * @returns A new instance of `AptosProvider` configured with the provided settings. * * @example * ```typescript * const config: AptosProviderConfig = { * network: 'mainnet', * addresses: { * AAVE_MOCK_UNDERLYINGS: '0x...', * AAVE_ACL: '0x...', * AAVE_CONFIG: '0x...', * AAVE_ORACLE: '0x...', * AAVE_POOL: '0x...', * AAVE_DATA: '0x...' * } * }; * const aptosProvider = AptosProvider.fromConfig(config); * ``` */ static fromConfig(config: AptosProviderConfig): AptosProvider; /** * Creates an instance of `AptosProvider` by reading configuration from environment variables. * * @throws {Error} If any required environment variable is missing or if an unknown network is specified. * * @returns {AptosProvider} The configured `AptosProvider` instance. * * Environment Variables: * - `APTOS_NETWORK`: The network to connect to (testnet, devnet, mainnet, local). * - `AAVE_MOCK_UNDERLYING_TOKENS_PRIVATE_KEY`: Private key for UNDERLYING_TOKENS profile. * - `AAVE_ACL_PRIVATE_KEY`: Private key for AAVE_ACL profile. * - `AAVE_CONFIG_PRIVATE_KEY`: Private key for AAVE_CONFIG profile. * - `AAVE_ORACLE_PRIVATE_KEY`: Private key for AAVE_ORACLE profile. * - `AAVE_POOL_PRIVATE_KEY`: Private key for AAVE_POOL profile. * - `AAVE_LARGE_PACKAGES_PRIVATE_KEY`: Private key for AAVE_LARGE_PACKAGES profile. * - `AAVE_MATH_PRIVATE_KEY`: Private key for AAVE_MATH profile. * - `AAVE_DATA_PRIVATE_KEY`: Private key for AAVE_DATA profile. * - `DEFAULT_FUNDER_PRIVATE_KEY`: Private key for DEFAULT_FUNDER profile. * - `TEST_ACCOUNT_0_PRIVATE_KEY`: Private key for TEST_ACCOUNT_0 profile. * - `TEST_ACCOUNT_1_PRIVATE_KEY`: Private key for TEST_ACCOUNT_1 profile. * - `TEST_ACCOUNT_2_PRIVATE_KEY`: Private key for TEST_ACCOUNT_2 profile. * - `TEST_ACCOUNT_3_PRIVATE_KEY`: Private key for TEST_ACCOUNT_3 profile. * - `TEST_ACCOUNT_4_PRIVATE_KEY`: Private key for TEST_ACCOUNT_4 profile. * - `TEST_ACCOUNT_5_PRIVATE_KEY`: Private key for TEST_ACCOUNT_5 profile. */ static fromEnvs(): AptosProvider; /** * Creates an instance of `AptosProvider` from a YAML string. * * This method parses the provided YAML string to extract profile configurations, * sets the network for the `AptosProvider` based on the profile's network configuration, * and adds profile accounts and addresses to the provider. * * @param aptosYaml - The YAML string containing the Aptos profile configurations. * @returns An instance of `AptosProvider` configured based on the provided YAML. * @throws Will throw an error if an unknown network is specified in the profile configuration. */ static fromAptosYaml(aptosYaml: string, providerType?: AptosProviderType, apiKey?: string): AptosProvider; /** * Retrieves the Aptos instance used for transactions. * * @returns {Aptos} The Aptos instance. */ getAptos(): Aptos; /** * Retrieves the private key associated with a given profile name. * * @param profileName - The name of the profile whose private key is to be retrieved. * @returns The Ed25519 private key associated with the specified profile name. * @throws Will throw an error if the profile name is not found in the profiles map. */ getProfileAccountPrivateKeyByName(profileName: string): Ed25519PrivateKey; /** * Retrieves the profile account associated with the given profile name. * * @param profileName - The name of the profile whose account is to be retrieved. * @returns An instance of `Ed25519Account` if the profile account exists, otherwise `undefined`. */ getProfileAccountByName(profileName: string): Ed25519Account; /** * Retrieves the account address associated with the given profile name. * * @param profileName - The name of the profile whose account address is to be retrieved. * @returns The account address associated with the given profile name. * @throws Will throw an error if the profile name does not exist in the profile address map. */ getProfileAddressByName(profileName: string): AccountAddress; /** * Retrieves the Oracle profile account. * * This method returns an `Ed25519Account` instance associated with the * AAVE Oracle profile. It internally calls `getProfileAccountByName` * with the `AAVE_ORACLE` profile name to fetch the account details. * * @returns {Ed25519Account} The Oracle profile account. */ getOracleProfileAccount(): Ed25519Account; /** * Retrieves the Ed25519 account associated with the AAVE pool profile. * * @returns {Ed25519Account} The Ed25519 account for the AAVE pool profile. */ getPoolProfileAccount(): Ed25519Account; /** * Retrieves the profile account associated with underlying tokens. * * @returns {Ed25519Account} The profile account for underlying tokens. */ getUnderlyingTokensProfileAccount(): Ed25519Account; /** * Retrieves the ACL (Access Control List) profile account. * * @returns {Ed25519Account} The ACL profile account. */ getAclProfileAccount(): Ed25519Account; /** * Retrieves the data profile account associated with the AAVE_DATA profile. * * @returns {Ed25519Account} The Ed25519 account corresponding to the AAVE_DATA profile. */ getDataProfileAccount(): Ed25519Account; /** * Retrieves the current network configuration. * * @returns {Network} The network configuration. */ getNetwork(): Network; }