#
Constructing a Wax interface
The root Wax interface can be constructed using either default or custom configuration options. Custom options allow selecting a specific blockchain network (e.g. mainnet, testnet, or mirrornet), a specific Hive API endpoint (e.g. api.hive.blog) and also a custom REST API endpoint. It also provides settings to optimize for performance, network latency, or other custom needs.
#
Default Wax initialization
Test it yourself: src/typescript/config/init-general/chain.ts
import { createHiveChain } from '@hiveio/wax';
// Initialize Hive Chain using default options
await createHiveChain();
Test it yourself on github codespace: src/python/default_wax_initialization.py
from wax import WaxChainOptions, WaxOptions, create_hive_chain, create_wax_foundation
wax = create_wax_foundation()
wax_custom_options = create_wax_foundation(
options=WaxOptions(chain_id="f875a0b000000000000000000000000000000000000000000000000000000000")
)
#
Initializing Wax interface with custom options
Test it yourself: src/typescript/config/init-general/chain-with-config.ts
import { createHiveChain, IWaxOptionsChain } from '@hiveio/wax';
// Define custom options
const customOptions: IWaxOptionsChain = {
// Example custom chain ID:
chainId: 'f875a0b000000000000000000000000000000000000000000000000000000000',
// Example custom API endpoint:
apiEndpoint: 'https://hive.custom.endpoint',
// Example custom REST API endpoint:
restApiEndpoint: 'https://rest.api.custom.endpoint',
// Disable API timeout:
apiTimeout: 0
};
// Initialize Hive Chain with custom options
const chain = await createHiveChain(customOptions);
Test it yourself on github codespace: src/python/default_wax_initialization.py
from wax import WaxChainOptions, WaxOptions, create_hive_chain, create_wax_foundation
wax_chain = create_hive_chain(
options=WaxChainOptions(
chain_id="beeab0de00000000000000000000000000000000000000000000000000000000", # mainnet chain ID
endpoint_url="https://api.hive.blog", # public mainnet API node
)
)