system.js 644 B

123456789101112131415161718192021222324252627282930313233
  1. 'use strict'
  2. const debug = require('debug')('joystream:runtime:system')
  3. /*
  4. * Add system functionality to the substrate API.
  5. */
  6. class SystemApi {
  7. static async create(base) {
  8. const ret = new SystemApi()
  9. ret.base = base
  10. await SystemApi.init()
  11. return ret
  12. }
  13. static async init() {
  14. debug('Init')
  15. }
  16. /*
  17. * Check the running chain for the development setup.
  18. */
  19. async isDevelopmentChain() {
  20. const developmentChainName = 'Development'
  21. const runningChainName = await this.base.api.rpc.system.chain()
  22. return runningChainName.toString() === developmentChainName
  23. }
  24. }
  25. module.exports = {
  26. SystemApi,
  27. }