Skip to content

Commit

Permalink
Added fastnear as an alternative provider of NEAR blockchain data (#…
Browse files Browse the repository at this point in the history
…109)

* reffactoring and extend library to use different providers

* add fastnear provider

* fix tests

* add docstrings and documentation

* improvement

* reffactoring

* improvement

* update near-indexer-primitives to 0.27.0
  • Loading branch information
kobayurii authored Nov 6, 2024
1 parent 1f061c0 commit 37764c6
Show file tree
Hide file tree
Showing 14 changed files with 1,104 additions and 530 deletions.
20 changes: 19 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,25 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased](https://github.com/near/near-lake-framework/compare/v0.7.9...HEAD)
## [Unreleased](https://github.com/near/near-lake-framework/compare/v0.7.10...HEAD)

## [0.7.10](https://github.com/near/near-lake-framework/compare/v0.7.9...0.7.10)

* Upgrade `near-indexer-primitives` to `0.27.0` (nearcore-2.3.0)
* Added new provider `fastnear` - a new way to get the data from NEAR Protocol. It is a separate service that provides the data in a more efficient way. Check the [FastNear](https://fastnear.com/) and [Near Data Server](https://github.com/fastnear/neardata-server/) to get more details about provider.

### Breaking Change

* `s3_fetchers` rename to `fetchers` and move to the `providers` module. New usage example:
```rust
use near_lake_framework::s3::fetchers::fetch_streamer_message;
use near_lake_framework::fastnear::fetchers::fetch_streamer_message;
```
* `s3_client` rename to `client` and move to the `providers` module. New usage example:
```rust
use near_lake_framework::S3Client;
use near_lake_framework::FastNearClient;
```

## [0.7.9](https://github.com/near/near-lake-framework/compare/v0.7.7...0.7.9)

Expand Down
7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ categories = ["asynchronous", "api-bindings", "network-programming"]
keywords = ["near", "near-lake", "near-indexer"]
authors = ["Near Inc <hello@nearprotocol.com>"]
edition = "2021"
rust-version = "1.75.0"
rust-version = "1.81.0"

# cargo-workspaces
[workspace.metadata.workspaces]
version = "0.7.9"
version = "0.7.10"

[dependencies]
anyhow = "1.0.79"
Expand All @@ -25,14 +25,15 @@ async-stream = "0.3.5"
async-trait = "0.1.77"
derive_builder = "0.13.0"
futures = "0.3.30"
reqwest = { version = "0.12.7", features = ["json"] }
serde = { version = "1.0.195", features = ["derive"] }
serde_json = "1.0.111"
thiserror = "1.0.56"
tokio = { version = "1.35.1", features = ["sync", "time", "rt", "macros"] }
tokio-stream = { version = "0.1.14" }
tracing = "0.1.40"

near-indexer-primitives = "0.23.0"
near-indexer-primitives = "0.27.0"

[lib]
doctest = false
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,42 @@ $5.7 + $14.1 = $19.8

The price depends on the number of shards

## FastNear provider

FastNear provides a service to access the NEAR Protocol data

- [FastNear](https://fastnear.com/)
- [Near Data Server](https://github.com/fastnear/neardata-server/)

FastNear provider is a new way to get the data from NEAR Protocol. It is a separate service that provides the data in a more efficient way.

### How to use it:

```rust
use futures::StreamExt;
use near_lake_framework::FastNearConfigBuilder;

#[tokio::main]
async fn main() {

let config = FastNearConfigBuilder::default()
.testnet()
.start_block_height(82422587)
.build()
.expect("Failed to build LakeConfig");

let (_, stream) = near_lake_framework::streamer(config);

while let Some(streamer_message) = stream.recv().await {
eprintln!("{:#?}", streamer_message);
}
}
```
### How to migrate from Lake to FastNear:

- Replace `LakeConfigBuilder` with `FastNearConfigBuilder`
- Replace `LakeConfig` with `FastNearConfig`

## Future plans

We use Milestones with clearly defined acceptance criteria:
Expand Down
Loading

0 comments on commit 37764c6

Please sign in to comment.