Skip to main content

Aeon Client

The Aeon Client provides allows to interact with the Aeon smart contracts on Sui. This includes fetching of required parameters, gas sponsoring and simulating transactions across multiple blockchain networks. Using the AeonClient, you can synchronously queue various transaction operations. The AeonClient.build() method then asynchronously executes required fetches for each operation and assembles a final transaction block (TXB).

Core Components and Flow

The typical workflow involves initializing the client, queuing one or more operations, building the transaction payload, and finally signing it. This process is designed to be flexible, allowing you to chain multiple simulation or preparation calls together before committing to the build step.
  1. Initialize AeonClient: Create an instance of AeonClient. You can configure it with your self-hosted Aeon backend endpoint and the sui network type.
    const client = new AeonClient({
      simulationUrl: "https://your-backend.com/",
      /*, suiNetwork: 'mainnet' */ // Example: Default network for Sui operations
    });
    
  2. Queue Simulation or Preparation Operations: Use the client.simulate("chain-type", {...params}) method for transaction simulations or client.prepareSigning({...params}) for preparing transactions for signing. These methods are synchronous and designed to be chainable. Each call adds an operation to an internal queue within the AeonClient instance and returns the client itself, allowing you to link multiple calls fluently. Chaining Example:
    client
      .simulate("evm", {
        /* EVM params */
      })
      .simulate("sui", {
        /* Sui params */
      })
      .prepareSigning({
        /* Preparation params for another transaction */
      });
    
  3. Build and Process: Call await client.build(). This asynchronous method takes all the queued operations and:
    • Sends requests to the configured simulation URL for each queued simulation operation. For prepare signing, gas info and other chain specific parameters are fetched.
    • Collects the results (e.g., simulation outcomes like balance changes, gas estimates, or prepared transaction data) from the backend.
    • Assembles a final transaction block (TXB), a batch of transactions, based on these results.
  4. Sign with AeonSigner: The result from client.build() (which contains the assembled transaction data or signable payloads) is then passed to the appropriate methods of AeonSigner for cryptographic signing.
Refer to each specific transaction type page (for simulations) or the prepareSigning page (for preparation operations) for detailed parameters for the respective client methods.