Fix for indexed reference type event arg in moby mask watcher

This commit is contained in:
nabarun 2022-06-28 20:22:02 +05:30 committed by Ashwin Phatak
parent 6cb424b315
commit 14a32a7d47
3 changed files with 53 additions and 7 deletions

View File

@ -465,7 +465,7 @@ export class Indexer implements IPLDIndexerInterface {
case {{capitalize event.name}}_EVENT: {
eventName = logDescription.name;
{{#if event.params}}
const { {{#each event.params~}} {{this.name}} {{~#unless @last}}, {{/unless}} {{~/each}} } = logDescription.args;
const [ {{#each event.params~}} {{this.name}} {{~#unless @last}}, {{/unless}} {{~/each}} ] = logDescription.args;
{{/if}}
eventInfo = {
{{#each event.params}}

View File

@ -97,6 +97,12 @@
yarn server
```
* Run the job-runner:
```bash
yarn job-runner
```
* Clone the [MobyMask](https://github.com/vulcanize/MobyMask) repo.
* Checkout to the branch with changes for using this watcher:
@ -130,6 +136,42 @@
export MOBY_ADDRESS="<MOBY_ADDRESS>"
```
* Run the following GQL mutation in watcher GraphQL endpoint http://127.0.0.1:3010/graphql
```graphql
mutation {
watchContract(
address: "MOBY_ADDRESS"
kind: "PhisherRegistry"
checkpoint: true
)
}
```
* Run the following GQL subscription in generated watcher GraphQL endpoint:
```graphql
subscription {
onEvent {
event {
__typename
... on PhisherStatusUpdatedEvent {
entity
isPhisher
},
... on MemberStatusUpdatedEvent {
entity
isMember
}
},
block {
number
hash
}
}
}
```
* Update isPhiser and isMember lists with names
```bash
@ -140,6 +182,8 @@
yarn claimMember --contract $MOBY_ADDRESS --name memberName
```
* The events should be visible in the subscription at GQL endpoint.
* Check the names in the watcher GraphQL playground http://localhost:3010/graphql
* Get the latest block

View File

@ -577,7 +577,7 @@ export class Indexer implements IPLDIndexerInterface {
switch (logDescription.name) {
case DELEGATIONTRIGGERED_EVENT: {
eventName = logDescription.name;
const { principal, agent } = logDescription.args;
const [principal, agent] = logDescription.args;
eventInfo = {
principal,
agent
@ -587,9 +587,10 @@ export class Indexer implements IPLDIndexerInterface {
}
case MEMBERSTATUSUPDATED_EVENT: {
eventName = logDescription.name;
const { entity, isMember } = logDescription.args;
const [entity, isMember] = logDescription.args;
eventInfo = {
entity,
// Indexed reference type arg
entity: entity.hash,
isMember
};
@ -597,7 +598,7 @@ export class Indexer implements IPLDIndexerInterface {
}
case OWNERSHIPTRANSFERRED_EVENT: {
eventName = logDescription.name;
const { previousOwner, newOwner } = logDescription.args;
const [previousOwner, newOwner] = logDescription.args;
eventInfo = {
previousOwner,
newOwner
@ -607,9 +608,10 @@ export class Indexer implements IPLDIndexerInterface {
}
case PHISHERSTATUSUPDATED_EVENT: {
eventName = logDescription.name;
const { entity, isPhisher } = logDescription.args;
const [entity, isPhisher] = logDescription.args;
eventInfo = {
entity,
// Indexed reference type arg
entity: entity.hash,
isPhisher
};