Skip to content

Commit

Permalink
Merge pull request #5174 from kdembler/petra-qn-proposal-details
Browse files Browse the repository at this point in the history
[QN] fix handling of proposal details between spec versions 2003 and 2004
  • Loading branch information
mnaamani authored Jun 13, 2024
2 parents ed52b91 + 916bee8 commit 4fcb2e6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions query-node/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 2.4.1

- Fix handling of proposal details between spec versions 2003 and 2004

### 2.4.0

- Bump @joystream/types to Petra version
Expand Down
2 changes: 1 addition & 1 deletion query-node/mappings/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "query-node-mappings",
"version": "2.4.0",
"version": "2.4.1",
"description": "Mappings for hydra-processor",
"main": "lib/src/index.js",
"license": "MIT",
Expand Down
7 changes: 5 additions & 2 deletions query-node/mappings/src/proposals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ import {
} from './common'
import {
ProposalsCodex_ProposalCreatedEvent_V1001 as ProposalCreatedEvent_V1001,
ProposalsCodex_ProposalCreatedEvent_V2003 as ProposalCreatedEvent_V2003,
ProposalsCodex_ProposalCreatedEvent_V2004 as ProposalCreatedEvent_V2004,
ProposalsEngine_ProposalCancelledEvent_V1001 as ProposalCancelledEvent_V1001,
ProposalsEngine_ProposalDecisionMadeEvent_V1001 as ProposalDecisionMadeEvent_V1001,
Expand Down Expand Up @@ -401,10 +402,12 @@ export async function proposalsCodex_ProposalCreated({
event,
block,
}: EventContext & StoreContext): Promise<void> {
const specVersion = block.runtimeVersion.specVersion
const specVersion = Number(block.runtimeVersion.specVersion)
const [proposalId, generalProposalParameters, runtimeProposalDetails, proposalThreadId] =
Number(specVersion) < 2001
specVersion < 2001
? new ProposalCreatedEvent_V1001(event).params
: specVersion < 2004
? new ProposalCreatedEvent_V2003(event).params
: new ProposalCreatedEvent_V2004(event).params

const eventTime = new Date(event.blockTimestamp)
Expand Down
2 changes: 1 addition & 1 deletion query-node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "query-node-root",
"version": "2.4.0",
"version": "2.4.1",
"description": "GraphQL server and mappings. Generated with ♥ by Hydra-CLI",
"scripts": {
"build": "./build.sh",
Expand Down

0 comments on commit 4fcb2e6

Please sign in to comment.