Skip to content

Commit

Permalink
Revert "Add additional event handlers for bounties (#60)"
Browse files Browse the repository at this point in the history
This reverts commit c8b16b0.
  • Loading branch information
jnaviask committed May 24, 2021
1 parent c8b16b0 commit 6fe3063
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 54 deletions.
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,4 @@ yarn-error.log
coverage/
.env
dist/
*.tgz

.yalc/
yalc.lock
*.tgz
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ Please submit any enhancements or bug fixes as a Pull Request on the [project's

## Development

```
npm install -g npm-install-peers
```

For using a local version of Chain Events in other projects, we recommend you use `yalc`, which functions as a local package repository for your `npm` libraries in development.

To install `yalc`, run:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
"types": "dist/index.d.ts",
"scripts": {
"build": "tsc",
"prepare": "npx install-peers",
"unit-test": "nyc ts-mocha --config ./.mocharc.json ./test/unit/**/*.spec.ts",
"marlin-test": "nyc ts-mocha --config ./.mocharc.json ./test/integration/marlin.spec.ts",
"integration-test": "nyc ts-mocha --config ./.mocharc.json ./test/integration/*.spec.ts",
"test": "nyc ts-mocha --config ./.mocharc.json ./test/integration/*.spec.ts ./test/unit/**/*.spec.ts",
"prepare": "install-peers",
"lint": "eslint src/ test/",
"listen": "ts-node -T ./scripts/listener.ts",
"listen-archival": "ts-node -T ./scripts/listener.ts -n edgeware-local -a true",
Expand Down
36 changes: 1 addition & 35 deletions src/substrate/filters/enricher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -730,12 +730,11 @@ export async function Enrich(
}

case EventKind.TreasuryBountyExtended: {
const [bountyIndex, remark] = (event.data as unknown) as [BountyIndex, any];
const [bountyIndex] = (event.data as unknown) as [BountyIndex] & Codec;
return {
data: {
kind,
bountyIndex: +bountyIndex,
remark: remark?.toHuman(),
},
};
}
Expand Down Expand Up @@ -1178,39 +1177,6 @@ export async function Enrich(
},
};
}

case EventKind.TreasuryBountyBecameActive: {
const [idx] = extrinsic.args as [BountyIndex];
return {
data: {
kind,
bountyIndex: +idx,
},
};
}

case EventKind.TreasuryBountyExtended: {
const [idx, remark] = extrinsic.args as [BountyIndex, any];
return {
data: {
kind,
bountyIndex: +idx,
remark: remark?.toHuman(),
},
};
}

case EventKind.TreasuryBountyAwarded: {
const [idx, beneficiary] = extrinsic.args as [BountyIndex, AccountId];
return {
data: {
kind,
bountyIndex: +idx,
beneficiary: beneficiary.toString(),
},
};
}

default: {
throw new Error(`unknown event type: ${kind}`);
}
Expand Down
9 changes: 1 addition & 8 deletions src/substrate/filters/type_parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,29 +186,22 @@ export function ParseType(
}
case 'bounties': {
switch (method) {
case 'proposeBounty':
case 'BountyProposed':
return EventKind.TreasuryBountyProposed;
case 'rejectBounty': // TODO: To be tested
case 'BountyRejected':
return EventKind.TreasuryBountyRejected;
case 'acceptCurator':
case 'BountyBecameActive':
return EventKind.TreasuryBountyBecameActive;
case 'awardBounty':
case 'BountyAwarded':
return EventKind.TreasuryBountyAwarded;
case 'claimBounty':
case 'BountyClaimed':
return EventKind.TreasuryBountyClaimed;
case 'cancelBounty': // TODO: To be tested
case 'BountyCanceled':
return EventKind.TreasuryBountyCanceled;
case 'extendBountyExpiry':
case 'BountyExtended':
return EventKind.TreasuryBountyExtended;
default:
throw new Error('invalid case: ' + method);
throw new Error('invalid case');
}
}
default:
Expand Down
3 changes: 1 addition & 2 deletions src/substrate/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -482,10 +482,9 @@ export interface ITreasuryBountyCanceled extends IEvent {
}

export interface ITreasuryBountyExtended extends IEvent {
// A bounty expiry is extended. [index, remark]
// A bounty expiry is extended. [index]
kind: EventKind.TreasuryBountyExtended;
bountyIndex: number;
remark: string;
}

/**
Expand Down

0 comments on commit 6fe3063

Please sign in to comment.