Giter VIP home page Giter VIP logo

ergo-graphql's People

Contributors

arobsn avatar capt-nemo429 avatar sepehrganji avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

nn-dmt

ergo-graphql's Issues

Complete Documentations

It's good to have some basic and advanced use-case examples in our documentation. This way, new users can dive into this project more quickly.

Add a way to know if a box is being spent

Currently, there is no way to know if a box is being used as an input in mempool. So I propose to add a boolean field called beingSpent in BoxResolver do address this as a one-query way.

If this field is selected in the query, it should return true if the boxId is present in node_u_inputs.

Observe that using @FieldResolver() decorator is not the best approach for this specific case, since it can result in multiple undesired database queries for a single GraphQL query. You can take a look at AddressResolver specifically at balance field to see a way to avoid this by using isFieldSelected function.

migrate to `@apollo`

Version 4 of apollo server is out. We have to migrate our server alongside its dependencies to version 4. This could cause some breaking changes as well.

Filter token by minting box params

Filter tokens by the the minting box (Token.box field) with the following objects:

{
  ergoTree?: string;
  registers?: AdditionalRegisters;
}

or

{
  address?: string;
  registers?: AdditionalRegisters;
}

Add `inputs` to mempool `resolver`

I just realized that we do not have an inputs field in the mempool resolver ๐Ÿ˜…, I think this is something necessary and should be added for the next release.

Fields

UnconfirmedInput contains all we need for now.

Query Args

Initially only indexed ones are required, namely boxId and transactionId.

Get mempool from node

Instead of getting the mempool stuff from the database, we could request an ergo node. This way, we have fewer intermediaries and potentially faster calls.

Query boxes by multiple Token IDs

Some use cases requires querying a box for multiple Token IDs.

Example:

If I want to fetch all boxes which contains tokenA and tokenB, I will pass Token IDs in containsTokens param and only boxes that contains both tokens will be returned.

Remarks

  • I think 5 tokenIds per query is a reasonable limit
  • Since conventionally we use multiple IDs as OR operator, would be good to make this different than other, so I suggest calling it containsTokens.

Complete unit tests

We need to complete the project's unit tests and make them run in GH-actions to ensure added code won't break anything.

Add `used` field into addresses resolver

Currently we have a way to check is an address is used by selecting transactionsCount field, if it is > 0 then the address is used, but I think we can verify this with a less resource spending query.

If used field is selected the resolver should look at node_outputs and return true if at least one box is owned by a given address.

`additionalRegisters` input bug

While filtering more than one register (Eg. R5 and R6) the box query does not return proper boxes.
Sample query:

{
  boxes(
    spent: true, 
    ergoTree: "100504000400050004000e20011d3364de07e5a26f0c4eef0852cddb387039a921b7154ef3cab22c6eda887fd803d601b2a5730000d602e4c6a70407d603b2db6501fe730100ea02d1ededededed93e4c672010407720293e4c67201050ec5720391e4c672010605730293c27201c2a793db63087201db6308a7938cb2db63087203730300017304cd7202",
  	registers: {
      R5: "0e209060ac3dfc62aa0a14c87b9f45e57f13ea37815db956efb3a0ca5cd49dd37d9f",
      R6: "0590c7949406"
    }
  ){
    additionalRegisters
    ergoTree
  }
}

Remove `NETWORK` env variable

With the new testnet, both mainnet and testnet miner fee ErgoTree are the same now. So there is no need to have a NETWORK env variable, as well as MAINNET_MINER_FEE_ERGO_TREE and TESTNET_MINER_FEE_ERGO_TREE constants.

So here is the task:

  • Remove NETWORK env var (including from README);
  • Rename MAINNET_MINER_FEE_ERGO_TREE to MINER_FEE_ERGO_TREE;
  • Remove TESTNET_MINER_FEE_ERGO_TREE; and
  • Adapt queries which make use of it to only query for MINER_FEE_ERGO_TREE.

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.