open-index/open-npm huggingface dataset:
npm package: @sensority-labs/sensor
Description: SDK for Sensority bots development
Latest version: 0.1.4

# @sensority-labs/sensor

Sensority bot development kit.

## Installation
    
```bash
npm install @sensority-labs/sensor
```

## Preparation

Your bot should export functions processBlock or processTx, or both. These functions will be called by the sensor when a new block or transaction is received.

```typescript
export const processBlock = async (blockEvent: BlockEvent) => {
    console.log('New block:', blockEvent);
}

export const processTx = async (txEvent: TransactionEvent) => {
    console.log('New transaction:', txEvent);
}
```

## Usage

You can run it from the command line:

```bash
npx sensor
```
Options:
- no options - real-time blocks and transactions
- `--block <number>` - retrieve a specific block
- `--tx <hash>` - retrieve a specific transaction
- `--range <from> <to>` - examine the blocks range
- `--help` - display help

Or add npm script ro run the sensor like this:
#### Real-time blocks and transactions
```json
{
    "scripts": {
        "run": "sensor"
    }
}
```
#### Retrieving a specific block
```json
{
    "scripts": {
        "run-block": "sensor --block 123456"
    }
}
```
#### Retrieving a specific transaction
```json
{
    "scripts": {
        "run-tx": "sensor --tx 0x1234567890abcdef"
    }
}
```
#### Examining the blocks range
```json
{
    "scripts": {
        "run-range": "sensor --range 123456 123459"
    }
}
```

## Deployment

When you are ready to deploy your bot, you can use the following command:

```bash
git remote add deploy <your-sensority-bot-git-repo>
git push deploy <your-branch>:main
```