You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Subgraphs use AssemblyScript which is a subset of Typescript, to write their mapping handlers. SubQuery uses Typescript for its handlers. The CLI migrate command should be updated to convert the Subgraph handlers into SubQuery compatible handlers.
Requirements
Test coverage of at least 80% for new code changes
Generate code that uses Subquery best practices and optimisations
Require no more user interaction than is currently required
Generate the same folder structure as used in SubQuery starters
A best effort to have code that compiles without any changes. This should cover all trivial cases
Code changes
This is the bulk of the required changes:
Imports
Remove imports for graph dependencies
Update imports for generated code
Function signatures
Update handler arguments to use the types generated using subql codegen
Update handler functions to be async
Update accessing properties from event/transaction/block
Entities
Update Entity.load to await Entity.get. Note: subquery returns undefined instead of null if the entity is not defined
Update creating entities to use Entitiy.create where possible
Update entity.save() to await entity.save()
Contract calls
Use generated factories to create instances of contracts
Use methods from contract instances
Implementation
The entrypoint for these changes should be done here
The implementation should use the Typescript Compiler API to traverse the AST and make changes.
The text was updated successfully, but these errors were encountered:
Description
Subgraphs use AssemblyScript which is a subset of Typescript, to write their mapping handlers. SubQuery uses Typescript for its handlers. The CLI migrate command should be updated to convert the Subgraph handlers into SubQuery compatible handlers.
Requirements
Code changes
This is the bulk of the required changes:
subql codegen
Entity.load
toawait Entity.get
. Note: subquery returns undefined instead of null if the entity is not definedEntitiy.create
where possibleentity.save()
toawait entity.save()
Implementation
The entrypoint for these changes should be done here
The implementation should use the Typescript Compiler API to traverse the AST and make changes.
The text was updated successfully, but these errors were encountered: