Skip to content

fix: align batchService.js stage mapping with constants/stages.js#198

Open
navin-oss wants to merge 1 commit intoNitya-003:mainfrom
navin-oss:fixxbug
Open

fix: align batchService.js stage mapping with constants/stages.js#198
navin-oss wants to merge 1 commit intoNitya-003:mainfrom
navin-oss:fixxbug

Conversation

@navin-oss
Copy link
Contributor

Fixed the stage inconsistency between constants/stages.js and batchService.js.

Issue: The stage mappings were completely different:

  • constants/stages.js: ['farmer', 'mandi', 'transport', 'retailer'] with mapping { farmer: 0, mandi: 1, transport: 2, retailer: 3 }
  • batchService.js: { 'farmer': 0, 'processor': 1, 'distributor': 2, 'retailer': 3, 'consumer': 4 } (hardcoded inline)

Fix applied:

  1. Imported STAGE_TO_NUMBER from constants/stages.js
  2. Replaced the hardcoded inline stageMap with the imported STAGE_TO_NUMBER

This now correctly matches the Solidity contract's Stage enum (Farmer=0, Mandi=1, Transport=2, Retailer=3), preventing blockchain sync failures.

@netlify
Copy link

netlify bot commented Mar 11, 2026

Deploy Preview for roaring-ganache-c7465f failed. Why did it fail? →

Name Link
🔨 Latest commit 77e6faf
🔍 Latest deploy log https://app.netlify.com/projects/roaring-ganache-c7465f/deploys/69b1878b397a7a00089fb8bc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant