0.1.4 • Published 1 year ago

@sensority-labs/sensor v0.1.4

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

@sensority-labs/sensor

Sensority bot development kit.

Installation

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.

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:

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

{
    "scripts": {
        "run": "sensor"
    }
}

Retrieving a specific block

{
    "scripts": {
        "run-block": "sensor --block 123456"
    }
}

Retrieving a specific transaction

{
    "scripts": {
        "run-tx": "sensor --tx 0x1234567890abcdef"
    }
}

Examining the blocks range

{
    "scripts": {
        "run-range": "sensor --range 123456 123459"
    }
}

Deployment

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

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

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago