Git Product home page Git Product logo

subql-near's Introduction

Welcome to SubQuery!

Flexible, reliable, and decentralised APIs for your web3 project

SubQuery is an Open, Flexible, Fast and Universal data indexing framework for web3. Our mission is to help developers create the decentralised products of the future.

SubQuery allows every Substrate/Polkadot team to process and query their data. The project is inspired by the growth of data protocols serving the application layer and its aim is to help Polkadot/Substrate projects build better dApps by allowing anyone to reliably find and consume data faster. Today, anyone can query and extract Polkadot network data in only minutes and at no cost.

The future is multi-chain - SubQuery is no different. SubQuery is well on our way to support all leading blockchain networks with support for the following:

Get Started

Create a SubQuery project

You can follow our Quick Start Guide to learn how to create, initialize, build, and publish a new SubQuery Project using the @subql/cli tool.

Learn and improve with our comprehensive documentation

Dig into every term, usecases, and best-practices that help you build a dApp which your users love. Take a look at our detailed technical documentation.

Publish your SubQuery Project to our Managed Service

Don't want to worry about running your own indexing infrastructure? SubQuery provides a managed Service with industry leading hosting so you can sleep easy. Trused by hundreds of projects with millions of daily requests, follow our publishing guide to see how you can upload your project to SubQuery Projects.

Run your own Indexer and Query Service

Follow our guide to run your own SubQuery local node that you can use to debug, test, and run you own GraphQL server

You're going to need to a Postgres database, a node to extract chain data, and a moderately powerful computer to run the indexer in the background.

You'll also use our custom-built GraphQL query service @subql/query to interact with your SubQuery project.

Components

Contribute

We love contributions and feedback from the community. To contribute the code, we suggest starting by creating an issue in our main repository so we can give you support.

Copyright

SubQuery is a project built with love from the team at SubQuery all the way from New Zealand

Copyright © 2022 SubQuery Pte Ltd authors & contributors

subql-near's People

Contributors

bighammerw avatar bz888 avatar cagucor avatar dependabot[bot] avatar filo87 avatar fishmonger45 avatar greatguoyuhao avatar guplersaxanoid avatar hariu-starfish avatar ianhe8x avatar jamesbayly avatar jiqiang90 avatar lamcc21 avatar mikedotexe avatar mingyang-li avatar mozgiii avatar mzxyz avatar paulvi avatar raycar5 avatar seandotau avatar spitko avatar stwiname avatar yoozo avatar yrong avatar zhex avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

web3cdnservices

subql-near's Issues

Workers are broken

Because Near regularly skips blocks we handle blocks missing, but this doesn't seem to be working when workers are enabled.

We should properly handle missing blocks with workers.

NEARAction No longer has Transaction Record

Prerequisites

  • Are you running the latest version(s)?

Description

THe NearAction from "@subql/types-near" no longer has access to action.transaction (transaction is null/undefined)

Steps to Reproduce

  1. Pull the near starter project
  2. Run the project
near-subql-starter-subquery-node-1   | 2023-03-10T23:58:02.457Z <sandbox> INFO Handling action at 80980003 
near-subql-starter-subquery-node-1   | 2023-03-10T23:58:02.470Z <BlockDispatcherService> ERROR failed to index block at height 80980004 handleAction(TypeError: Cannot read properties of undefined (reading 'block_height')

Support wildcards for contracts and accounts

For example - *.poolv1.near would index all the existing poolv1.near contracts

In order to support this with the dictionary we possibly need to make changes to the query service for string matching or find a way to build the queries differently

Index Transaction Receipts

Description

Currently, transaction receipts are not being indexed. Although, the receipts are not exposed by near-api-js (source), it can be fetched from the RPC call made here. These receipts can be parsed and indexed alongside their corresponding transactions.

Unable to skip unavailable blocks when running workers

Prerequisites

  • Are you running the latest version(s)?
  • Have you searched the documentation for your issue?
  • Did you search for an existing issue or pull request?

Description

Screenshot 2023-11-08 at 7 39 08 PM
When running without workers, unavailiable blocks are skipped, however, this is not the case when workers are implemented.

Steps to Reproduce

Run any subql-near project, with workers enabled

Example project: [A link to a minimal example that can reproduce the issue]

Expected behavior: [What you expected to happen]

Actual behavior: [What actually happened]

Any other information

Is there any other information you would like to add?

Skip Missing Blocks

Description

Near seems to skip blocks from time to time. We have the bypassBlocks feature but this is impractical for all projects to keep this list.

We should detect skipped blocks by checking for a specific error and skip over them automatically

Example Error

Failed to fetch blocks from queue Error: [-32000] Server error: DB Not Found Error: BLOCK HEIGHT: 81003306 Cause: Unknown at JsonRpcProvider.<anonymous> (/usr/local/lib/node_modules/@subql/node-near/node_modules/near-api-js/lib/providers/json-rpc-provider.js:366:35) at Generator.next (<anonymous>) at fulfilled (/usr/local/lib/node_modules/@subql/node-near/node_modules/near-api-js/lib/providers/json-rpc-provider.js:5:58) at runMicrotasks (<anonymous>) at processTicksAndRejections (node:internal/process/task_queues:96:5)

Further information

https://stackoverflow.com/questions/71197370/why-blocks-are-missing-or-skipped-on-near

Add Meta Transactions support

Description

I'm encountering an Invalid type string for NearAction error when parsing block 100051916:

subql-starter-subquery-node-1   | 2023-09-03T23:29:52.689Z <api> ERROR Failed to fetch blocks 100051916...100051916 Error: Invalid type string for NearAction

I haven't dug too deep, but assume this is related to the recent addition of Meta-transactions, which introduced the new Delegate action type.

After a quick search of the code base I can see that parseNearAction doesn't support DelegateActions, and given that block 100051916 does contain a delegate action my initial assumption seems likely.

Details

These details can help to reproduce the environment the issue is occurring

Local Environment: @subql/cli/3.6.1 darwin-arm64 node-v18.16.0
Query Version: onfinality/subql-node-near:latest
Indexer Version: onfinality/subql-query:latest
Network Details:

  • Mainnet
  • 100051916
  • Dictionary endpoint not used

Steps to Reproduce

Run any Near based SubQL project with a startBlock earlier than 100051916

Decode NEAR Function call args

{
  "actions": [
    {
      "FunctionCall": {
        "args": "eyJhY2NvdW50X2lkIjoicHl0aGlhLm5lYXIifQ==",
        "deposit": "0",
        "gas": 30000000000000,
        "method_name": "add_oracle"
      }
    }
  ],
  "hash": "ArrxpznheAyfPg3piddiFX1UVb3nNjgzxE3h9Zt6iv8J",
  "nonce": 50838134000002,
  "public_key": "ed25519:A7NQzUDfS6dnYGvtTRisWCJrFv1deNyChEwR5V6JTvNR",
  "receiver_id": "priceoracle.near",
  "signature": "ed25519:35k5EFxKRMMU8DRa4HXo1Hkgn1W5hPYsPV85xuUsYsyijwZaPiDhSpKahdEdLvyxeAv3HRx2carQ4ZtwsbB5kgg6",
  "signer_id": "priceoracle.near",
  "gas_price": "100000000",
  "gas_used": "2428005965492",
  "block_hash": "GSEGB4rnCaC7VkRdmUjYzha5CqePB6W32EFa7FGDTqjF",
  "block_height": 50838341,
  "timestamp": 1634923432642397700,
  "result": {
    "id": "ArrxpznheAyfPg3piddiFX1UVb3nNjgzxE3h9Zt6iv8J",
    "logs": [
      
    ]
  }
}

Args should be decoded from:

eyJhY2NvdW50X2lkIjoicHl0aGlhLm5lYXIifQ== to {"account_id":"pythia.near"}

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.