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

Near migration from Thegraph #385

Closed
wants to merge 1 commit into from

Conversation

web3cdnservices
Copy link

No description provided.

Copy link
Contributor

@stwiname stwiname left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this.

Do you mind switching the example to this project https://github.com/graphprotocol/graph-tooling/tree/main/examples/near-receipts its much more relevant to a real world example.

It would also be good to see more details about modifying the handler functions and saving entities.

Comment on lines +92 to +103
```
mkdir -p docker && nano docker/load-extensions.sh
```
And paste content:

```
#!/bin/sh

psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<EOF
CREATE EXTENSION IF NOT EXISTS btree_gist;
EOF
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great to combine this into a single command and avoid using a specific editor.

mkdir -p docker && echo "<file contents>" > docker/load-extensions.sh

The same applies for any other files created

"target": "es2017",
"strict": true
},
"include": ["src/**/*", "node_modules/@subql/types/dist/global.d.ts"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this out, i have fixed this in the starter templates

Suggested change
"include": ["src/**/*", "node_modules/@subql/types/dist/global.d.ts"]
"include": ["src/**/*", "node_modules/@subql/types-near/dist/global.d.ts"]

Open src/mapping.ts

- Remove all graphql entries.
- Add new requirements frim subquery libs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Add new requirements frim subquery libs
- Add new requirements from subquery libs

Comment on lines +268 to +269
**Generate types & mpdels**
`yarn codefen`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Generate types & mpdels**
`yarn codefen`
**Generate types & models**
`yarn codegen`

kind: near/BlockHandler
filter:
modulo: 10
type: Transfer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type filter doesn't work with a blockhandler.

@jamesbayly
Copy link
Collaborator

jamesbayly commented Aug 10, 2023

Instead of this perscriptive approach to renaming files, you might want to suggest that they subql init a near NEAR project and port over the changes. This means you can skip all the boilerplate (e.g. docker-compose, /docker, and package.json) and instead focus on clearly explaining the differences in NEAR between SubQuery and The Graph (specifically in the project.yml, graphql.schema and mapping files).

You can also reuse content from https://academy.subquery.network/build/graph-migration.html but adapt the example code to your NEAR project

@jamesbayly
Copy link
Collaborator

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

Successfully merging this pull request may close these issues.

[$75 in kSQT] Add Graph Migration Docs for NEAR
3 participants