Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 3rd party data APIs #2347

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 151 additions & 0 deletions docs/4.tools/ecosystem-apis/fastnear-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
---
id: fastnear-api
title: FastNEAR API
sidebar_label: FastNEAR API
---

[FastNEAR](https://fastnear.com/) provides high-performance infrastructure enabling seamless blockchain interactions.

## Overview

[FastNEAR](https://fastnear.com/) exposes low-latency APIs for wallets and explorers. Their API allows you to easily query the NEAR blockchain to get an account's assets, map keys into account IDs, explore a block's transactions, etc.

:::info More info

Find more information about the FastNear API in their [services page](https://fastnear.com/services).

:::

## RPC implementation

[Fast-Near](https://github.com/fastnear/fast-near) aims to provide the fastest RPC implementation for NEAR Protocol using high-performance storage backends:
- in-memory storage in [Redis](https://redis.io/).
- SSD optimized storage using [LMDB](https://www.symas.com/lmdb).

It is optimized for `view` call performance and ease of deploy and scaling.


:::note About data sync
FastNear doesn't sync with the NEAR blockchain on its own. Data needs to be loaded either from [NEAR Lake](https://github.com/near/near-lake-indexer) or from [Near State Indexer](https://github.com/vgrichina/near-state-indexer).
:::

---

## Endpoints

The [FastNEAR API server](https://github.com/fastnear/fastnear-api-server-rs) provides a low-latency RPC API for wallets and explorers.

- Mainnet: `https://api.fastnear.com`
- Testnet: `https://test.api.fastnear.com`

#### Public Key

- Public Key to Account ID mapping.
- Full Access Public Key to Account ID mapping.
- Any Public Key to Account ID mapping.

#### Account ID

- Account ID to delegated staking pools (validators).
- Account ID to fungible tokens (FT contracts).
- Account ID to non-fungible tokens (NFT contracts).

#### Token ID

- Token ID to top 100 accounts by balance (for FT contracts).


:::tip V1 API

[Click here](https://github.com/fastnear/fastnear-api-server-rs?tab=readme-ov-file#api-v1) to see the complete list of API endpoints and usage examples.

:::

## Examples

### [Blockchain Data](https://github.com/fastnear/neardata-server/)

- Query last block produced

```bash
# Query last block produced
curl https://mainnet.neardata.xyz/v0/last_block/final
```

<details>
<summary> Response </summary>

```json
{
"block": {
"author": "aurora.pool.near",
"header": {
"height": 129311487,
"prev_height": 129311486,
...
}
}
}
```

</details>

### [User Queries](https://github.com/fastnear/fastnear-api-server-rs)

- Query user's FTs

```bash
# Query user's FTs
curl https://api.fastnear.com/v1/account/root.near/ft
```

<details>
<summary> Response </summary>

```json
{"account_id":"root.near","tokens":[{"balance":"199462092","contract_id":"pixeltoken.near","last_update_block_height":null},...
```

</details>

---

- Query user's NFTs

```sh
# Query user's NFTs
curl https://api.fastnear.com/v1/account/root.near/nft
```

<details>
<summary> Response </summary>

```json
{"account_id":"root.near","tokens":[{"contract_id":"nft.goodfortunefelines.near","last_update_block_height":null},...
```

</details>

---

- Query all user's assets

```sh
# Query all user's assets
curl https://api.fastnear.com/v1/account/root.near/full
```

<details>
<summary> Response </summary>

```json
{
"account_id": "root.near",
"tokens": [
{ "balance": "199462092", "contract_id": "the-token.near" },
...
]
}
```

</details>
86 changes: 86 additions & 0 deletions docs/4.tools/ecosystem-apis/nearblocks-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
id: nearblocks-api
title: NearBlocks API
sidebar_label: NearBlocks API
---

The [NearBlocks API](https://api.nearblocks.io/api-docs/) provides a simple way to query actions that happened on a NEAR account, such as function calls, token transfers, etc.

## Overview

The [NearBlocks](https://nearblocks.io/) Developer [REST APIs](https://nearblocks.io/apis) are provided as a community service and without warranty, so please use what you need and no more.

NearBlocks also provides an API Pro plan which is a monthly subscription-based API service that provides higher rate limits for power users and commercial solutions. To upgrade to a paid API Plan, head over to the APIs page and select a plan that suits your needs. Once payment has been made, you can create API keys to make requests to our end points.

## Endpoints

You can find the complete API endpoint list in [this page](https://api.nearblocks.io/api-docs/).
You can access the REST APIs using [cURL](http://curl.se), or any HTTP client.

- Mainnet: `https://api.nearblocks.io`
- Testnet: `https://api-testnet.nearblocks.io`

:::note
NearBlocks API supports `GET` requests only.
:::

If you have a Pro subscription, you can pass the API key into a REST API call as `Authorization` header with the following format. Replace `API_KEY` with the key string of your API key. For example, to pass an API key for an Account API:

```sh
curl -X GET -H "Authorization: Bearer API_KEY" "https://api.nearblocks.io/v1/account/wrap.near"
```

:::tip More info

Check the [API documentation](https://api.nearblocks.io/api-docs/) for more information about the NearBlocks API.
:::

## Examples

- All the times **anyone** called `create_drop` on Keypom

```bash
# All the times **anyone** called "create_drop" on Keypom
curl -X GET "https://api.nearblocks.io/v1/account/v2.keypom.near/txns?method=create_drop"
```

<details>
<summary> Response </summary>

```json
{"cursor":"10055367839","txns":[{"id":"10830753377","receipt_id":"5F79mMVCnRrHRbdYmrSPjRwnAgUBc3H2okMHo69cZcJV","predecessor_account_id":"dragov.near","receiver_account_id":"v2.keypom.near","receipt_kind":"ACTION","receipt_block":{"block_hash":"E3KaP9w1y8CzWFajYBjx9oJFuhjjXuM8vaNPdnAXJeHp","block_height":134346961,"block_timestamp":1733475275522260000},"receipt_outcome":{"gas_burnt":5361098685764,"tokens_burnt":536109868576400000000,"executor_account_id":"v2.keypom.near","status":true},"transaction_hash":"9Y6WvywzX23YLCEuoXDqcaYJMRYihpXWwb4gsBwuXJFX","included_in_block_hash":"yfiq5z1JK6xUzdJk71W1N8yiK65Xt7xFXs6aiKLDtSH","block_timestamp":"1733475274374657534","block":{"block_height":134346960},"receipt_conversion_tokens_burnt":"31845454987000000000","actions":[{"action":"FUNCTION_CALL","method":"create_drop","deposit":1.0426e+24,"fee":536109868576400000000,"args":"{\"drop_id\": \"1733475264350\", \"metadata\": \"{\\\\\\\\\\\\\\\"dropName\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\"Vrscert NEAR account creation \\\\\\\\\\\\\\\"}\", \"public_keys\": [\"ed25519:DJrjp8VpUKn3dnfV7Yyt2BHCC3wujjjjynUHhkrJWpVQ\"], \"deposit_per_use\": \"1000000000000000000000000\"}"}],"actions_agg":{"deposit":1.0426e+24},"outcomes":{"status":true},"outcomes_agg":{"transaction_fee":588989004589500000000}}, ...
```

</details>

---

- All the times that `gagdiez.near` called `create_drop` on Keypom

```sh
# All the times that gagdiez.near called "create_drop" on Keypom
curl -X GET "https://api.nearblocks.io/v1/account/v2.keypom.near/txns?method=create_drop&from=gagdiez.near"
```


<details>
<summary> Response </summary>

```json
{
"txns": [
{
"predecessor_account_id": "gagdiez.near",
"receiver_account_id": "v2.keypom.near",
"receipt_kind": "ACTION",
"receipt_outcome": {
"status": true,
...
},
...
}
]
}
```

</details>
149 changes: 149 additions & 0 deletions docs/4.tools/ecosystem-apis/pikespeak-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
---
id: pikespeak-api
title: Pikespeak API
sidebar_label: Pikespeak API
---

[Pikespeak](https://pikespeak.ai) offers an enterprise-grade API where you can fetch blockchain events and aggregated analytics on wallets, validators, delegators, money transfers, dApps activity, and more.

## Overview

Pikespeak is a Data & Analytics solution built on NEAR Protocol.
Since inception, Pikespeak has recorded over 1 billion on-chain events and generated over 40 data points for more than 60 million accounts. Actionable data that can supercharge Web3 projects, allowing them to take action.
The solution provides:

- Dashboards and visualizations of the most fundamental Web3 use cases;
- An API with 50+ endpoints to consume live, historical data, and insights in a programmatic way.


## Endpoints

To access the Pikespeak API you'll need to [register and create an account](https://pikespeak.ai/plans). Once you're registered, under the [`My Account`](https://pikespeak.ai/myaccount) page you can get your API key.

You can find the complete API endpoint list in [this page](https://doc.pikespeak.ai/).
You can access the REST APIs using [cURL](http://curl.se), or any HTTP client.

- Mainnet: `https://api.pikespeak.ai`

:::tip More info

Check the [API documentation](https://doc.pikespeak.ai/) for more information about the Pikespeak API.
:::

## Examples

- Account balance for `root.near`:

```sh
curl -X 'GET' \
'https://api.pikespeak.ai/account/balance/root.near' \
-H 'accept: application/json' \
-H 'x-api-key: YOUR-PIKESPEAK-API-KEY'
```

<details>
<summary> Response </summary>

```json
[
{
"contract": "Near",
"amount": 5796.337470826706,
"symbol": "NEAR",
"isParsed": true,
"icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA2AAAANgCAIAAADF8JzzAAA...
}
]
```

</details>

---

- Most active wallets NEAR senders:

```sh
curl -X 'GET' \
'https://api.pikespeak.ai/hot-wallets/near' \
-H 'accept: application/json' \
-H 'x-api-key: YOUR-PIKESPEAK-API-KEY'
```

<details>
<summary> Response </summary>

```json
{
"totalAmount": "43620883.893401468080059376309428",
"totalUSDValue": "0",
"topAccounts": [
{
"account": "jap1m48ko2uu.users.kaiching",
"amount": "0.00642925390730650000000",
"txCount": "1",
"usdValue": "0"
},
{
"account": "jb6050zkcoky.users.kaiching",
"amount": "0.00924935417618550000000",
"txCount": "1",
"usdValue": "0"
},
...
]
}
```

</details>

---

- Get historic account events for `keypom.near`:

```sh
curl -X 'GET' \
'https://api.pikespeak.ai/event-historic/keypom.near' \
-H 'accept: application/json' \
-H 'x-api-key: YOUR-PIKESPEAK-API-KEY'
```

<details>
<summary> Response </summary>

```json
[
{
"direction": "send",
"transaction_id": "Beh3TGHXWveH7n2aWmPoVUsFMuMSWUyKStZNccYbnUJA",
"receipt_id": "DvMhKedP25koZTw2RJ2DW3A8Ch4C7FsrZQZFv8hNCRkk",
"index": 0,
"sender": "keypom.near",
"receiver": "chaotictempest.near",
"type": "NEAR_TRANSFER",
"block_height": "132716642",
"timestamp": "1731632151999",
"transaction_type": "SEND_RECEIVE",
"token": null,
"2fa": false,
"amount": "5.00000000000000000000000",
"transaction_view": {
"type": "NEAR_TRANSFER",
"index": 0,
"amount": 5,
"sender": "keypom.near",
"status": true,
"two_fa": false,
"receiver": "chaotictempest.near",
"timestamp": 1731635751999756300,
"receipt_id": "DvMhKedP25koZTw2RJ2DW3A8Ch4C7FsrZQZFv8hNCRkk",
"block_height": 132716642,
"transaction_id": "Beh3TGHXWveH7n2aWmPoVUsFMuMSWUyKStZNccYbnUJA",
"transaction_type": "SEND_RECEIVE"
},
"amount_numeric": "5.00000000000000000000000"
},
...
]
```

</details>
Loading
Loading