Feat: Replace Standalone with Local in TS Boilerplate#2251
Feat: Replace Standalone with Local in TS Boilerplate#2251zachfedor wants to merge 1 commit intostellar:mainfrom
Conversation
leighmcculloch
left a comment
There was a problem hiding this comment.
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?
|
Regardless of what the key is called, we still destructure the same values as before. What was // 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 We could add both keys containing the same values, but would that be confusing? |
Looking at the tests the 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: |
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
networkobject 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]