open-index/open-npm huggingface dataset:
npm package: @rosen-bridge/abstract-box-selection
Description: A Typescript package for general UTxO selection
Author: Rosen Team
Latest version: 1.0.2

# @rosen-bridge/abstract-box-selection

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)
- [Usage](#usage)

## Introduction

A Typescript package for general UTxO selection, providing an abstract base class for implementing box selection algorithms in blockchain systems.

## Installation

npm:

```sh
npm i @rosen-bridge/abstract-box-selection
```

yarn:

```sh
yarn add @rosen-bridge/abstract-box-selection
```

## Usage

Here's a basic example of how to use this package:

```typescript
import {
  AbstractBoxSelection,
  AssetBalance,
  TokenInfo,
} from '@rosen-bridge/abstract-box-selection';
import { DummyLogger } from '@rosen-bridge/abstract-logger';

// Define your box type
interface MyBox {
  id: string;
  value: bigint;
  tokens: Array<TokenInfo>;
}

// Implement the abstract class
export class MyBoxSelection extends AbstractBoxSelection<MyBox> {
  constructor() {
    super(new DummyLogger());
  }

  getBoxInfo(box: MyBox): BoxInfo {
    return {
      id: box.id,
      assets: {
        nativeToken: box.value,
        tokens: box.tokens,
      },
    };
  }
}

// Usage example
const selector = new MyBoxSelection();

const requiredAssets: AssetBalance = {
  nativeToken: 1000000n,
  tokens: [
    { id: 'token1', value: 100n },
    { id: 'token2', value: 200n },
  ],
};

const forbiddenBoxIds = ['box1', 'box2'];
const trackMap = new Map<string, MyBox>();
const boxes: MyBox[] = [
  // ... your boxes
];

const result = await selector.getCoveringBoxes(
  requiredAssets,
  forbiddenBoxIds,
  trackMap,
  boxes.values(),
);

if (result.covered) {
  console.log('Selected boxes:', result.boxes);
  console.log('Additional assets:', result.additionalAssets);
} else {
  console.log('Could not cover requirements');
}
```

The package provides a flexible foundation for implementing specific selection strategies while handling common concerns like:

- Asset balance tracking
- Box selection with constraints
- Fee estimation
- Token aggregation
- Change box creation
- Logger integration

You can extend the `AbstractBoxSelection` class to implement your specific selection strategy while leveraging the built-in functionality for common operations.
npm package: @rosen-bridge/abstract-extractor
Description: Rosen Bridge extractor interfaces to work with scanner
Author: Rosen Team
Latest version: 3.1.0

# extractor

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

Rosen Bridge extractor interfaces to work with scanner

## Installation

npm:

```sh
npm i @rosen-bridge/abstract-extractor
```

yarn:

```sh
yarn add @rosen-bridge/abstract-extractor
```
npm package: @rosen-bridge/abstract-logger
Description: Rosen Bridge abstract logger class, the base type for loggers used in all Rosen packages
Author: Rosen Team
Latest version: 4.0.0

# @rosen-bridge/abstract-logger

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

`@rosen-bridge/abstract-logger` contains abstract logger class, the base type
for loggers used in all Rosen packages.

## Installation

npm:

```sh
npm i @rosen-bridge/abstract-logger
```

yarn:

```sh
yarn add @rosen-bridge/abstract-logger
```
npm package: @rosen-bridge/abstract-notification
Description: A package containing abstract classes of notification services used inside Rosen Bridge
Author: Rosen Team
Latest version: 1.0.0

# @rosen-bridge/abstract-notification

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

A package containing abstract classes of notification services used inside Rosen Bridge

## Installation

npm:

```sh
npm i @rosen-bridge/abstract-notification
```

yarn:

```sh
yarn add @rosen-bridge/abstract-notification
```
npm package: @rosen-bridge/abstract-observation-extractor
Description: Event observation data extractor for different chains
Author: Rosen Team
Latest version: 1.0.3

# Abstract Observation Extractor

### Table of Contents

- [Description](#description)
- [Related Projects](#related-projects)
- [How to Use the Observation Extractor](#how-to-use-the-observation-extractor)
  - [Install](#install)
  - [Usage](#usage)
- [Contributing](#contributing)
- [License](#license)

<a name="headers"/>

## Description

Data extractors are modules that are integrated within a scanner. They drive the required information from the scanned blocks and store them in their own database. The observation extractor is designed to fulfill a watcher's main task: observing user payments in source networks. The bridge payment transaction has its own structure, and the observation extractor searches for this pattern occurrence in source chains and stores all needed information for a watcher commitment creation and revealment.

## Related Projects

This module is used within the [Scanner](https://github.com/rosen-bridge/scanner) project. The address scanner is currently used in the [Watcher](https://github.com/rosen-bridge/watcher) service to drive the valid source chain observations.

## How to Use the Observation Extractor

### Install

This project is written in node-js using Esnext module and typeorm database. Extractors are not standalone projects and should be used as scanner modules. You can easily install it using npm with the command:

```shell
npm install @rosen-bridge/abstract-observation-extractor
```

Alternatively, you can build and use it manually by cloning the project and running:

```shell
npm install
npm run build
```

### Usage

## Contributing

TBD

## License

TBD
npm package: @rosen-bridge/abstract-scanner
Description: Abstract scanner toolkit for blockchain scanning with logging.
Author: Rosen Team
Latest version: 1.0.2

# Scanner

### Table of Contents

- [Description](#description)
- [Related Projects](#related-projects)
- [How to Use the Scanner](#how-to-use-the-scanner)
  - [Install](#install)
  - [Usage](#usage)
- [Contributing](#contributing)
- [License](#license)
  <a name="headers"/>

## Description

Scanner is a bridge component responsible for observing and tracking the latest blocks in a target networks.

The goal of this project is to create an infrastructure for other projects. Bridge services, like watcher and guard, use this component to track the needed information. Moreover, this library can be utilized in other projects rather than bridge-related services to make them independent of the ergo explorer. It would help the network to be as decentralized as possible.

While the scanner itself only tracks the latest target network blocks, you can register a data extractor to the scanner to save your required data. In Rosen bridge, we use 4 different extractors on top of the scanner to extract bridge information. Check out these extractors [here](https://github.com/orgs/rosen-bridge/repositories).

## Related Projects

As mentioned above, data extractors can be added to the scanner to extract and store all required information. Finally, these components are used in the [Watcher](https://github.com/rosen-bridge/watcher) and [Guard](https://github.com/rosen-bridge/ts-guard-service) services.

## How to Use the Scanner

### Install

This project is written in node-js using Esnext module and typeorm database. Since the scanner is a core service, it's not designed to be used independently. However, you can easily install and use this library in your projects by running:

```shell
npm i @rosen-bridge/scanner
```

Additionally, it is possible to build this project manually as well. In order to build the project, clone the scanner repo and follow these steps:

```shell
npm install
npm run build
```

## Contributing

TBD

## License

TBD
npm package: @rosen-bridge/address-codec
Description: A Typescript package for encoding and decoding of addresses in Rosen bridge supported chains
Author: Rosen Team
Latest version: 2.0.0

# @rosen-bridge/address-codec

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

A Typescript package for encoding and decoding of addresses in Rosen bridge supported chains

## Installation

npm:

```sh
npm i @rosen-bridge/address-codec
```

yarn:

```sh
yarn add @rosen-bridge/address-codec
```
npm package: @rosen-bridge/address-codec-bitcoin
Description: A Typescript package for encoding and decoding of Bitcoin addresses in Rosen bridge
Author: Rosen Team
Latest version: 0.1.0

# @rosen-bridge/address-codec-bitcoin

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

A Typescript package for encoding and decoding of Bitcoin addresses in Rosen bridge

## Installation

npm:

```sh
npm i @rosen-bridge/address-codec-bitcoin
```

yarn:

```sh
yarn add @rosen-bridge/address-codec-bitcoin
```
npm package: @rosen-bridge/address-codec-bitcoin-runes
Description: A Typescript package for encoding and decoding of Bitcoin (Runes) addresses in Rosen bridge
Author: Rosen Team
Latest version: 0.1.0

# @rosen-bridge/address-codec-bitcoin-runes

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

A Typescript package for encoding and decoding of Bitcoin (Runes) addresses in Rosen bridge

## Installation

npm:

```sh
npm i @rosen-bridge/address-codec-bitcoin-runes
```

yarn:

```sh
yarn add @rosen-bridge/address-codec-bitcoin-runes
```
npm package: @rosen-bridge/address-codec-cardano
Description: A Typescript package for encoding and decoding of Cardano addresses in Rosen bridge
Author: Rosen Team
Latest version: 0.1.0

# @rosen-bridge/address-codec-cardano

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

A Typescript package for encoding and decoding of Cardano addresses in Rosen bridge

## Installation

npm:

```sh
npm i @rosen-bridge/address-codec-cardano
```

yarn:

```sh
yarn add @rosen-bridge/address-codec-cardano
```
npm package: @rosen-bridge/address-codec-doge
Description: A Typescript package for encoding and decoding of Doge addresses in Rosen bridge
Author: Rosen Team
Latest version: 0.1.0

# @rosen-bridge/address-codec-doge

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

A Typescript package for encoding and decoding of Doge addresses in Rosen bridge

## Installation

npm:

```sh
npm i @rosen-bridge/address-codec-doge
```

yarn:

```sh
yarn add @rosen-bridge/address-codec-doge
```
npm package: @rosen-bridge/address-codec-ergo
Description: A Typescript package for encoding and decoding of Ergo addresses in Rosen bridge
Author: Rosen Team
Latest version: 0.1.0

# @rosen-bridge/address-codec-ergo

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

A Typescript package for encoding and decoding of Ergo addresses in Rosen bridge

## Installation

npm:

```sh
npm i @rosen-bridge/address-codec-ergo
```

yarn:

```sh
yarn add @rosen-bridge/address-codec-ergo
```
npm package: @rosen-bridge/address-codec-evm
Description: A Typescript package for encoding and decoding of Cardano addresses in Rosen bridge
Author: Rosen Team
Latest version: 0.1.0

# @rosen-bridge/address-codec-evm

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

A Typescript package for encoding and decoding of EVM addresses in Rosen bridge

## Installation

npm:

```sh
npm i @rosen-bridge/address-codec-evm
```

yarn:

```sh
yarn add @rosen-bridge/address-codec-evm
```
npm package: @rosen-bridge/address-codec-firo
Description: A Typescript package for encoding and decoding of Firo addresses in Rosen bridge
Author: Rosen Team
Latest version: 0.1.0

# @rosen-bridge/address-codec-firo

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

A Typescript package for encoding and decoding of Firo addresses in Rosen bridge

## Installation

npm:

```sh
npm i @rosen-bridge/address-codec-firo
```

yarn:

```sh
yarn add @rosen-bridge/address-codec-firo
```
npm package: @rosen-bridge/address-codec-handshake
Description: A Typescript package for encoding and decoding of Handshake addresses in Rosen bridge
Author: Rosen Team
Latest version: 0.1.0

# @rosen-bridge/address-codec-handshake

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

A Typescript package for encoding and decoding of Handshake addresses in Rosen bridge

## Installation

npm:

```sh
npm i @rosen-bridge/address-codec-handshake
```

yarn:

```sh
yarn add @rosen-bridge/address-codec-handshake
```
npm package: @rosen-bridge/address-extractor
Description: UTXO box extractor for any address or token.
Author: Rosen Team
Latest version: 7.0.2

# Address Extractor

### Table of Contents

- [Description](#description)
- [Related Projects](#related-projects)
- [How to Use the Address Extractor](#how-to-use-the-address-extractor)
  - [Install](#install)
  - [Usage](#usage)
- [Contributing](#contributing)
- [License](#license)

<a name="headers"/>

## Description

Data extractors are modules that are integrated within a scanner. They drive the required information from the scanned blocks and store them in their own database. The address extractor is the simplest data extractor that tracks a specific address and stores all boxes belonging to that address. Furthermore, this extractor also can track a list of specific assets within the required address boxes. Currently, the address extractor can only be used to track the ergo addresses.

## Related Projects

This module is used within the [Scanner](https://github.com/rosen-bridge/scanner) project. The address scanner is currently used in the [Watcher](https://github.com/rosen-bridge/watcher) service to drive the watcher fee boxes and WID box (The watcher box with a specific WID token that is used for watcher authentication).

## How to Use the Address Extractor

### Install

This project is written in node-js using Esnext module and typeorm database. Extractors are not standalone projects and should be used as scanner modules. You can easily install it using npm with the command:

```shell
npm install @rosen-bridge/address-extractor
```

Alternatively, you can build and use it manually by cloning the project and running:

```shell
npm install
npm run build
```

### Usage

At the first step, you need to create a scanner instance; follow the steps [here](https://github.com/rosen-bridge/scanner) to create a running instance of scanner. Then you need to instantiate your address extractor and register it to your scanner:

```javascript
const addressExtractor = new ErgoUTXOExtractor(
    dataSource,
    <extractor_name>,
    <network_type>,
    <address>,
    OPTIONAL<Array<asset_id>>
)
scanner.registerExtractor(addressExtractor)
```

## Contributing

TBD

## License

TBD
npm package: @rosen-bridge/address-manager
Description: A Typescript package used by Rosen extractors to validate and decode addresses
Author: Rosen Team
Latest version: 0.1.0

# @rosen-bridge/address-manager

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)
- [Usage](#usage)

## Introduction

A Typescript package used by Rosen extractors to validate and decode addresses

## Installation

npm:

```sh
npm i @rosen-bridge/address-manager
```

yarn:

```sh
yarn add @rosen-bridge/address-manager
```

## Usage

The `AddressManager` is a singleton class that provides methods to validate and decode addresses of different chains. It should be initialized before use. You can initialize it as follows:

```ts
import { ConsoleLogger } from '@rosen-bridge/abstract-logger';
import { AddressManager } from '@rosen-bridge/address-manager';

const exampleChainValidators = {
  chainX: (address: string) => {
    // validate address
  },
};

const exampleChainDecoder = {
  chainX: (encodedAddress: string) => {
    // decode address
    return `decoded-address`;
  },
};

AddressManager.init(
  exampleChainValidators,
  exampleChainDecoder,
  new ConsoleLogger(),
);
const address = AddressManager.getInstance().decodeAddress(
  'chainX',
  'encoded-address',
);
```

Alternatively, you can initialize it with the implementations of `address-codec` package:

```ts
import { ConsoleLogger } from '@rosen-bridge/abstract-logger';
import { chainValidators, chainDecoders } from '@rosen-bridge/address-codec';
import { AddressManager } from '@rosen-bridge/address-manager';

AddressManager.init(chainValidators, chainDecoders, new ConsoleLogger());
```
npm package: @rosen-bridge/asset-check
Description: Rosen bridge health check service
Author: Rosen Team
Latest version: 6.2.0

# @rosen-bridge/asset-check

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

## Installation

npm:

```sh
npm i @rosen-bridge/asset-check
```

yarn:

```sh
yarn add @rosen-bridge/asset-check
```
npm package: @rosen-bridge/bitcoin-esplora-scanner
Description: A Bitcoin blockchain scanner based on Esplora Block Explorer API
Author: Rosen Team
Latest version: 3.0.1

# @rosen-bridge/bitcoin-esplora-scanner

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

A Bitcoin blockchain scanner based on Esplora Block Explorer API

## Installation

npm:

```sh
npm i @rosen-bridge/bitcoin-esplora-scanner
```

yarn:

```sh
yarn add @rosen-bridge/bitcoin-esplora-scanner
```
npm package: @rosen-bridge/bitcoin-observation-extractor
Description: Event observation data extractor for Bitcoin chain
Author: Rosen Team
Latest version: 7.0.3

# @rosen-bridge/bitcoin-observation-extractor

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

Event observation data extractor for Bitcoin chain

## Installation

npm:

```sh
npm i @rosen-bridge/bitcoin-observation-extractor
```

yarn:

```sh
yarn add @rosen-bridge/bitcoin-observation-extractor
```
npm package: @rosen-bridge/bitcoin-rpc-scanner
Description: A Bitcoin blockchain scanner based on bitcoin core JSON RPC API
Author: Rosen Team
Latest version: 3.0.1

# @rosen-bridge/bitcoin-rpc-scanner

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

A Bitcoin blockchain scanner based on bitcoin core JSON RPC API

## Installation

npm:

```sh
npm i @rosen-bridge/bitcoin-rpc-scanner
```

yarn:

```sh
yarn add @rosen-bridge/bitcoin-rpc-scanner
```
npm package: @rosen-bridge/bitcoin-runes-observation-extractor
Description: Event observation data extractor for Bitcoin Runes chain
Author: Rosen Team
Latest version: 2.0.3

# @rosen-bridge/bitcoin-runes-observation-extractor

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

Event observation data extractor for Bitcoin Runes chain

## Installation

npm:

```sh
npm i @rosen-bridge/bitcoin-runes-observation-extractor
```

yarn:

```sh
yarn add @rosen-bridge/bitcoin-runes-observation-extractor
```
npm package: @rosen-bridge/bitcoin-runes-utxo-selection
Description: A Typescript package to select enough Bitcoin utxos for required amount of BTC and Runes
Author: Rosen Team
Latest version: 2.1.0

# @rosen-bridge/bitcoin-runes-utxo-selection

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)
- [Usage](#usage)

## Introduction

A TypeScript package for selecting Bitcoin UTXOs to cover required amounts of BTC and Runes, built on top of the abstract box selection framework.

## Installation

npm:

```sh
npm i @rosen-bridge/bitcoin-runes-utxo-selection
```

yarn:

```sh
yarn add @rosen-bridge/bitcoin-runes-utxo-selection
```

## Usage

Here's a basic example of how to use this package:

```typescript
import { DummyLogger } from '@rosen-bridge/abstract-logger';
import { BitcoinRunesBoxSelection } from '@rosen-bridge/bitcoin-runes-utxo-selection';

// Create the selection instance
const selector = new BitcoinRunesBoxSelection(new DummyLogger());

// Define required assets
const requiredAssets = {
  nativeToken: 1000n, // 1000 satoshis
  tokens: [
    { id: 'rune1', value: 100n },
    { id: 'rune2', value: 200n },
  ],
};

// Define UTXOs with Runes
const utxos: BitcoinRunesUtxo[] = [
  {
    txId: 'tx1',
    index: 0,
    value: 5000n, // 5000 satoshis
    runes: [{ runeId: 'rune1', quantity: 100n }],
  },
  {
    txId: 'tx2',
    index: 0,
    value: 3000n, // 3000 satoshis
    runes: [{ runeId: 'rune2', quantity: 200n }],
  },
];

// Get covering boxes
const result = await selector.getCoveringBoxes(
  requiredAssets,
  [], // forbidden box IDs
  new Map(), // track map
  utxos.values(),
);

if (result.covered) {
  console.log('Selected UTXOs:', result.boxes);
  console.log('Additional assets:', result.additionalAssets);
} else {
  console.log('Could not cover requirements');
}
```

You can also use custom min box value and limit number of Runes per change box by passing them as arguments to the `getCoveringBoxes` method.

```typescript
const result = await selector.getCoveringBoxes(
  requiredAssets,
  [], // forbidden box IDs
  new Map(), // track map
  boxes.values(),
  546n, // min box value
  1, // max token count
);
```
npm package: @rosen-bridge/bitcoin-scanner
Description: A Bitcoin blockchain scanner based on Esplora or Rpc Block Explorer API
Author: Rosen Team
Latest version: 1.0.2

# @rosen-bridge/bitcoin-esplora-scanner

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

A Bitcoin blockchain scanner based on Rpc and Esplora Block Explorer API.

## Installation

npm:

```sh
npm i @rosen-bridge/bitcoin-esplora-scanner
```

yarn:

```sh
yarn add @rosen-bridge/bitcoin-esplora-scanner
```
npm package: @rosen-bridge/bitcoin-utxo-selection
Description: A Typescript package to select enough Bitcoin utxos for required amount of BTC
Author: Rosen Team
Latest version: 2.0.3

# @rosen-bridge/bitcoin-utxo-selection

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)
- [Usage](#usage)

## Introduction

A TypeScript package for selecting Bitcoin UTXOs to cover required amounts of BTC and fees, built on top of the abstract box selection framework.

## Installation

npm:

```sh
npm i @rosen-bridge/bitcoin-utxo-selection
```

yarn:

```sh
yarn add @rosen-bridge/bitcoin-utxo-selection
```

## Usage

Here's a basic example of how to use this package:

```typescript
import { DummyLogger } from '@rosen-bridge/abstract-logger';
import { BitcoinBoxSelection } from '@rosen-bridge/bitcoin-utxo-selection';

// Create a fee estimator
// An example fee estimator for a transaction with only native-segwit inputs and outputs and 3 fee ratio
const feeEstimator = BitcoinBoxSelection.generateFeeEstimator(
  1, // additional output count
  42, // tx base weight
  272, // input weight unit
  124, // output weight unit
  3, // fee ratio (in satoshis per byte)
  4, // discount factor
);

// Create the selection instance
const selector = new BitcoinBoxSelection(new DummyLogger());

// Define required assets
const requiredAssets = {
  nativeToken: 6000000n, // 0.06 BTC
  tokens: [],
};

// Define UTXOs
const utxos: BitcoinUtxo[] = [
  { txId: 'tx1', index: 0, value: 5000000 }, // 0.05 BTC
  { txId: 'tx2', index: 0, value: 3000000 }, // 0.03 BTC
  { txId: 'tx3', index: 0, value: 2000000 }, // 0.02 BTC
];

// Get covering boxes
const result = await selector.getCoveringBoxes(
  requiredAssets,
  [], // forbidden box IDs
  new Map(), // track map
  utxos.values(),
  294n, // min box value
  undefined, // max token count (does not matter on Bitcoin, but still cannot be 0)
  feeEstimator,
);

if (result.covered) {
  console.log('Selected UTXOs:', result.boxes);
  console.log('Additional assets:', result.additionalAssets);
} else {
  console.log('Could not cover requirements');
}
```
npm package: @rosen-bridge/callback-logger
Description: A new logger with callback method on each levels
Author: Rosen Team
Latest version: 2.0.0

# callback-logger

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

A new logger with callback method on each levels

## Installation

npm:

```sh
npm i @rosen-bridge/callback-logger
```

yarn:

```sh
yarn add @rosen-bridge/callback-logger
```
npm package: @rosen-bridge/cardano-observation-extractor
Description: Event observation data extractor for Cardano chain
Author: Rosen Team
Latest version: 2.0.3

# @rosen-bridge/cardano-observation-extractor

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

Event observation data extractor for Cardano chain.

## Installation

npm:

```sh
npm i @rosen-bridge/cardano-observation-extractor
```

yarn:

```sh
yarn add @rosen-bridge/cardano-observation-extractor
```
npm package: @rosen-bridge/cardano-scanner
Description: A Cardano chain scanner.
Author: Rosen Team
Latest version: 2.0.2

# @rosen-bridge/cardano-scanner

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

A Cardano blockchain scanner based on blackfrost , koios and ogmios API.

## Installation

npm:

```sh
npm i @rosen-bridge/cardano-scanner
```

yarn:

```sh
yarn add @rosen-bridge/cardano-scanner
```

### Usage

Cardano Scanner:

```javascript
const cardanoScannerConfig = {
    koiosUrl: <koios_url>,
    timeout: <api_timeout>,
    initialHeight: <cardano_initial_height>,
    dataSource: dataSource,
}
cardanoScanner = new CardanoKoiosScanner(cardanoScannerConfig)
```
npm package: @rosen-bridge/cardano-utxo-selection
Description: A Typescript package to select enough Cardano utxos for required amount of assets
Author: Rosen Team
Latest version: 3.0.3

# @rosen-bridge/cardano-utxo-selection

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)
- [Usage](#usage)

## Introduction

A TypeScript package for selecting Cardano UTXOs to cover required amounts of assets, built on top of the abstract box selection framework.

## Installation

npm:

```sh
npm i @rosen-bridge/cardano-utxo-selection
```

yarn:

```sh
yarn add @rosen-bridge/cardano-utxo-selection
```

## Usage

Here's a basic example of how to use this package:

```typescript
import { DummyLogger } from '@rosen-bridge/abstract-logger';
import { CardanoBoxSelection } from '@rosen-bridge/cardano-utxo-selection';

// Create the selection instance
const selector = new CardanoBoxSelection(new DummyLogger());

// Define required assets
const requiredAssets = {
  nativeToken: 100000000n, // 1 ADA
  tokens: [
    { id: 'policy1.token1', value: 100n },
    { id: 'policy2.token2', value: 200n },
  ],
};

// Define UTXOs
const utxos: CardanoUtxo[] = [
  {
    txHash: 'tx1',
    index: 0,
    value: 500000000n, // 5 ADA
    assets: [{ id: 'policy1.token1', value: 100n }],
  },
  {
    txHash: 'tx2',
    index: 0,
    value: 300000000n, // 3 ADA
    assets: [{ id: 'policy2.token2', value: 200n }],
  },
];

// Get covering boxes
const result = await selector.getCoveringBoxes(
  requiredAssets,
  [], // forbidden box IDs
  new Map(), // track map
  utxos.values(),
);

if (result.covered) {
  console.log('Selected UTXOs:', result.boxes);
  console.log('Additional assets:', result.additionalAssets);
} else {
  console.log('Could not cover requirements');
}
```

You can also use custom min box value and limit number of tokens per change box by passing them as arguments to the `getCoveringBoxes` method.

```typescript
const result = await selector.getCoveringBoxes(
  requiredAssets,
  [], // forbidden box IDs
  new Map(), // track map
  boxes.values(),
  20000000n, // min box value
  3, // max token count
);
```
npm package: @rosen-bridge/changeset-formatter
Description: A changeset formatter based on default changeset formatter, but without commit hashes
Author: Rosen Team
Latest version: 2.0.1

# @rosen-bridge/changeset-formatter

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)
- [Usage](#usage)

## Introduction

A changeset formatter based on default changeset formatter, but without commit hashes

## Installation

npm:

```sh
npm i @rosen-bridge/changeset-formatter
```

yarn:

```sh
yarn add @rosen-bridge/changeset-formatter
```

## Usage

In your `./changeset/config.json`:

```json
{
  "changelog": "@rosen-bridge/changeset-formatter"
}
```
npm package: @rosen-bridge/cli
Description: The official Rosen bridge cli, providing helpers for the tasks related to Rosen bridge
Latest version: 2.1.3

# @rosen-bridge/cli

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)
- [Usage](#usage)

## Introduction

`@rosen-bridge/cli` is the official Rosen bridge cli, providing helpers for the
tasks related to Rosen bridge.

## Installation

npm:

```sh
npm i @rosen-bridge/cli
```

yarn:

```sh
yarn add @rosen-bridge/cli
```

## Usage

The cli can be used through `npx`.

```sh
npx @rosen-bridge/cli --help
```

### `download-assets`

Downloads Rosen bridge assets (tokens and addresses files) from
[`contracts`](https://github.com/rosen-bridge/contract) repository on GitHub for
a specific chain type (e.g. mainnet, etc.).

```sh
npx @rosen-bridge/cli download-assets --help
```

#### Examples

Download assets for mainnet into a `rosen` directory.

```sh
npx @rosen-bridge/cli download-assets --chain-type mainnet --out rosen
```

docker solution:

```shell
docker run -it --rm -v "$PWD"/rosen:/usr/src/app/rosen -w /usr/src/app node:20.11 npx --yes @rosen-bridge/cli download-assets --chain-type mainnet --out rosen
```

Download assets for testnet into a `rosen` directory. If some pre-releases are
available for testnet, download them. Add suffix `foo` to all downloaded asset
names.

```sh
npx @rosen-bridge/cli download-assets -c testnet -o rosen --include-prereleases --suffix foo
```

### `tss-secret`

Generate Tss publicKey/secret for ecdsa or eddsa.

```sh
npx @rosen-bridge/cli tss-secret -t ecdsa generate
npx @rosen-bridge/cli tss-secret -t eddsa generate
```

docker solution for `ecdsa`:

```shell
docker run -it --rm node:20.11 npx --yes @rosen-bridge/cli tss-secret -t ecdsa generate
```

Convert secret to pk:

```sh
npx @rosen-bridge/cli tss-secret -t ecdsa convert-to-pk YOUR_TSS_SECRET
npx @rosen-bridge/cli tss-secret -t eddsa convert-to-pk YOUR_TSS_SECRET
```

docker solution for `ecdsa`:

```shell
docker run -it --rm node:20.11 npx --yes @rosen-bridge/cli tss-secret -t ecdsa convert-to-pk YOUR_TSS_SECRET
```

### `blake2b-hash`

blake2b hash of specified input

```sh
npx @rosen-bridge/cli blake2b-hash [input]
```

#### Examples

Get blake2b hash from `hello`

```sh
npx @rosen-bridge/cli blake2b-hash hello
```

docker solution:

```shell
docker run -it --rm node:20.11 npx --yes @rosen-bridge/cli blake2b-hash hello
```
npm package: @rosen-bridge/collateral
Description: a package to manage collateral box
Author: Rosen Team
Latest version: 0.1.0

# @rosen-bridge/collateral

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

provides a structured and reusable way to work with collateral boxes.
The CollateralBox class is responsible for reading and exposing all collateral
box properties in a clear and consistent manner. The CollateralBoxBuilder class is a builder
that constructs the final collateral box based on those properties.

## Installation

npm:

```sh
npm i @rosen-bridge/collateral
```

yarn:

```sh
yarn add @rosen-bridge/collateral
```
npm package: @rosen-bridge/communication
Description: abstractly manage communication between endpoints
Author: Rosen Team
Latest version: 2.0.2

# @rosen-bridge/communication

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

Abstractly manage communication between endpoints

## Installation

npm:

```sh
npm i @rosen-bridge/communication
```

yarn:

```sh
yarn add @rosen-bridge/communication
```
npm package: @rosen-bridge/config
Description: a package to manage configs of rosen bridge projects
Author: Rosen Team
Latest version: 2.0.0

# @rosen-bridge/config

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

a package to manage configs of rosen bridge projects

## Installation

npm:

```sh
npm i @rosen-bridge/config
```

yarn:

```sh
yarn add @rosen-bridge/config
```
npm package: @rosen-bridge/detection
Description: find available endpoints in private network
Author: Rosen Team
Latest version: 2.0.2

# @rosen-bridge/detection

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

find available endpoints in private network

## Installation

npm:

```sh
npm i @rosen-bridge/detection
```

yarn:

```sh
yarn add @rosen-bridge/detection
```
npm package: @rosen-bridge/dialer
Description: a package top of rosenet-node with rosen p2p requirements
Author: Rosen Team
Latest version: 0.3.0

# dialer

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

A package top of rosenet-node with rosen requirements

## Installation

npm:

```sh
npm i @rosen-bridge/dialer
```

yarn:

```sh
yarn add @rosen-bridge/dialer
```
npm package: @rosen-bridge/discord-notification
Description: - [Introduction](#introduction) - [Installation](#installation)
Author: Rosen Team
Latest version: 1.0.0

# @rosen-bridge/discord-notification

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Installation

npm:

```sh
npm i @rosen-bridge/discord-notification
```

yarn:

```sh
yarn add @rosen-bridge/discord-notification
```
npm package: @rosen-bridge/encryption
Description: unify encryption interface
Author: Rosen Team
Latest version: 1.0.1

# @rosen-bridge/encryption

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

unify encryption interface

## Installation

npm:

```sh
npm i @rosen-bridge/encryption
```

yarn:

```sh
yarn add @rosen-bridge/encryption
```
npm package: @rosen-bridge/ergo-multi-sig
Description: multi signature protocol for ergo network
Author: Rosen Team
Latest version: 2.2.0

# @rosen-bridge/ergo-multi-sig

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

multi signature protocol for ergo network

## Installation

npm:

```sh
npm i @rosen-bridge/ergo-multi-sig
```

yarn:

```sh
yarn add @rosen-bridge/ergo-multi-sig
```
npm package: @rosen-bridge/ergo-observation-extractor
Description: Event observation data extractor for Ergo chain
Author: Rosen Team
Latest version: 1.0.3

# @rosen-bridge/ergo-observation-extractor

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

Event observation data extractor for Ergo chain.

## Installation

npm:

```sh
npm i @rosen-bridge/ergo-observation-extractor
```

yarn:

```sh
yarn add @rosen-bridge/ergo-observation-extractor
```
npm package: @rosen-bridge/ergo-scanner
Description: An Ergo chain scanner.
Author: Rosen Team
Latest version: 1.0.2

# @rosen-bridge/ergo-scanner

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

An ergo blockchain scanner based on Node or Explorer API.

## Installation

npm:

```sh
npm i @rosen-bridge/ergo-scanner
```

yarn:

```sh
yarn add @rosen-bridge/ergo-scanner
```

### Usage

Ergo Scanner:

```javascript
const ergoScannerConfig = {
    nodeUrl: <node_url>,
    timeout: <node_timeout>,
    initialHeight: <ergo_initial_height>,
    dataSource: dataSource,
}
scanner = new ErgoScanner(ergoScannerConfig);
```
npm package: @rosen-bridge/event-progress-check
Description: Rosen bridge event-progress health-check parameter
Author: Rosen Team
Latest version: 2.0.0

# @rosen-bridge/event-progress-check

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

Rosen bridge event-progress health-check parameter

## Installation

npm:

```sh
npm i @rosen-bridge/event-progress-check
```

yarn:

```sh
yarn add @rosen-bridge/event-progress-check
```
npm package: @rosen-bridge/evm-address-tx-extractor
Description: Extract and store EVM chain notable data of transactions for an address
Author: Rosen Team
Latest version: 2.0.2

# @rosen-bridge/evm-address-tx-extractor

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

Extract and store EVM chain notable data of transactions for an address

## Installation

npm:

```sh
npm i @rosen-bridge/evm-address-tx-extractor
```

yarn:

```sh
yarn add @rosen-bridge/evm-address-tx-extractor
```
npm package: @rosen-bridge/evm-observation-extractor
Description: Event observation data extractor for EVM-compatible chains
Author: Rosen Team
Latest version: 6.0.3

# @rosen-bridge/evm-observation-extractor

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

Event observation data extractor for EVM-compatible chains

## Installation

npm:

```sh
npm i @rosen-bridge/evm-observation-extractor
```

yarn:

```sh
yarn add @rosen-bridge/evm-observation-extractor
```
npm package: @rosen-bridge/evm-rpc-scanner
Description: An EVM chain scanner based on RPC.
Author: Rosen Team
Latest version: 4.0.2

# @rosen-bridge/evm-rpc-scanner

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

An EVM chain scanner based on RPC.

## Installation

npm:

```sh
npm i @rosen-bridge/evm-rpc-scanner
```

yarn:

```sh
yarn add @rosen-bridge/evm-rpc-scanner
```
npm package: @rosen-bridge/evm-scanner
Description: An EVM chain scanner based on RPC.
Author: Rosen Team
Latest version: 1.0.2

# @rosen-bridge/evm-scanner

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

An EVM chain scanner.

## Installation

npm:

```sh
npm i @rosen-bridge/evm-scanner
```

yarn:

```sh
yarn add @rosen-bridge/evm-scanner
```
npm package: @rosen-bridge/extended-minimum-fee
Description: this project gets minimum fee of the bridge for supported tokens from blockchain
Author: Rosen Team
Latest version: 0.1.0

# @rosen-bridge/extended-minimum-fee

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)
- [Usage](#usage)

## Introduction

`@rosen-bridge/extended-minimum-fee` Typescript package to build and get minimum fee of the bridge for supported tokens from blockchain

## Installation

npm:

```sh
npm i @rosen-bridge/extended-minimum-fee
```

yarn:

```sh
yarn add @rosen-bridge/extended-minimum-fee
```

## Usage

Here's a basic example of how to use this package:

```typescript
import {
  ExtendedMinimumFeeBox,
  MinimumFeeExplorerNetwork,
} from '@rosen-bridge/extended-minimum-fee';

const network = new MinimumFeeExplorerNetwork('URL');
const minimumFeeBox = new ExtendedMinimumFeeBox('TOKEN_ID', 'NFT', network);
await minimumFeeBox.fetchBox();
const builder = minimumFeeBox.toBuilder();
```
npm package: @rosen-bridge/extended-tokens
Description: An extended version of @rosen-bridge/tokens package which enables parsing of TokenMap from Ergo boxes
Author: Rosen Team
Latest version: 0.1.2

# @rosen-bridge/extended-tokens

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)
- [Usage](#usage)

## Introduction

An extended version of @rosen-bridge/tokens package which enables parsing of TokenMap from Ergo boxes.

## Installation

npm:

```sh
npm i @rosen-bridge/extended-tokens
```

yarn:

```sh
yarn add @rosen-bridge/extended-tokens
```

## Usage

Here's a basic example of how to use this package:

```typescript
import * as wasm from 'ergo-lib-wasm-nodejs';
import { parseTokenMapBoxes } from '@rosen-bridge/extended-tokens';
import JsonBigInt from '@rosen-bridge/json-bigint';
import ergoNodeClientFactory from '@rosen-clients/ergo-node';

// Fetch the token map config boxes from the Ergo Node
const nodeClient = ergoNodeClientFactory(ergoNodeUrl);
const tokenMapNFT = '123456789abcdef'; // token id of token map NFT
const res = await nodeClient.getBoxesByTokenIdUnspent(tokenMapNFT);
const configBoxes = res.filter(
  (box) =>
    box.assets?.find((token) => token.tokenId === tokenMapNFT)?.amount === 1n,
);

// Serialized the boxes
const serializedBoxes = configBoxes.map((boxJson) =>
  Buffer.from(
    wasm.ErgoBox.from_json(
      JsonBigInt.stringify(boxJson),
    ).sigma_serialize_bytes(),
  ).toString('hex'),
);

// Parse the token map JSON from the boxes
const tokens = parseTokenMapBoxes(serializedBoxes);
console.log(tokens);
```

Alternatively, you can use the `ExtendedTokenMap` class and parse the boxes directly:

```typescript
const tokenMap = new ExtendedTokenMap();
await tokenMap.updateConfigByBoxes(serializedBoxes);
console.log(tokenMap.getTokens());
```
npm package: @rosen-bridge/extended-typeorm
Description: An extended typeorm datasource with run some queries better
Author: Rosen Team
Latest version: 1.0.1

# @rosen-bridge/extended-typeorm

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)
- [Usage](#usage)

## Introduction

By default, typeorm doesn't handle parallel transactions. If you run two
transactions simultaneously and your database doesn't support it (e.g. if you
use sqlite), you will get errors.

## Installation

npm:

```sh
npm i @rosen-bridge/extended-typeorm
```

yarn:

```sh
yarn add @rosen-bridge/extended-typeorm
```

## Usage

```ts
import { DataSource } from '@rosen-bridge/extended-typeorm';

const dataSource = DataSource({
  ...
})
```

Now all database transaction execute correctly without throwing an error, no matter if you call them simultaneously or not.
npm package: @rosen-bridge/fastify-enhanced
Description: a wrapper around fastify web framework to make it even better
Author: Rosen Team
Latest version: 2.0.2

# @rosen-bridge/fastify-enhanced

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)
- [Usage](#usage)

## Introduction

A wrapper around fastify web framework to make it even better

## Installation

npm:

```sh
npm i @rosen-bridge/fastify-enhanced
```

yarn:

```sh
yarn add @rosen-bridge/fastify-enhanced
```

## Usage

To use the enhanced Fastify, import `createFastify` and use it to create a fastify instance and register routes. Use data types defined under `types` object, to define validation constraints for requests and responses:

```ts
import { FastifyBaseLogger, FastifyInstance } from 'fastify';
import { IncomingMessage, Server, ServerResponse } from 'http';

import {
  ZodTypeProvider,
  createFastify,
  types,
} from '@rosen-bridge/fastify-enhanced';

const addTokenPaymentRoute = (
  fastify: FastifyInstance<
    Server<typeof IncomingMessage, typeof ServerResponse>,
    IncomingMessage,
    ServerResponse<IncomingMessage>,
    FastifyBaseLogger,
    ZodTypeProvider
  >,
) => {
  const bodySchema = types.object({
    tokenName: types.string(),
    tokenAmount: types.bigint(),
    tokenDecimals: types.number(),
  });

  const res200Schema = types.object({
    name: types.string(),
    amount: types.bigint(),
    decimal: types.number(),
  });

  const payTokenOpts = {
    schema: {
      body: bodySchema,
      response: {
        200: res200Schema,
      },
    },
  };

  fastify.post('/payToken', payTokenOpts, async (request, reply) => {
    return reply.status(200).send({
      name: request.body.tokenName,
      amount: request.body.tokenAmount,
      decimal: request.body.tokenDecimals,
    });
  });

  return fastify;
};

const fastify = await createFastify(
  {
    path: '/swagger',
    title: '',
    description: '',
    version: '0.0.1',
  },
  { logger: false },
);
addTokenPaymentRoute(fastify);

const start = async () => {
  try {
    await fastify.listen({ port: 8000 });
  } catch (err) {
    console.log(err);
    process.exit(1);
  }
};
start();
```

To define a nested route don't forget to add `ZodTypeProvider` to the Fastify instance that is passed to the `register` method, to enable Zod typing validation:

```ts
fastify.register(
  (instance, opts, next) => {
    const subFastify = instance.withTypeProvider<ZodTypeProvider>();
    addTokenPaymentRoute(subFastify);
    next();
  },
  { prefix: 'subroute' },
);
```
npm package: @rosen-bridge/firo-observation-extractor
Description: Event observation data extractor for Firo chain
Author: Rosen Team
Latest version: 0.1.1

# @rosen-bridge/firo-observation-extractor

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

Event observation data extractor for Firo chain

## Installation

npm:

```sh
npm i @rosen-bridge/firo-observation-extractor
```

yarn:

```sh
yarn add @rosen-bridge/firo-observation-extractor
```
npm package: @rosen-bridge/firo-rpc-scanner
Description: A Firo blockchain scanner based on network RPC
Author: AlefLm
Latest version: 0.1.0

# @rosen-bridge/firo-rpc-scanner

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

A Firo blockchain scanner based on network RPC

## Installation

npm:

```sh
npm i @rosen-bridge/firo-rpc-scanner
```

yarn:

```sh
yarn add @rosen-bridge/firo-rpc-scanner
```
npm package: @rosen-bridge/firo-scanner
Description: A Firo blockchain scanner based on network RPC
Author: AlefLm
Latest version: 0.1.0

# @rosen-bridge/firo-scanner

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

A Firo blockchain scanner based on network RPC

## Installation

npm:

```sh
npm i @rosen-bridge/firo-scanner
```

yarn:

```sh
yarn add @rosen-bridge/firo-scanner
```
npm package: @rosen-bridge/fraud-extractor
Description: fraud information extractor for watcher faulty reports
Author: Rosen Team
Latest version: 3.0.2

# Fraud Extractor

### Table of Contents

- [Description](#description)
- [Related Projects](#related-projects)
- [How to Use the Fraud Extractor](#how-to-use-the-fraud-extractor)
  - [Install](#install)
  - [Usage](#usage)
- [Contributing](#contributing)
- [License](#license)

<a name="headers"/>

## Description

Data extractors are modules that are integrated within a scanner. They drive the required information from the scanned blocks and store them in their own database. Fraud extractor, extracts fraud boxes information from blocks and stores them in the database. Cleanup service creates frauds from timed out unspent triggers; these triggers might have incorrect data or be a duplicated version of a valid trigger. Then the fraud funds will be seized by the service to punish the faulty reports.

## Related Projects

TBD

## How to Use the Fraud Extractor

### Install

TBD

### Usage

TBD

## Contributing

TBD

## License

TBD
npm package: @rosen-bridge/handshake-observation-extractor
Description: Event observation data extractor for Handshake chain
Author: Aco Šmrkas
Latest version: 0.1.0

# @rosen-bridge/handshake-observation-extractor

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

Event observation data extractor for Handshake chain

## Installation

npm:

```sh
npm i @rosen-bridge/handshake-observation-extractor
```

yarn:

```sh
yarn add @rosen-bridge/handshake-observation-extractor
```
npm package: @rosen-bridge/handshake-scanner
Description: A Handshake blockchain scanner based on RPC API
Author: Aco Šmrkas
Latest version: 0.1.0

# @rosen-bridge/handshake-scanner

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

A Handshake blockchain scanner based on RPC API

## Installation

npm:

```sh
npm i @rosen-bridge/handshake-scanner
```

yarn:

```sh
yarn add @rosen-bridge/handshake-scanner
```
npm package: @rosen-bridge/health-check
Description: Rosen bridge health-check package
Author: Rosen Team
Latest version: 8.0.0

# @rosen-bridge/health-check

## Table of contents

- [Introduction](#introduction)
- [Installation](#installation)

## Introduction

Rosen bridge health-check package

## Installation

npm:

```sh
npm i @rosen-bridge/health-check
```

yarn:

```sh
yarn add @rosen-bridge/health-check
```