forked from Vero-protocol/vero-guardian-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrpc.ts
More file actions
32 lines (26 loc) · 931 Bytes
/
Copy pathrpc.ts
File metadata and controls
32 lines (26 loc) · 931 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import * as StellarSdk from '@stellar/stellar-sdk';
export interface NetworkConfig {
horizonUrl: string;
sorobanRpcUrl: string;
networkPassphrase: string;
}
export const DEFAULT_HORIZON_URL =
process.env.NEXT_PUBLIC_HORIZON_URL ?? 'https://horizon-testnet.stellar.org';
export const DEFAULT_SOROBAN_RPC_URL =
process.env.NEXT_PUBLIC_SOROBAN_RPC_URL ?? 'https://soroban-testnet.stellar.org';
export const DEFAULT_NETWORK_PASSPHRASE = StellarSdk.Networks.TESTNET;
/** Stellar data entry key used to store the consensus threshold on-chain. */
export const CONSENSUS_THRESHOLD_KEY = 'consensus_threshold';
export const defaultNetworkConfig: NetworkConfig = {
horizonUrl: DEFAULT_HORIZON_URL,
sorobanRpcUrl: DEFAULT_SOROBAN_RPC_URL,
networkPassphrase: DEFAULT_NETWORK_PASSPHRASE,
};
export function validateUrl(url: string): boolean {
try {
new URL(url);
return true;
} catch {
return false;
}
}