diff --git a/package.json b/package.json
index b67d537d..d4cf1fcf 100644
--- a/package.json
+++ b/package.json
@@ -14,7 +14,7 @@
"git-info": "rm -rf src/generated/ && mkdir src/generated/ && echo export default \"{\\\"commitHash\\\": \\\"$(git rev-parse --short HEAD)\\\", \\\"version\\\": \\\"$(git describe --tags --always)\\\"};\" > src/generated/gitInfo.ts"
},
"dependencies": {
- "@stellar/design-system": "^2.0.0-beta.1",
+ "@stellar/design-system": "^2.0.0-beta.4",
"immer": "^10.0.3",
"next": "14.0.4",
"react": "^18",
diff --git a/src/components/NetworkSelector/index.tsx b/src/components/NetworkSelector/index.tsx
index b9415086..25886ecb 100644
--- a/src/components/NetworkSelector/index.tsx
+++ b/src/components/NetworkSelector/index.tsx
@@ -14,31 +14,33 @@ import { Network, NetworkType } from "@/types/types";
import "./styles.scss";
-// TODO: update input
-
const NetworkOptions: Network[] = [
{
id: "futurenet",
label: "Futurenet",
- url: "https://horizon-futurenet.stellar.org",
+ horizonUrl: "https://horizon-futurenet.stellar.org",
+ rpcUrl: "https://rpc-futurenet.stellar.org",
passphrase: "Test SDF Future Network ; October 2022",
},
{
id: "mainnet",
label: "Mainnet",
- url: "https://horizon.stellar.org",
+ horizonUrl: "https://horizon.stellar.org",
+ rpcUrl: "",
passphrase: "Public Global Stellar Network ; September 2015",
},
{
id: "testnet",
label: "Testnet",
- url: "https://horizon-testnet.stellar.org",
+ horizonUrl: "https://horizon-testnet.stellar.org",
+ rpcUrl: "https://soroban-testnet.stellar.org",
passphrase: "Test SDF Network ; September 2015",
},
{
id: "custom",
label: "Custom",
- url: "",
+ horizonUrl: "",
+ rpcUrl: "",
passphrase: "",
},
];
@@ -51,7 +53,8 @@ export const NetworkSelector = () => {
const [isDropdownVisible, setIsDropdownVisible] = useState(false);
const initialCustomState = {
- url: network.id === "custom" ? network.url : "",
+ horizonUrl: network.id === "custom" ? network.horizonUrl : "",
+ rpcUrl: network.id === "custom" ? network.rpcUrl : "",
passphrase: network.id === "custom" ? network.passphrase : "",
};
@@ -62,9 +65,11 @@ export const NetworkSelector = () => {
const isSameNetwork = () => {
if (activeNetworkId === "custom") {
return (
- network.url &&
+ network.horizonUrl &&
+ network.rpcUrl &&
network.passphrase &&
- customNetwork.url === network.url &&
+ customNetwork.horizonUrl === network.horizonUrl &&
+ customNetwork.rpcUrl === network.rpcUrl &&
customNetwork.passphrase === network.passphrase
);
}
@@ -72,13 +77,13 @@ export const NetworkSelector = () => {
return activeNetworkId === network.id;
};
- const isNetworkUrlInvalid = () => {
- if (activeNetworkId !== "custom" || !customNetwork.url) {
+ const isNetworkUrlInvalid = (url: string) => {
+ if (activeNetworkId !== "custom" || !url) {
return "";
}
try {
- new URL(customNetwork.url);
+ new URL(url);
return "";
} catch (e) {
return "Value is not a valid URL";
@@ -88,8 +93,10 @@ export const NetworkSelector = () => {
const isSubmitDisabled =
isSameNetwork() ||
(activeNetworkId === "custom" &&
- !(customNetwork.url && customNetwork.passphrase)) ||
- Boolean(customNetwork.url && isNetworkUrlInvalid());
+ !(customNetwork.horizonUrl && customNetwork.passphrase)) ||
+ Boolean(
+ customNetwork.horizonUrl && isNetworkUrlInvalid(customNetwork.horizonUrl),
+ );
const isCustomNetwork = activeNetworkId === "custom";
@@ -136,11 +143,12 @@ export const NetworkSelector = () => {
toggleDropdown(false);
setActiveNetworkId(network.id);
setCustomNetwork({
- url: network.url ?? "",
+ horizonUrl: network.horizonUrl ?? "",
+ rpcUrl: network.rpcUrl ?? "",
passphrase: network.passphrase ?? "",
});
},
- [network.id, network.passphrase, network.url],
+ [network.id, network.horizonUrl, network.rpcUrl, network.passphrase],
);
// Close dropdown when clicked outside
@@ -246,28 +254,58 @@ export const NetworkSelector = () => {
tabIndex={0}
>