index.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import { RegistryTypes } from '@polkadot/types/types'
  2. import common from './common'
  3. import members from './members'
  4. import council from './council'
  5. import roles from './roles'
  6. import forum from './forum'
  7. import stake from './stake'
  8. import mint from './mint'
  9. import recurringRewards from './recurring-rewards'
  10. import hiring from './hiring'
  11. import contentWorkingGroup from './content-working-group'
  12. import workingGroup from './working-group'
  13. import discovery from './discovery'
  14. import media from './media'
  15. import proposals from './proposals'
  16. import contentDirectory from './content-directory'
  17. import { InterfaceTypes } from '@polkadot/types/types/registry'
  18. import { TypeRegistry } from '@polkadot/types'
  19. export {
  20. common,
  21. members,
  22. council,
  23. roles,
  24. forum,
  25. stake,
  26. mint,
  27. recurringRewards,
  28. hiring,
  29. contentWorkingGroup,
  30. workingGroup,
  31. discovery,
  32. media,
  33. proposals,
  34. contentDirectory,
  35. }
  36. export const types: RegistryTypes = {
  37. ...common,
  38. ...members,
  39. ...council,
  40. ...roles,
  41. ...forum,
  42. ...stake,
  43. ...mint,
  44. ...recurringRewards,
  45. ...hiring,
  46. ...contentWorkingGroup,
  47. ...workingGroup,
  48. ...discovery,
  49. ...media,
  50. ...proposals,
  51. ...contentDirectory,
  52. }
  53. // Allows creating types without api instance (it's not a recommended way though, so should be used just for mocks)
  54. export const registry = new TypeRegistry()
  55. registry.register(types)
  56. export function createType<TypeName extends keyof InterfaceTypes>(
  57. type: TypeName,
  58. value: any
  59. ): InterfaceTypes[TypeName] {
  60. return registry.createType(type, value)
  61. }