Skip to content

Conversation

Mounil2005
Copy link
Contributor

@Mounil2005 Mounil2005 commented Sep 15, 2025

Description:
Make Hedera network selection configurable via the NETWORK environment variable instead of hardcoding "testnet".
This improves flexibility for developers running on mainnet, previewnet, or solo.

  • Replace hardcoded "testnet" default with os.getenv("NETWORK", "testnet")
  • Update Network class to prioritize: explicit constructor arg → NETWORK env var → "testnet" fallback

Related issue(s):

Fixes #253

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

@Mounil2005 Mounil2005 marked this pull request as ready for review September 15, 2025 19:18
@Mounil2005
Copy link
Contributor Author

@exploreriii @nadineloepfe pls review and check

exploreriii

This comment was marked as resolved.

@Mounil2005
Copy link
Contributor Author

Looks great but I think the next step is to change hardcoded instances in the examples i.e. from network = Network(network='testnet') to network = Network() or similar

I have updated all instances in the examples. Pls check @exploreriii

@Mounil2005
Copy link
Contributor Author

@exploreriii any more changes needed??

Copy link
Contributor

@exploreriii exploreriii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you Mounil

@exploreriii exploreriii requested a review from Dosik13 September 19, 2025 12:31
@nadineloepfe
Copy link
Contributor

Thank you @Mounil2005!
However, I think it would be better to align this with the other SDKs and to not hardcode testnet in the Network class.
The Network should be explicitly set by the user.

However, how about this in the examples:

network = Network(os.getenv("NETWORK", "testnet"))

?

Copy link
Contributor

@exploreriii exploreriii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Mounil2005 is the requested change clear? Let us know if you need any clarifications

@Mounil2005
Copy link
Contributor Author

Hi @Mounil2005 is the requested change clear? Let us know if you need any clarifications

Hello maam, hope you are doing well, the changes are clear but actually i didnt work on them cause currently my Uni exams are going on back-to-back…I request you to pls give me time till this weekend. I will work on it.

@exploreriii
Copy link
Contributor

No problem, thank you for the update

@Mounil2005
Copy link
Contributor Author

No problem, thank you for the update

Thank you for understanding ma'am.

@Mounil2005
Copy link
Contributor Author

Thank you @Mounil2005! However, I think it would be better to align this with the other SDKs and to not hardcode testnet in the Network class. The Network should be explicitly set by the user.

However, how about this in the examples:

network = Network(os.getenv("NETWORK", "testnet"))

?

Thanks for the feedback!
I’ll update the PR so that the Network class does not default to "testnet" internally.
Instead, I’ll change the examples to use:
network = Network(os.getenv("NETWORK", "testnet"))

@exploreriii
Copy link
Contributor

Thanks, also please note we have a new update 0.1.5 so the changelog, this would need to be added under unreleased above it

Signed-off-by: Mounil <mounilkankhara@gmail.com>
…net if not set

Signed-off-by: Mounil <mounilkankhara@gmail.com>
…ead of hardcoded 'testnet'

Signed-off-by: Mounil <mounilkankhara@gmail.com>
@Mounil2005 Mounil2005 force-pushed the make-network-configurable branch from a8689ff to 8c8297a Compare October 2, 2025 20:26
@exploreriii
Copy link
Contributor

Hi Mounil, let me know when this is ready to review - thank you

@Mounil2005
Copy link
Contributor Author

Hi Mounil, let me know when this is ready to review - thank you

yes maam, i will surely let u know

@Mounil2005 Mounil2005 marked this pull request as draft October 2, 2025 21:09
@exploreriii
Copy link
Contributor

Hi @Mounil2005
We will be releasing 0.1.6 which will require another rebase and a changelog update from 0.1.5 to 0.1.6
Many thanks

@exploreriii
Copy link
Contributor

Hi @Mounil2005 closing this issue down as coincidentally another PR that is nearly ready to merge solves this issue.
Sorry about the inconvenience, thank you for your efforts, and please feel free to contribute to another PR

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.

Make "network" in example script an environment variable

3 participants