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 type as a filter argument on the operations endpoint #186

Open
kalepail opened this issue Nov 13, 2019 · 5 comments
Open

Add type as a filter argument on the operations endpoint #186

kalepail opened this issue Nov 13, 2019 · 5 comments

Comments

@kalepail
Copy link

kalepail commented Nov 13, 2019

{
  operations (
    first: 100
    type: "CreatePassiveSellOfferOperation"
  ) {
    nodes {
      type
    }
  }
}

Would be a very helpful endpoint for some research we're doing internally at SDF.

@charlie-wasp
Copy link
Contributor

@tyvdh in fact, Astrograph already supports such filter. For your example it would look like:

{
  operations (
    first: 100
    type: createPassiveSellOffer
  ) {
    nodes {
      type
    }
  }
}

@kalepail
Copy link
Author

I get

{
  "error": {
    "errors": [
      {
        "message": "Unknown argument \"type\" on field \"operations\" of type \"Query\".",
        "extensions": {
          "code": "GRAPHQL_VALIDATION_FAILED",
          "exception": {
            "stacktrace": [
              "GraphQLError: Unknown argument \"type\" on field \"operations\" of type \"Query\".",
              "    at Object.Argument (/var/www/astrograph/source/node_modules/graphql/validation/rules/KnownArgumentNames.js:60:29)",
              "    at Object.enter (/var/www/astrograph/source/node_modules/graphql/language/visitor.js:324:29)",
              "    at Object.enter (/var/www/astrograph/source/node_modules/graphql/language/visitor.js:375:25)",
              "    at visit (/var/www/astrograph/source/node_modules/graphql/language/visitor.js:242:26)",
              "    at Object.validate (/var/www/astrograph/source/node_modules/graphql/validation/validate.js:73:24)",
              "    at validate (/var/www/astrograph/source/node_modules/apollo-server-core/dist/requestPipeline.js:212:32)",
              "    at Object.<anonymous> (/var/www/astrograph/source/node_modules/apollo-server-core/dist/requestPipeline.js:125:42)",
              "    at Generator.next (<anonymous>)",
              "    at fulfilled (/var/www/astrograph/source/node_modules/apollo-server-core/dist/requestPipeline.js:5:58)",
              "    at process._tickCallback (internal/process/next_tick.js:68:7)"
            ]
          }
        }
      }
    ]
  }
}

When running that query

@kalepail
Copy link
Author

Oddly enough it works on testnet, just not on https://demo.astrograph.io/graphql/

@charlie-wasp
Copy link
Contributor

@tyvdh ah, yes, it works only on the testnet, because testnet instance uses ElasticSearch storage, so we can filter operations on our side. Pubnet instance relies on the Horizon, so we're limited by its filtering features

@kalepail
Copy link
Author

ETA on when pubnet will be moved to ES? Having testnet mismatched from pubnet greatly reduces the usefulness of this service. :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants