Closed generalzzd closed 1 month ago
Hi @generalzzd ,
The url_prefix
and aerial_url
parameters in the ValidatorConfig
are used for configuring the connection to the dYdX chain.
aerial_url
: This typically matches the validator endpoint. Its purpose is to specify the URL for the Aerial API.url_prefix
: either grpc
or rest
from dydx4.clients import ValidatorClient
from dydx4.network import Network, ValidatorConfig, IndexerConfig
net = Network(
env='mainnet',
validator_config=ValidatorConfig(
grpc_endpoint='dydx-grpc.publicnode.com:443',
chain_id='dydx-mainnet-1',
ssl_enabled=True,
aerial_config_url='https://dydx-grpc.publicnode.com:443',
aerial_grpc_or_rest_prefix="grpc"
),
indexer_config=IndexerConfig(
rest_endpoint='https://indexer.dydx.trade/',
websocket_endpoint='wss://indexer.dydx.trade/v4/ws',
),
)
wallet = ValidatorClient(net.validator_config)
In this example, aerial_config_url
is set to the same value as grpc_endpoint
. The aerial_grpc_or_rest_prefix
is set to "grpc" because we're using a gRPC endpoint. If you were using a REST endpoint, you would set this to "rest".
Here you have a working example: https://docs.dydx.exchange/api_integration-guides/setting_up_raspberry_pi_for_api_trading
I try to create a ValidatorClient, however, I find the newest api has two parameters of 'url_prefix' and 'aerial_url'. What is the usage of those two parameters? And could you please give us a example for mainnet connection? Thank you!