Skip to content

feat: get user deposit address from omni-api#260

Open
frolvanya wants to merge 1 commit intomainfrom
feat/add-get-user-deposit-address-fetcher
Open

feat: get user deposit address from omni-api#260
frolvanya wants to merge 1 commit intomainfrom
feat/add-get-user-deposit-address-fetcher

Conversation

@frolvanya
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for fetching a user’s UTXO deposit address via the bridge indexer (omni-api) instead of querying the NEAR contract directly, and wires the required base URL through the CLI and near-bridge-client configuration.

Changes:

  • Add bridge_indexer_api_url to NearBridgeClient config and expose it via a getter.
  • Switch NearBridgeClient::get_btc_address to call the bridge indexer HTTP endpoint using reqwest.
  • Bump near-bridge-client and bridge-cli versions (and update lockfile), plus minor formatting cleanup in the Starknet client.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Cargo.lock Updates crate versions and adds reqwest dependency for near-bridge-client.
bridge-sdk/bridge-clients/starknet-bridge-client/src/starknet_bridge_client.rs Formatting-only changes (no functional behavior change).
bridge-sdk/bridge-clients/near-bridge-client/src/near_bridge_client.rs Adds bridge_indexer_api_url field and accessor.
bridge-sdk/bridge-clients/near-bridge-client/src/btc.rs Replaces on-chain view call with HTTP POST to indexer to fetch deposit address.
bridge-sdk/bridge-clients/near-bridge-client/Cargo.toml Adds reqwest dependency and bumps version.
bridge-cli/src/omni_connector_command.rs Passes bridge_indexer_api_url into NearBridgeClientBuilder.
bridge-cli/Cargo.toml Bumps CLI version.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +643 to +648
let api_url = self
.bridge_indexer_api_url()?
.join("api/v3/utxo/get_user_deposit_address")
.map_err(|e| {
BridgeSdkError::ConfigError(format!("Failed to construct api endpoint url: {e}"))
})?;
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Url::join("api/v3/utxo/get_user_deposit_address") is sensitive to whether the configured base URL ends with a trailing / or contains a path segment (e.g., https://host/base). In those cases, join can drop the last path segment and produce an unexpected endpoint. Consider joining an absolute path (leading /) or normalizing the base URL to always end with / before joining, to make this configuration more robust.

Copilot uses AI. Check for mistakes.
@kiseln
Copy link
Copy Markdown
Contributor

kiseln commented Apr 8, 2026

Why are we switching from using the smart contract? To me this is a better source of truth than the API

@frolvanya
Copy link
Copy Markdown
Contributor Author

No, since in api we're still making view call, but the only difference is adding address in db directly without making a transaction and waiting for indexers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants