Skip to content

Conversation

@gonzalo-smtv
Copy link

This pull request includes several changes to the PeaqDidGetRealCampaignClass.ts file to improve error handling and configuration management. The most important changes include loading environment variables using the dotenv package, adding checks for required environment variables, and ensuring nonce values are properly assigned.

Improvements to configuration management:

  • examples/js/getRealCampaignExamples/PeaqDidGetRealCampaignClass.ts: Added the dotenv package to load environment variables. ([examples/js/getRealCampaignExamples/PeaqDidGetRealCampaignClass.tsR13-R16](https://github.com/Think-and-Dev/peaq-evm-smart-contracts/pull/4/files#diff-a160b5fde050e229c833c7686bac8024b2f2941622e7bcb2582d072610cfdb47R13-R16))

Error handling improvements:

  • examples/js/getRealCampaignExamples/PeaqDidGetRealCampaignClass.ts: Added checks to ensure CONTRACT_OWNER_PRIVATE_KEY and MACHINE_OWNER_PRIVATE_KEY are provided, throwing an error if they are not. ([examples/js/getRealCampaignExamples/PeaqDidGetRealCampaignClass.tsR31-R34](https://github.com/Think-and-Dev/peaq-evm-smart-contracts/pull/4/files#diff-a160b5fde050e229c833c7686bac8024b2f2941622e7bcb2582d072610cfdb47R31-R34))

Code consistency improvements:

  • examples/js/getRealCampaignExamples/PeaqDidGetRealCampaignClass.ts: Changed the declaration of nonce to use let instead of const to allow reassignment. ([examples/js/getRealCampaignExamples/PeaqDidGetRealCampaignClass.tsL123-R131](https://github.com/Think-and-Dev/peaq-evm-smart-contracts/pull/4/files#diff-a160b5fde050e229c833c7686bac8024b2f2941622e7bcb2582d072610cfdb47L123-R131))
  • examples/js/getRealCampaignExamples/PeaqDidGetRealCampaignClass.ts: Ensured that nonce is reassigned with a new value before generating signatures. ([examples/js/getRealCampaignExamples/PeaqDidGetRealCampaignClass.tsR180](https://github.com/Think-and-Dev/peaq-evm-smart-contracts/pull/4/files#diff-a160b5fde050e229c833c7686bac8024b2f2941622e7bcb2582d072610cfdb47R180))

@gonzalo-smtv gonzalo-smtv self-assigned this Feb 24, 2025
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.

2 participants