OverviewFilesCommitsIssuesDocsReleasesPeers

hyper-wallet / protocols / index.js

32 lines · javascript ref:
// protocols/index.js - Protocol Registry
//
// Object mapping pattern (like Pear's runners)
// Protocols are registered and enabled via config

import wdk from './wdk.js'

// All available protocols
const protocols = {
  wdk
  // stellar: require('./stellar'),  // Future protocol
  // nano: require('./nano'),        // Future protocol
}

/**
 * Get enabled protocols from config
 * @param {Object} config - Configuration object
 * @returns {Object} - Enabled protocol instances
 */
export function getEnabledProtocols(config) {
  const enabled = config.protocols || ['wdk'] // Default to WDK

  return Object.keys(protocols)
    .filter(name => enabled.includes(name))
    .reduce((acc, name) => {
      acc[name] = protocols[name]
      return acc
    }, {})
}

export { protocols }