Raindex SDK Documentation
    Preparing search index...

    Class RaindexYaml

    Index

    Properties

    cache: Cache
    documents: string[]

    Methods

    • Returns void

    • Returns void

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

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

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

      Parameters

      • raindex_address: string

        The hexadecimal address of the raindex contract

      Returns WasmEncodedResult<RaindexCfg>

      Complete raindex configuration

    • Retrieves all tokens from the YAML configuration, including remote tokens.

      This async function fetches all tokens defined in the YAML configuration. If using-tokens-from URLs are configured, it will fetch and merge remote tokens from those URLs before returning the complete token list.

      const result = await raindexYaml.getTokens();
      if (result.error) {
      console.error("Error:", result.error.readableMsg);
      return;
      }
      const tokens = result.value;
      // Each token has: key, address, decimals, name, symbol, chainId
      tokens.forEach(token => {
      console.log(`${token.symbol} on chain ${token.chainId}`);
      });

      Returns Promise<WasmEncodedResult<ExtendedTokenInfo[]>>

      Array of token information

    • Creates a new RaindexYaml instance from YAML configuration sources.

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

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

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

      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<RaindexYaml>

      Successfully parsed and configured instance