Skip to content

Conversation

@zachfedor
Copy link

What

Generated TS bindings create an object with keys for each network. This will replace the legacy "standalone" key with the new "local" key. Network passphrases are not changed, just the key to reference them.

Why

This will simplify configuration needed for Scaffold Stellar projects. A single environment variable can be set to match one of the keys on this network object and spread out defaults to instantiate the contract's RPC client with the RPC URL and network passphrase, rather than having each individual piece defined as an environment variable.

This shouldn't be a breaking change as we'll still allow these individual environment variables to overwrite the defaults for a given a network.

Known limitations

[N/A]

@github-project-automation github-project-automation bot moved this to Backlog (Not Ready) in DevX Oct 9, 2025
Copy link
Member

@leighmcculloch leighmcculloch left a comment

Choose a reason for hiding this comment

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

Using the 'local' term to match quickstart is preferred, good call.

I would think this would be a breaking change because the generated networks object has a value for its standalone field today, but that will be undefined after this is merged.

For example, looking at the tests:

import {
  Client,
  networks,
  contract as ContractClient,
} from "test-custom-types";

//...

const contract = new Client({
  ...networks.standalone,
  ...networks.local,
  rpcUrl,
  allowHttp: true,
  publicKey: root.keypair.publicKey(),
  ...signer,
});

I note in the description you say this is not a breaking change. Why is that?

Is there a way to make this non-breaking, such as by having networks contain both standalone and local map to the same value?

@zachfedor
Copy link
Author

zachfedor commented Oct 9, 2025

Regardless of what the key is called, we still destructure the same values as before. What was ...networks.standalone is now ...networks.local, but it all results in the same generated code:

// src/contracts/some-contract.ts
export default new Client.Client({
  networkPassphrase: 'Standalone Network ; February 2017',
  contractId: 'C...',
  rpcUrl,
  allowHttp: true,
  publicKey: undefined,
});

I'm not seeing anywhere else where we actually use this networks object.

We could add both keys containing the same values, but would that be confusing?

@leighmcculloch
Copy link
Member

I'm not seeing anywhere else where we actually use this networks object.

Looking at the tests the networks object appears to be exported.

The tests demonstrate it being used like below, see line 5 where the exported object is imported, and line 12 where the object is used:

import {
Client,
networks,
contract as ContractClient,
} from "test-custom-types";
const publicKey = root.keypair.publicKey();
const contract = new Client({
...networks.local,
rpcUrl,
allowHttp: true,
publicKey: root.keypair.publicKey(),
...signer,
});

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

Labels

None yet

Projects

Status: Backlog (Not Ready)

Development

Successfully merging this pull request may close these issues.

2 participants