types.ts 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. import { ApiPromise } from '@polkadot/api'
  2. import { MemberId } from '@joystream/types/members'
  3. import {
  4. ProposalParameters,
  5. ProposalStatus,
  6. VotingResults,
  7. } from '@joystream/types/proposals'
  8. import { AccountId, Nominations } from '@polkadot/types/interfaces'
  9. import { Option } from '@polkadot/types/codec'
  10. import { StorageKey } from '@polkadot/types/primitive'
  11. export interface Api {
  12. query: any
  13. rpc: any
  14. derive: any
  15. }
  16. export interface IState {
  17. //gethandle: (account: AccountId | string) => string;
  18. connecting: boolean
  19. now: number
  20. block: number
  21. blocks: Block[]
  22. nominators: string[]
  23. validators: string[]
  24. stashes: string[]
  25. loading: boolean
  26. councils: Seat[][]
  27. councilElection?: { stage: any; round: number; termEndsAt: number }
  28. channels: Channel[]
  29. categories: Category[]
  30. proposals: ProposalDetail[]
  31. posts: Post[]
  32. threads: Thread[]
  33. domain: string
  34. proposalCount: number
  35. proposalPosts: any[]
  36. handles: Handles
  37. members: Member[]
  38. tokenomics?: Tokenomics
  39. reports: { [key: string]: string }
  40. [key: string]: any
  41. stars: { [key: string]: boolean }
  42. stakes?: { [key: string]: Stakes }
  43. rewardPoints?: RewardPoints
  44. lastReward: number
  45. }
  46. export interface RewardPoints {
  47. total: number
  48. individual: { [account: string]: number }
  49. }
  50. export interface Stake {
  51. who: string
  52. value: number
  53. }
  54. export interface Stakes {
  55. total: number
  56. own: number
  57. others: Stake[]
  58. commission: number
  59. }
  60. export interface Seat {
  61. member: string
  62. handle?: string
  63. id?: number
  64. stake: number
  65. backers: Backer[]
  66. }
  67. export interface Backer {
  68. member: string
  69. stake: number
  70. }
  71. export interface CouncilType {
  72. round: number
  73. last: string
  74. }
  75. export interface CouncilModel {}
  76. export interface Options {
  77. verbose: number
  78. channel: boolean
  79. council: boolean
  80. forum: boolean
  81. proposals: boolean
  82. }
  83. export interface ProposalDetail {
  84. createdAt: number
  85. finalizedAt: number
  86. message: string
  87. parameters: string
  88. stage: any
  89. result: string
  90. exec: any
  91. id: number
  92. title: string
  93. description: any
  94. votes: VotingResults
  95. type: string
  96. votesByAccount?: Vote[]
  97. author?: string
  98. authorId: number
  99. }
  100. export interface Vote {
  101. vote: string
  102. handle: string
  103. }
  104. export type ProposalArray = number[]
  105. export interface ProposalPost {
  106. threadId: number
  107. text: string
  108. id: number
  109. }
  110. export interface Proposals {
  111. current: number
  112. last: number
  113. active: ProposalArray
  114. executing: ProposalArray
  115. }
  116. export interface ChannelType {
  117. id: number
  118. handle: string
  119. title: string
  120. description: string
  121. avatar: string
  122. banner: string
  123. content: string
  124. ownerId: number
  125. accountId: string
  126. publicationStatus: boolean
  127. curation: string
  128. createdAt: string
  129. principal: number
  130. }
  131. export interface CategoryType {
  132. id: number
  133. threadId: number
  134. title: string
  135. description: string
  136. createdAt: number
  137. deleted: boolean
  138. archived: boolean
  139. subcategories: number
  140. unmoderatedThreads: number
  141. moderatedThreads: number
  142. position: number
  143. moderatorId: string
  144. }
  145. export interface PostType {
  146. id: number
  147. text: string
  148. threadId: number
  149. authorId: string
  150. createdAt: { block: number; time: number }
  151. }
  152. export interface ThreadType {
  153. id: number
  154. title: string
  155. categoryId: number
  156. nrInCategory: number
  157. moderation: string
  158. createdAt: string
  159. authorId: string
  160. }
  161. export interface MemberType {
  162. account: string
  163. handle: string
  164. id: number
  165. registeredAt: number
  166. about: string
  167. addPost: any
  168. }
  169. export interface Header {
  170. number: number
  171. timestamp: number
  172. author: string
  173. }
  174. export interface Summary {
  175. blocks: Block[]
  176. validators: number[]
  177. nominators: number[]
  178. }
  179. export type NominatorsEntries = [StorageKey, Option<Nominations>][]
  180. export interface ProviderStatus {
  181. [propName: string]: boolean
  182. }
  183. export interface Handles {
  184. [key: string]: string
  185. }
  186. export interface Tokenomics {
  187. price: string
  188. totalIssuance: string
  189. validators: { total_stake: string }
  190. burns: Burn[]
  191. exchanges: Exchange[]
  192. extecutedBurnsAmount: number
  193. }
  194. export interface Burn {
  195. amount: number
  196. blockHeight: number
  197. date: string // "2020-09-21T11:07:54.000Z"
  198. logTime: string //"2020-09-21T11:08:54.091Z"
  199. }
  200. export interface Exchange {
  201. amount: number
  202. amountUSD: number
  203. blockHeight: number
  204. date: string // "2020-09-21T11:07:48.000Z"
  205. logTime: string // "2020-09-21T11:08:48.552Z"
  206. price: number // 0.000053676219442924057
  207. recipient: string //"5D5PhZQNJzcJXVBxwJxZcsutjKPqUPydrvpu6HeiBfMaeKQu"
  208. sender: string // "5DACzSg65taZ2NRktUtzBjhLZr8H5T8rwNoZUng9gQV6ayqT"
  209. senderMemo: string //"4Testing1337SendToBurnerAddressHopingItWorksOfc5D5PhZQNJzcJXVBxwJxZcsutjKPqUPydrvpu6HeiBfMaeKQu"
  210. status: string // FINALIZED | PENDING
  211. xmrAddress: string //"No address found"
  212. }
  213. export interface Event {
  214. text: string
  215. date: number
  216. category: {
  217. tag: string
  218. color: string
  219. }
  220. link: {
  221. url: string
  222. text: string
  223. }
  224. }
  225. export interface CalendarItem {
  226. id: number
  227. group: number
  228. title: string
  229. start_time: number
  230. end_time: number
  231. }
  232. export interface CalendarGroup {
  233. id: number
  234. title: string
  235. }
  236. export interface Status {
  237. block: number
  238. era: number
  239. round: number
  240. members: number
  241. channels: number
  242. categories: number
  243. threads: number
  244. posts: number
  245. proposals: number
  246. proposalPosts: number
  247. }