Skip to content

Conversation

@Pauan
Copy link
Collaborator

@Pauan Pauan commented Oct 27, 2025

Right now networks have to be imported statically, like this:

import { ProgramManager } from "@provablehq/sdk/testnet.js";

function run() {
    const programManager = new ProgramManager();

    // ...
}

run();

However that locks the code into the testnet network. It's common for code to want to work with multiple networks.

This PR adds in a new loadNetwork function which allows for dynamically loading a network:

import { loadNetwork } from "@provablehq/sdk/dynamic.js";

const network = await loadNetwork("testnet");

function run(network) {
    const programManager = new network.ProgramManager();

    // ...
}

run(network);

It will dynamically load the network at runtime, and code can now be written so that it will work with multiple networks.

Copy link
Member

@iamalwaysuncomfortable iamalwaysuncomfortable left a comment

Choose a reason for hiding this comment

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

Thanks for getting this in, this simple ergonomic change will help people out a lot a great deal.

@iamalwaysuncomfortable iamalwaysuncomfortable merged commit 012e9f9 into ProvableHQ:mainnet Oct 29, 2025
12 of 14 checks passed
@Pauan Pauan deleted the feat/dynamic-import branch October 29, 2025 21:53
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