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.

Methods

  • Adds a profile account to the profile account map.

    Parameters

    • profileName: string

      The name of the profile to associate with the account.

    • account: Ed25519PrivateKey

      The Ed25519 private key of the account to add.

    Returns void

  • Adds a profile address to the profile address map.

    Parameters

    • profileName: string

      The name of the profile to associate with the address.

    • address: AccountAddress

      The account address to be added.

    Returns void

  • Retrieves the ACL (Access Control List) profile account.

    Returns Ed25519Account

    The ACL profile account.

  • Retrieves the profile account associated with AAVE A_TOKENS.

    Returns Ed25519Account

    The Ed25519 account corresponding to the A_TOKENS profile.

  • Retrieves the data profile account associated with the AAVE_DATA profile.

    Returns Ed25519Account

    The Ed25519 account corresponding to the AAVE_DATA profile.

  • Retrieves the current network configuration.

    Returns Network

    The network configuration.

  • 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.

  • Retrieves the Ed25519 account associated with the AAVE pool profile.

    Returns Ed25519Account

    The Ed25519 account for the AAVE pool profile.

  • Retrieves the profile account associated with the given profile name.

    Parameters

    • profileName: string

      The name of the profile whose account is to be retrieved.

    Returns Ed25519Account

    An instance of Ed25519Account if the profile account exists, otherwise undefined.

  • Retrieves the private key associated with a given profile name.

    Parameters

    • profileName: string

      The name of the profile whose private key is to be retrieved.

    Returns Ed25519PrivateKey

    The Ed25519 private key associated with the specified profile name.

    Will throw an error if the profile name is not found in the profiles map.

  • Retrieves the account address associated with the given profile name.

    Parameters

    • profileName: string

      The name of the profile whose account address is to be retrieved.

    Returns AccountAddress

    The account address associated with the given profile name.

    Will throw an error if the profile name does not exist in the profile address map.

  • Retrieves the profile account associated with underlying tokens.

    Returns Ed25519Account

    The profile account for underlying tokens.

  • Retrieves the profile account associated with variable tokens.

    Returns Ed25519Account

    The Ed25519 account corresponding to the variable tokens profile.

  • Sets the Aptos configuration for the client.

    Parameters

    • aptosConfig: AptosConfig

      The configuration object for Aptos.

    Returns void

  • Sets the network for the Aptos provider.

    Parameters

    • network: Network

      The network to set, represented by the Network type.

    Returns void

  • 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.

    Parameters

    • aptosYaml: string

      The YAML string containing the Aptos profile configurations.

    Returns AptosProvider

    An instance of AptosProvider configured based on the provided YAML.

    Will throw an error if an unknown network is specified in the profile configuration.

  • Creates an instance of AptosProvider from the given configuration.

    Parameters

    Returns AptosProvider

    A new instance of AptosProvider configured with the provided settings.

    const config: AptosProviderConfig = {
    network: 'mainnet',
    addresses: {
    A_TOKENS: '0x...',
    AAVE_MOCK_UNDERLYINGS: '0x...',
    VARIABLE_TOKENS: '0x...',
    AAVE_ACL: '0x...',
    AAVE_CONFIG: '0x...',
    AAVE_ORACLE: '0x...',
    AAVE_POOL: '0x...',
    AAVE_DATA: '0x...'
    }
    };
    const aptosProvider = AptosProvider.fromConfig(config);
  • Creates an instance of AptosProvider by reading configuration from environment variables.

    Returns AptosProvider

    The configured AptosProvider instance.

    Environment Variables:

    • APTOS_NETWORK: The network to connect to (testnet, devnet, mainnet, local).
    • A_TOKENS_PRIVATE_KEY: Private key for A_TOKENS profile.
    • AAVE_MOCK_UNDERLYING_TOKENS_PRIVATE_KEY: Private key for UNDERLYING_TOKENS profile.
    • VARIABLE_TOKENS_PRIVATE_KEY: Private key for VARIABLE_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.

    If any required environment variable is missing or if an unknown network is specified.