The hexadecimal address of the orderbook contract
Complete orderbook 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 orderbookYaml.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}`);
});
Array of token information
StaticgetCurrent spec version
StaticnewCreates 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
Vector of YAML configuration strings to parse and merge
Optionalvalidate: null | booleanOptional boolean to enable strict validation (defaults to false)
Successfully parsed and configured instance
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.
Examples