-
Notifications
You must be signed in to change notification settings - Fork 8
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 mocked ethereum call implementation #108
Conversation
e2bb0d9
to
e8abf5f
Compare
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.
@@ -35,7 +35,7 @@ export class Abi { | |||
} | |||
|
|||
private readArray<T>(ptr: Pointer, reader: (value: Pointer) => T): T[] | null { | |||
if (ptr === null) { | |||
if (ptr === 0) { |
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.
This should be caught by the typechecker (cf open issue), maybe we can use a lint rule for now to catch these: https://github.com/microsoft/TypeScript/issues/11920https://palantir.github.io/tslint/rules/strict-type-predicates/
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.
We're using ESLint-TypeScript (since, from what I understand, tslint
is deprecated) and I couldn't find the rule at first sight: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/README.md#extension-rules
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.
I think @typescript-eslint/no-unnecessary-condition
would have caught this (https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md).
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.
🕵️
describe('onTokenListing', function () { | ||
it('creates a token', async () => { | ||
const mappings = await Mappings.load() | ||
mappings.setCallHandler((call) => { |
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.
Cool, I assume in then long term we can just pass in the Abis and perform the calls automatically?
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.
Correct! The idea is to have something like we have for the events and entities, except for events. Ultimately, I think all of this should be auto-generated based on the subgraph.yaml
definition.
0dd5a70
to
dc72b4b
Compare
e8abf5f
to
fca044f
Compare
This PR adds an implementation for the last used The Graph host import 🎉 -
eth_call
s. With it comes unit tests for the new token listing handler code.Test Plan
Added new unit tests to run on CI 🤖