defaults
This commit is contained in:
parent
a3098d52c1
commit
50d082c944
11
src/main.rs
11
src/main.rs
@ -1,15 +1,20 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use warp::Filter;
|
use warp::Filter;
|
||||||
|
|
||||||
|
|
||||||
|
const ETH_LOCALHOST_RPC: &str = "http://localhost:8545";
|
||||||
|
const ETH_EDEN_RPC: &str = "https://api.edennetwork.io/v1/beta";
|
||||||
|
|
||||||
|
|
||||||
#[derive(argh::FromArgs)]
|
#[derive(argh::FromArgs)]
|
||||||
/// Proxy Web3 Requests
|
/// Proxy Web3 Requests
|
||||||
struct Web3ProxyConfig {
|
struct Web3ProxyConfig {
|
||||||
/// the primary Ethereum RPC server
|
/// the primary Ethereum RPC server
|
||||||
#[argh(option, default = "http://localhost:8545")]
|
#[argh(option, default = "ETH_LOCALHOST_RPC.to_string()")]
|
||||||
eth_primary_rpc: String,
|
eth_primary_rpc: String,
|
||||||
|
|
||||||
/// the private Ethereum RPC server
|
/// the private Ethereum RPC server
|
||||||
#[argh(option, default = "https://api.edennetwork.io/v1/beta")]
|
#[argh(option, default = "ETH_EDEN_RPC.to_string()")]
|
||||||
eth_private_rpc: String,
|
eth_private_rpc: String,
|
||||||
|
|
||||||
/// the port to listen on
|
/// the port to listen on
|
||||||
@ -51,10 +56,8 @@ async fn proxy_eth_rpc(
|
|||||||
serde_json::Value::String("eth_sendSignedTransaction".to_string());
|
serde_json::Value::String("eth_sendSignedTransaction".to_string());
|
||||||
|
|
||||||
let upstream_server = if json_body.get("method") == Some(ð_send_signed_transaction) {
|
let upstream_server = if json_body.get("method") == Some(ð_send_signed_transaction) {
|
||||||
// TODO: read from args
|
|
||||||
&config.eth_private_rpc
|
&config.eth_private_rpc
|
||||||
} else {
|
} else {
|
||||||
// TODO: read from args
|
|
||||||
// TODO: if querying a block older than 256 blocks old, send to an archive node. otherwise a fast sync node is fine
|
// TODO: if querying a block older than 256 blocks old, send to an archive node. otherwise a fast sync node is fine
|
||||||
&config.eth_primary_rpc
|
&config.eth_primary_rpc
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user