Giter Club home page Giter Club logo

indexer-tx-watcher-example-lake's Introduction

Indexer that catches txs for specific contract(s)

This project is a copy of https://github.com/near-examples/indexer-tx-watcher-example but is migrated to NEAR Lake Framework. We keep them both separately as they show different approaches to the same use case

The most common use case for indexers is to react on a transaction sent to a specific contract or a list of contracts.

This project is trying to provide an example of the indexer described about. It's simple yet doing the necessary stuff. In this example we don't use any external storage (like database or files) to keep track for the transactions to keep the example as simple as possible.

We've tried to put the explanatory comments in the code to help developers to extend this example according to their needs.

Please refer to NEAR Indexer for Explorer to find an inspiration for extending the indexer.

How it works

Assuming we want to watch for transactions where a receiver account id is one of the provided in a list. We pass the list of account ids (or contracts it is the same) via argument --accounts. We want to catch all successfull transactions sent to one of the accounts from the list. In the demo we'll just look for them and log them but it might and probably should be extended based on your needs.


How to use

Before you proceed, make sure you have the following software installed:

  • rustup or Rust version that is mentioned in rust-toolchain file in the root of nearcore project.

Clone this repository and open the project folder

$ git clone [email protected]:khorolets/indexer-tx-watcher-example.git
$ cd indexer-tx-watcher-example

Run

$ cargo build --release
$ ./target/release/indexer-tx-watcher-example --accounts mycoolcontract.near,myanothercoolcontract.near --block-height 88088521 testnet

Provide your contracts list after --accounts key separated with comma (,) avoid spaces, pick a fresher block height on https://explorer.testnet.near.org/


Find more docs about indexers on https://near-indexers.io

indexer-tx-watcher-example-lake's People

Contributors

jon-lewis avatar khorolets avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.