Raindex SDK Documentation
    Preparing search index...

    Class OrderbookYaml

    Index

    Properties

    cache: Cache
    documents: string[]

    Methods

    • Returns void

    • Retrieves orderbook configuration by its contract address from a parsed YAML configuration.

      This function looks up a specific orderbook configuration within a YAML configuration file using the orderbook's blockchain address. It's essential for accessing orderbook metadata including network configuration, subgraph endpoints, and other deployment details.

      // Basic usage
      const result = orderbookYaml.getOrderbookByAddress("0x1234567890abcdef1234567890abcdef12345678");
      if (result.error) {
      console.error("Error:", result.error.readableMsg);
      return;
      }
      const orderbook = result.value;
      // Do something with the orderbook

      Parameters

      • orderbook_address: string

        The hexadecimal address of the orderbook contract

      Returns WasmEncodedResult<OrderbookCfg>

      Complete orderbook configuration

    • Creates a new OrderbookYaml instance from YAML configuration sources.

      This constructor parses one or more YAML configuration strings to create an OrderbookYaml instance that provides access to orderbook configurations, network settings, tokens, and other deployment metadata. The YAML sources are merged and validated according to the orderbook specification.

      // Basic usage with single YAML source
      const yamlConfig = `
      version: "4"
      networks:
      mainnet:
      rpc: https://mainnet.infura.io
      chain-id: 1
      orderbooks:
      my-orderbook:
      address: 0x1234567890abcdef1234567890abcdef12345678
      network: mainnet
      ...
      `;

      const result = OrderbookYaml.new([yamlConfig], false);
      if (result.error) {
      console.error("Configuration error:", result.error.readableMsg);
      return;
      }
      const orderbookYaml = result.value;
      // Do something with the orderbookYaml

      Parameters

      • sources: string[]

        Vector of YAML configuration strings to parse and merge

      • Optionalvalidate: null | boolean

        Optional boolean to enable strict validation (defaults to false)

      Returns WasmEncodedResult<OrderbookYaml>

      Successfully parsed and configured instance