> For the complete documentation index, see [llms.txt](https://sorobans-organization.gitbook.io/sorobans-organization-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sorobans-organization.gitbook.io/sorobans-organization-docs/sorobanhooks/contract-watchers.md).

# Contract Watchers

### **Steps**

**1. Contract Address**

* Description: The smart contract address you want to monitor.
* Format: Must be a valid contract address.

#### 2. Network Type

* Description: Select the blockchain network for monitoring.
* Options:
  * Mainnet
  * Testnet

#### 3. Events

* Description: Specify which events to monitor.
* Example:
  * Real time monitoring – Triggers alerts for live contract activity.
  * Daily/Weekly/Monthly Summary - Receive AI-generated digests at your preferred frequency.
  * Get All Transaction History (api)
  * Get Storage History (api)

#### 4. **Contract Function (Filter)**

By default, a contract watcher listens to all function calls on the specified contract. With the filter, you can narrow the watcher to only specific functions.

#### How It Works

* Search the function name(s) you want to track in the filter input.
* When the specified function is invoked, your watcher will receive an update.
* If the filter input is left empty, the watcher continues to listen for all functions on the contract.
* You can add multiple filters at a time
* Description: Add personal notes for this alert configuration.

**5. Network Type**

* Description: Choose the blockchain network.
* Options:

  * Mainnet
  * Testnet

**6. Select Platform**

* Choose where alerts should be delivered.

  * **Telegram** (User/Group) – Alerts are sent to your Telegram account.
  * **Discord** (User/Group) – Alerts are sent to your Discord account.
  * **Webhook** – Alerts are sent to a custom webhook endpoint.

**7. Notes (Optional)**

Description: Add personal notes for this alert configuration.

#### Watchers

<figure><img src="/files/evA2mxFnfIsT6CEGmqS5" alt=""><figcaption></figcaption></figure>

#### Demo (Discord)

{% embed url="<https://drive.google.com/file/d/1hteDTYH23UTJRI60Em-pTdgnAiGrHAC_/view?usp=drive_link>" %}

### **Summary**

**Demo (Daily/Weekly/Monthly)**

{% embed url="<https://drive.google.com/file/d/1K82cry9oz2PcNdFE3sxtFr_oPPlX8hnp/view?usp=drive_link>" %}

**Get All Transaction History**

**To get all the transaction history via api endpoint**

&#x20;<https://api.sorobanhooks.xyz/v1/api/contract>

**Query Parameters:**

* **address**: The contract address to fetch data for.
* **type**: The type of data to fetch — set to transactions.
* **page**: Pagination parameter — current page (default: 1).
* **limit**: Number of results per page (default: 10).
* **x-api-key**: Authentication key required to access the Soroban Hooks API, which can be obtained from the Profile Page.

**Content-Type**: Specifies the format of the request — application/json

<figure><img src="/files/R2aCNGIIiFtoL9KB9QMQ" alt=""><figcaption></figcaption></figure>

**Get Storage History**

**To get all the storage history via api endpoint**

&#x20;<https://api.sorobanhooks.xyz/v1/api/contract>

**Query Parameters**:

* **address**: The contract address to fetch data for.
* **type**: The type of data to fetch — set to storage.
* **page**: Pagination parameter — current page (default: 1).
* **limit**: Number of results per page (default: 10).
* **x-api-key**: Authentication key required to access the Soroban Hooks API, which can be obtained from the Profile Page.

**Content-Type**: Specifies the format of the request — application/json.

<figure><img src="/files/STrbivNYWVYz4kGF81rE" alt=""><figcaption></figcaption></figure>

####

#### Objective

Expose reliable historical and live smart contract data via API.

#### Success Metrics

Index and expose historical data for at least Soroban contracts.

{% embed url="<https://drive.google.com/file/d/1FTmD4uL-iQlw8O_r9GWphUhmcFF9opX0/view?usp=drive_link>" %}

## **Use Cases**

1. **Developer Debugging and Monitoring**
   * Monitor smart contract events during development to debug issues or ensure proper functionality.
   * Receive real-time updates on testnet or mainnet deployments.
2. **Event Tracking for DeFi Protocols**
   * Watch for transactions or balance changes in decentralized finance (DeFi) applications.
   * Track liquidity pool updates, staking rewards, or lending/borrowing events.
3. **DAO and Community Notifications**
   * Keep members informed about governance-related events or treasury activities.
   * Notify participants about new proposals, votes, or contract interactions.
4. **Automated Workflow Triggers**
   * Use Webhook integration to automate workflows based on specific contract events.
   * Trigger actions such as sending alerts, updating databases, or initiating trades.
5. **Business Operations and Compliance**
   * Monitor transactions or wallet balances to ensure compliance with internal policies or external regulations.
   * Receive instant updates on contract interactions related to business operations.
6. **Security and Anomaly Detection**
   * Track contract activity for unusual or malicious behavior, such as unauthorized withdrawals or suspicious transactions.
   * Get alerts to take immediate action in case of anomalies.
7. **NFT Minting and Transfers**
   * Watch for NFT-related events, such as minting, transfers, or metadata updates.
   * Notify creators and collectors of relevant contract activities.
8. **Trading and Arbitrage Opportunities**
   * Monitor specific contract events tied to token swaps or order execution.
   * Get notified about high-value transactions to exploit arbitrage opportunities.
9. **Education and Research**
   * Educators can demonstrate smart contract functionality by showcasing real-time event tracking.
   * Researchers can analyze transaction patterns and contract interactions.
10. **Integration into Analytics Dashboards**
    * Use Webhook to feed contract event data into analytics tools for advanced insights and reporting.
