-
Notifications
You must be signed in to change notification settings - Fork 1
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
[Proxy colonies] Feat: create proxy chain block ingestor #298
Merged
mmioana
merged 1 commit into
feat/proxy-colonies-dev-env
from
feat/proxy-chain-ingestor
Dec 20, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
CHAIN_RPC_ENDPOINT=http://localhost:8545 | ||
CHAIN_NETWORK_CONTRACT=0x777760996135F0791E2e1a74aFAa060711197777 | ||
STATS_PORT=10001 |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,16 +1,18 @@ | ||
{ | ||
"name": "@joincolony/main-chain", | ||
"version": "1.0.0", | ||
"main": "src/index.ts", | ||
"scripts": { | ||
"build": "rm -rf dist/* && npx tsc", | ||
"start": "node -r ts-node/register/transpile-only -r tsconfig-paths/register -r ./src/env.ts dist/index.js", | ||
"dev": "NODE_ENV=development ts-node-dev -r tsconfig-paths/register -r ./src/env.ts src/index.ts", | ||
"prod": "pnpm run build && NODE_ENV=production pnpm run start", | ||
"typecheck": "tsc --noEmit" | ||
}, | ||
"dependencies": { | ||
"@joincolony/graphql": "workspace:*" | ||
} | ||
"name": "@joincolony/main-chain", | ||
"version": "1.0.0", | ||
"main": "src/index.ts", | ||
"scripts": { | ||
"build": "rm -rf dist/* && npx tsc", | ||
"start": "node -r ts-node/register/transpile-only -r tsconfig-paths/register -r ./dist/env.js dist/index.js", | ||
"dev": "NODE_ENV=development ts-node-dev -r tsconfig-paths/register -r ./src/env.ts src/index.ts", | ||
"prod": "pnpm run build && NODE_ENV=production pnpm run start", | ||
"typecheck": "tsc --noEmit" | ||
}, | ||
"dependencies": { | ||
"@joincolony/graphql": "workspace:*", | ||
"@joincolony/clients": "workspace:*", | ||
"@joincolony/blocks": "workspace:*", | ||
"@joincolony/utils": "workspace:*" | ||
} | ||
} |
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 |
---|---|---|
@@ -1,61 +1,8 @@ | ||
import { Amplify, API, graphqlOperation } from 'aws-amplify'; | ||
import { GraphQLQuery } from '@aws-amplify/api'; | ||
import { DocumentNode, isExecutableDefinitionNode } from 'graphql'; | ||
import { verbose } from '~utils'; | ||
import { AmplifyClient } from '@joincolony/clients'; | ||
|
||
export default (): void => { | ||
Amplify.configure({ | ||
aws_appsync_graphqlEndpoint: `${process.env.AWS_APPSYNC_ENDPOINT}`, | ||
aws_appsync_authenticationType: 'API_KEY', | ||
aws_appsync_apiKey: process.env.AWS_APPSYNC_KEY, | ||
}); | ||
}; | ||
const amplifyClient = new AmplifyClient( | ||
process.env.AWS_APPSYNC_ENDPOINT || '', | ||
process.env.AWS_APPSYNC_KEY || '', | ||
); | ||
|
||
export type GraphQLFnReturn<T> = Promise< | ||
ReturnType<typeof API.graphql<GraphQLQuery<T>>> | undefined | ||
>; | ||
|
||
export const query = async <T, TVariables extends Record<string, unknown>>( | ||
queryDocument: DocumentNode, | ||
variables?: TVariables, | ||
): GraphQLFnReturn<T> => { | ||
try { | ||
const result = await API.graphql<GraphQLQuery<T>>( | ||
graphqlOperation(queryDocument, variables), | ||
); | ||
|
||
return result; | ||
} catch (error) { | ||
const definitionNode = queryDocument.definitions[0]; | ||
const queryName = isExecutableDefinitionNode(definitionNode) | ||
? definitionNode.name?.value | ||
: 'Unknown'; | ||
console.error(`Could not fetch query ${queryName}`, error); | ||
return undefined; | ||
} | ||
}; | ||
|
||
export const mutate = async < | ||
T, | ||
TVariables extends Record<string, unknown> = {}, | ||
>( | ||
mutationDocument: DocumentNode, | ||
variables?: TVariables, | ||
): GraphQLFnReturn<T> => { | ||
try { | ||
const result = await API.graphql<GraphQLQuery<T>>( | ||
graphqlOperation(mutationDocument, variables), | ||
); | ||
|
||
return result; | ||
} catch (error: any) { | ||
const definitionNode = mutationDocument.definitions[0]; | ||
const mutationName = isExecutableDefinitionNode(definitionNode) | ||
? definitionNode.name?.value | ||
: 'Unknown'; | ||
|
||
const errMsg = 'errors' in error ? error.errors : error; | ||
verbose(`Could not execute mutation ${mutationName}. Error: `, errMsg); | ||
return undefined; | ||
} | ||
}; | ||
export default amplifyClient; |
This file was deleted.
Oops, something went wrong.
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,8 @@ | ||
import { BlockManager } from '@joincolony/blocks'; | ||
import eventManager from '~eventManager'; | ||
import rpcProvider from '~provider'; | ||
import statsManager from '~statsManager'; | ||
|
||
const blockManager = new BlockManager(eventManager, rpcProvider, statsManager); | ||
|
||
export default blockManager; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay this class setup is really nice when it leads to such nice simple files as this 😌