Repository navigation
feat(sdk): add futurenet and standalone network config - #1008
Closed
arkhindi12 wants to merge 1 commit into
Closed
arkhindi12 wants to merge 1 commit into
arkhindi12 wants to merge 1 commit into
Conversation
…col#981) Adds NETWORK_CONFIG with RPC URL, passphrase, explorer bases and contract IDs for all four networks. Explorer entries reuse EXPLORER_URLS rather than duplicating the strings. No contract ID is hardcoded: StreamFi contract IDs are derived per deployment from the deployer address and salt, so publishing one would point at somebody else's contract. contractIdFor() therefore throws with instructions instead of returning an empty string that fails later inside a transaction.
Contributor
Author
|
Closing this — the issue was resolved by #1015, so this PR is superseded. Thanks for the review queue space. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #981.
What this adds
NETWORK_CONFIG— one entry per network the SDK can target, with the RPC URL,the passphrase the SDK signs with, the explorer bases and the published
contract IDs.
soroban-mainnet.stellar.orgNetworks.PUBLICsoroban-testnet.stellar.orgNetworks.TESTNETsoroban-futurenet.stellar.orgNetworks.FUTURENETlocalhost:8000/soroban/rpcNetworks.STANDALONEExplorer entries are
EXPLORER_URLSitself, not copies of the strings, andstandaloneisnullbecause no public explorer follows a network that onlyexists on your machine.
About the contract IDs — please read
The issue asks for predefined contract IDs on futurenet/standalone. I did not
add any, deliberately: StreamFi contract IDs are derived per deployment from
sha256(networkPassphrase + ContractIdPreimageFromAddress(deployer, salt)),so a hardcoded ID would point at somebody else's contract — worse than none.
Instead
contractsisnullper role andcontractIdFor()throws with thenext step spelled out:
If you would rather have a mutable registry that deployments write into, say
so and I will add it — but I did not want to ship an address that looks
authoritative and is not.
Tests
src/tests/network-config.test.ts— 7 cases: all four networks present, thepassphrases match what the SDK signs with, futurenet/standalone point at their
own RPC, explorer entries equal
EXPLORER_URLS, no invented contract IDs, theerror message is actionable, and a published ID is returned when one exists.
Rebased on
mainafter #1004.npx tsc --noEmitand this PR's test suite are green on the current head.