Skip to content

Commit

Permalink
fix: use stacks_node_rpc_url from config (#579)
Browse files Browse the repository at this point in the history
  • Loading branch information
MicaiahReid authored May 30, 2024
1 parent f523ba0 commit 75a7278
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ jobs:
event-type: released
client-payload: '{"tag": "${{ needs.get_release_info.outputs.tag }}"}'


build-publish:
runs-on: ubuntu-latest
needs:
Expand Down
16 changes: 9 additions & 7 deletions components/chainhook-sdk/src/observer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use chainhook_types::{
BitcoinBlockData, BitcoinBlockSignaling, BitcoinChainEvent, BitcoinChainUpdatedWithBlocksData,
BitcoinChainUpdatedWithReorgData, BitcoinNetwork, BlockIdentifier, BlockchainEvent,
StacksBlockData, StacksChainEvent, StacksNetwork, StacksNodeConfig, TransactionIdentifier,
DEFAULT_STACKS_NODE_RPC,
};
use hiro_system_kit;
use hiro_system_kit::slog;
Expand Down Expand Up @@ -176,13 +177,14 @@ impl EventObserverConfig {
bitcoin_block_signaling: overrides
.and_then(|c| c.bitcoind_zmq_url.as_ref())
.map(|url| BitcoinBlockSignaling::ZeroMQ(url.clone()))
.unwrap_or(BitcoinBlockSignaling::Stacks(
StacksNodeConfig::default_localhost(
overrides
.and_then(|c| c.ingestion_port)
.unwrap_or(DEFAULT_INGESTION_PORT),
),
)),
.unwrap_or(BitcoinBlockSignaling::Stacks(StacksNodeConfig::new(
overrides
.and_then(|c| c.stacks_node_rpc_url.clone())
.unwrap_or(DEFAULT_STACKS_NODE_RPC.to_string()),
overrides
.and_then(|c| c.ingestion_port)
.unwrap_or(DEFAULT_INGESTION_PORT),
))),
display_logs: overrides.and_then(|c| c.display_logs).unwrap_or(false),
cache_path: overrides
.and_then(|c| c.cache_path.clone())
Expand Down
2 changes: 2 additions & 0 deletions components/chainhook-types-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ pub use ordinals::*;
pub use processors::*;
pub use rosetta::*;

pub const DEFAULT_STACKS_NODE_RPC: &str = "http://localhost:20443";

pub enum Chain {
Bitcoin,
Stacks,
Expand Down
11 changes: 9 additions & 2 deletions components/chainhook-types-rs/src/rosetta.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::bitcoin::{TxIn, TxOut};
use crate::contract_interface::ContractInterface;
use crate::ordinals::OrdinalOperation;
use crate::{events::*, Brc20Operation};
use crate::{events::*, Brc20Operation, DEFAULT_STACKS_NODE_RPC};
use schemars::JsonSchema;
use std::cmp::Ordering;
use std::collections::HashSet;
Expand Down Expand Up @@ -870,9 +870,16 @@ pub struct StacksNodeConfig {
}

impl StacksNodeConfig {
pub fn new(rpc_url: String, ingestion_port: u16) -> StacksNodeConfig {
StacksNodeConfig {
rpc_url,
ingestion_port,
}
}

pub fn default_localhost(ingestion_port: u16) -> StacksNodeConfig {
StacksNodeConfig {
rpc_url: "http://localhost:20443".to_string(),
rpc_url: DEFAULT_STACKS_NODE_RPC.to_string(),
ingestion_port,
}
}
Expand Down

0 comments on commit 75a7278

Please sign in to comment.