import { ConfigInfo } from "@ledgerhq/live-config/LiveConfig";
import { getEnv } from "@ledgerhq/live-env";

export const polkadotConfig: Record<string, ConfigInfo> = {
  config_currency_polkadot: {
    type: "object",
    default: {
      status: {
        type: "active",
        features: [
          { id: "blockchain_txs", status: "active" },
          { id: "staking_txs", status: "active" },
        ],
      },
      sidecar: {
        url: getEnv("API_POLKADOT_SIDECAR"),
        credentials: getEnv("API_POLKADOT_SIDECAR_CREDENTIALS"),
      },
      indexer: {
        url: getEnv("API_POLKADOT_INDEXER"),
      },
      node: {
        url: getEnv("API_POLKADOT_NODE"),
      },
      staking: {
        electionStatusThreshold: getEnv("POLKADOT_ELECTION_STATUS_THRESHOLD"),
      },
    },
  },
  config_currency_assethub_polkadot: {
    type: "object",
    default: {
      status: {
        type: "active",
        features: [
          { id: "blockchain_txs", status: "active" },
          { id: "staking_txs", status: "active" },
        ],
      },
      sidecar: {
        url: "https://polkadot-asset-hub-sidecar.coin.ledger.com",
      },
      node: {
        url: "https://polkadot-asset-hub-fullnodes.api.live.ledger.com",
      },
      staking: {
        electionStatusThreshold: getEnv("POLKADOT_ELECTION_STATUS_THRESHOLD"),
      },
      indexer: {
        url: "https://explorers.api.live.ledger.com/blockchain/dot_asset_hub",
      },
      hasBeenMigrated: true,
    },
  },
  config_currency_westend: {
    type: "object",
    default: {
      status: {
        type: "active",
        features: [
          { id: "blockchain_txs", status: "active" },
          { id: "staking_txs", status: "active" },
        ],
      },
      sidecar: {
        url: "https://polkadot-westend-sidecar.coin.ledger.com/rc",
      },
      node: {
        url: "https://polkadot-westend-fullnodes.api.live.ledger.com",
      },
      indexer: {
        url: "https://explorers.api.live.ledger.com/blockchain/dot_westend",
      },
    },
  },
  config_currency_assethub_westend: {
    type: "object",
    default: {
      status: {
        type: "active",
        features: [
          { id: "blockchain_txs", status: "active" },
          { id: "staking_txs", status: "active" },
        ],
      },
      sidecar: {
        url: "https://polkadot-westend-sidecar.coin.ledger.com",
      },
      node: {
        url: "https://polkadot-westend-asset-hub-fullnodes.api.live.ledger.com",
      },
      indexer: {
        url: "https://explorers.api.live.ledger.com/blockchain/dot_asset_hub_westend",
      },
    },
  },
};
