nautls / ergo-graphql Goto Github PK
View Code? Open in Web Editor NEWErgo Platform GraphQL server
License: MIT License
Ergo Platform GraphQL server
License: MIT License
@aslesarenko on fleet-sdk/fleet#17 (comment)
any wallet, can use it to reduce transactions (which is necessary for ErgoPay)
and the wallet don't need to have interpreter implementation available.
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.
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.
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 tokens by the the minting box (Token.box
field) with the following objects:
{
ergoTree?: string;
registers?: AdditionalRegisters;
}
or
{
address?: string;
registers?: AdditionalRegisters;
}
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.
UnconfirmedInput
contains all we need for now.
Initially only indexed ones are required, namely boxId
and transactionId
.
Add some filters to get tokens containing or starting with a particular string.
This will allow programs to easily scan addresses for updates by using amount of boxes as a parameter. The problem is that since APIs only return around 50 or 500 boxes at most per call, we can't get box amount by getting the length of all boxes returned.
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.
Some use cases requires querying a box for multiple Token IDs.
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.
containsTokens
.We need to complete the project's unit tests and make them run in GH-actions
to ensure added code won't break anything.
Including mempool
These fields can be fetch from node's /info/
endpoint.
PS: difficulty
should be nullable, and as all BigInt, it also should be encoded as string
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.
In latest version this is fully broken with a large impact.
Source of the problem is this commit https://github.com/capt-nemo429/ergo-graphql/commit/e9a597855097e6efaa055cab668d730ff3f5f28d where maxHeight was forgotten to be removed from the resolver.
Tests were also not updated and not working atm.
Unhandled errors are stopping the server.
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
}
}
Currently .env doesn't contain an option for forcing SSL handshake for those DB connections which require it. Unless one is available but I am not aware of it.
Adding minHeight
and maxHeight
to resolvers would help more powerful filters throughout the code.
It's such a heavy query and not really necessary
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:
NETWORK
env var (including from README);MAINNET_MINER_FEE_ERGO_TREE
to MINER_FEE_ERGO_TREE
;TESTNET_MINER_FEE_ERGO_TREE
; andMINER_FEE_ERGO_TREE
.If you try to fetch boxes without params, it will result in a long running query, better to avoid this by requiring at least one query param.
including mempool
Also include mempool
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.