rosetta_config_ethereum/
lib.rs1use anyhow::Result;
2use rosetta_core::crypto::address::AddressFormat;
3use rosetta_core::crypto::Algorithm;
4use rosetta_core::BlockchainConfig;
5use serde::{Deserialize, Serialize};
6use std::sync::Arc;
7
8pub fn config(network: &str) -> Result<BlockchainConfig> {
9 anyhow::ensure!(network == "dev");
10 Ok(BlockchainConfig {
11 blockchain: "ethereum",
12 network: "dev",
13 algorithm: Algorithm::EcdsaRecoverableSecp256k1,
14 address_format: AddressFormat::Eip55,
15 coin: 1,
16 bip44: true,
17 utxo: false,
18 currency_unit: "wei",
19 currency_symbol: "ETH",
20 currency_decimals: 18,
21 node_port: 8545,
22 node_image: "ethereum/client-go:v1.10.26",
23 node_command: Arc::new(|_network, port| {
24 vec![
25 "--dev".into(),
26 "--ipcdisable".into(),
27 "--http".into(),
28 "--http.addr=0.0.0.0".into(),
29 format!("--http.port={port}"),
30 "--http.vhosts=*".into(),
31 "--http.api=eth,debug,admin,txpool,web3".into(),
32 ]
33 }),
34 node_additional_ports: &[],
35 connector_port: 8081,
36 testnet: network == "dev",
37 })
38}
39
40#[derive(Clone, Debug, Deserialize, Serialize)]
41pub struct EthereumMetadataParams {
42 pub destination: Vec<u8>,
43 pub amount: [u64; 4],
44 pub data: Vec<u8>,
45}
46
47#[derive(Debug, Deserialize, Serialize)]
48pub struct EthereumMetadata {
49 pub chain_id: u64,
50 pub nonce: u64,
51 pub max_priority_fee_per_gas: [u64; 4],
52 pub max_fee_per_gas: [u64; 4],
53 pub gas_limit: [u64; 4],
54}