-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updating the schema, adding multi-emit test
- Loading branch information
Showing
9 changed files
with
230 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { createYoga, createSchema } from 'graphql-yoga'; | ||
import { loadSchemaSync } from '@graphql-tools/load'; | ||
import { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader'; | ||
import { buildHTTPExecutor } from '@graphql-tools/executor-http'; | ||
import { parse } from 'graphql'; | ||
import { resolvers } from '../src/resolvers.js'; | ||
import { buildContext, GraphQLContext } from '../src/context.js'; | ||
|
||
const PG_CONN = 'postgresql://postgres:postgres@localhost:5432/archive '; | ||
const zkappAccount = 'B62qmBrPiukbHj4VnXdgMzjj2zpoQZeSBxZA6JDYMeeShApRAKaorto'; | ||
|
||
const actionsQuery = ` | ||
query getActions($input: ActionFilterOptionsInput!) { | ||
actions(input: $input) { | ||
blockInfo { | ||
stateHash | ||
timestamp | ||
height | ||
parentHash | ||
chainStatus | ||
distanceFromMaxBlockHeight | ||
globalSlotSinceGenesis | ||
} | ||
actionState { | ||
actionStateOne | ||
actionStateTwo | ||
actionStateThree | ||
actionStateFour | ||
actionStateFive | ||
} | ||
actionData { | ||
data | ||
accountUpdateId | ||
transactionInfo { | ||
status | ||
hash | ||
memo | ||
sequenceNumber | ||
zkappAccountUpdateIds | ||
zkappEventElementIds | ||
} | ||
} | ||
} | ||
} | ||
`; | ||
|
||
const schema = createSchema({ | ||
typeDefs: loadSchemaSync('./schema.graphql', { | ||
loaders: [new GraphQLFileLoader()], | ||
}), | ||
resolvers, | ||
}); | ||
const context = await buildContext(PG_CONN); | ||
const yoga = createYoga<GraphQLContext>({ schema, context }); | ||
const executor = buildHTTPExecutor({ | ||
fetch: yoga.fetch, | ||
}); | ||
|
||
const results = await executor({ | ||
variables: { | ||
input: { address: zkappAccount }, | ||
}, | ||
document: parse(`${actionsQuery}`), | ||
}); | ||
|
||
console.log(JSON.stringify(results)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.