@arcana/ca-sdk
Version:
Arcana Network's chain abstraction SDK for unified balance in Web3 apps
63 lines (62 loc) • 2.14 kB
JavaScript
import { Environment } from "@arcana/ca-common";
// Testnet with mainnet tokens
const CORAL_CONFIG = {
COSMOS_URL: "https://cosmos01-testnet.arcana.network",
EXPLORER_URL: "https://explorer.arcana.network",
FAUCET_URL: "https://gateway001-testnet.arcana.network/api/v1/faucet",
GRPC_URL: "https://grpcproxy-testnet.arcana.network",
NETWORK_HINT: Environment.CORAL,
SIMULATION_URL: "https://ca-sim-testnet.arcana.network",
VSC_DOMAIN: "vsc1-testnet.arcana.network",
};
// Dev with mainnet tokens
const CERISE_CONFIG = {
COSMOS_URL: "https://cosmos01-dev.arcana.network",
EXPLORER_URL: "https://explorer.dev.arcana.network",
FAUCET_URL: "https://gateway-dev.arcana.network/api/v1/faucet",
GRPC_URL: "https://mimosa-dash-grpc.arcana.network",
NETWORK_HINT: Environment.CERISE,
SIMULATION_URL: "https://ca-sim-dev.arcana.network",
VSC_DOMAIN: "mimosa-dash-vsc.arcana.network",
};
// Dev with testnet tokens
const FOLLY_CONFIG = {
COSMOS_URL: "https://cosmos04-dev.arcana.network",
EXPLORER_URL: "https://explorer.folly.arcana.network",
FAUCET_URL: "https://gateway-dev.arcana.network/api/v1/faucet",
GRPC_URL: "https://grpc-folly.arcana.network",
NETWORK_HINT: Environment.FOLLY,
SIMULATION_URL: "https://ca-sim-dev.arcana.network",
VSC_DOMAIN: "vsc1-folly.arcana.network",
};
const isNetworkConfig = (config) => {
if (typeof config !== "object") {
return false;
}
if (!(config.VSC_DOMAIN &&
config.COSMOS_URL &&
config.SIMULATION_URL &&
config.FAUCET_URL &&
config.EXPLORER_URL &&
config.GRPC_URL)) {
return false;
}
if (config.NETWORK_HINT === undefined) {
return false;
}
return true;
};
const getNetworkConfig = (network) => {
if (isNetworkConfig(network)) {
return network;
}
switch (network) {
case Environment.CERISE:
return CERISE_CONFIG;
case Environment.FOLLY:
return FOLLY_CONFIG;
default:
return CORAL_CONFIG;
}
};
export { CERISE_CONFIG, CORAL_CONFIG, getNetworkConfig };