diff --git a/.github/workflows/ordhook-sdk-js.yml b/.github/workflows/ordhook-sdk-js.yml index 41126846..eeea3d4d 100644 --- a/.github/workflows/ordhook-sdk-js.yml +++ b/.github/workflows/ordhook-sdk-js.yml @@ -98,8 +98,6 @@ jobs: working-directory: ./components/ordhook-sdk-js steps: - uses: actions/checkout@v3 - - name: Change directory - working-directory: ./components/ordhook-sdk-js - name: Setup node uses: actions/setup-node@v3 if: ${{ !matrix.settings.docker }} diff --git a/components/ordhook-cli/src/cli/mod.rs b/components/ordhook-cli/src/cli/mod.rs index 3b498326..ec74769b 100644 --- a/components/ordhook-cli/src/cli/mod.rs +++ b/components/ordhook-cli/src/cli/mod.rs @@ -108,6 +108,9 @@ struct ScanBlocksCommand { /// HTTP Post activity to a URL #[clap(long = "post-to")] pub post_to: Option, + /// HTTP Auth token + #[clap(long = "auth-token")] + pub auth_token: Option, } #[derive(Parser, PartialEq, Clone, Debug)] @@ -284,6 +287,9 @@ struct StartCommand { /// Block height where ordhook will start posting Ordinals activities #[clap(long = "start-at-block")] pub start_at_block: Option, + /// HTTP Auth token + #[clap(long = "auth-token")] + pub auth_token: Option, } #[derive(Subcommand, PartialEq, Clone, Debug)] @@ -499,6 +505,7 @@ async fn handle_command(opts: Opts, ctx: &Context) -> Result<(), String> { &post_to, cmd.start_block, Some(cmd.end_block), + cmd.auth_token )? .into_selected_network_specification(&config.network.bitcoin_network)?; scan_bitcoin_chainstate_via_rpc_using_predicate( @@ -640,7 +647,7 @@ async fn handle_command(opts: Opts, ctx: &Context) -> Result<(), String> { let mut predicates = vec![]; for post_to in cmd.post_to.iter() { - let predicate = build_predicate_from_cli(&config, post_to, start_block, None)?; + let predicate = build_predicate_from_cli(&config, post_to, start_block, None, cmd.auth_token.clone())?; predicates.push(ChainhookFullSpecification::Bitcoin(predicate)); } @@ -835,6 +842,7 @@ pub fn build_predicate_from_cli( post_to: &str, start_block: u64, end_block: Option, + auth_token: Option, ) -> Result { let mut networks = BTreeMap::new(); // Retrieve last block height known, and display it @@ -852,7 +860,7 @@ pub fn build_predicate_from_cli( predicate: BitcoinPredicateType::OrdinalsProtocol(OrdinalOperations::InscriptionFeed), action: HookAction::HttpPost(HttpHook { url: post_to.to_string(), - authorization_header: "".to_string(), + authorization_header: format!("Bearer {}", auth_token.unwrap_or("".to_string())), }), }, );