types.ts 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  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 Council {
  72. round: number;
  73. last: string;
  74. }
  75. export interface Options {
  76. verbose: number;
  77. channel: boolean;
  78. council: boolean;
  79. forum: boolean;
  80. proposals: boolean;
  81. }
  82. export interface ProposalDetail {
  83. createdAt: number;
  84. finalizedAt: number;
  85. message: string;
  86. parameters: ProposalParameters;
  87. stage: any;
  88. result: string;
  89. exec: any;
  90. id: number;
  91. title: string;
  92. description: any;
  93. votes: VotingResults;
  94. type: string;
  95. votesByAccount?: Vote[];
  96. author: string;
  97. authorId: number;
  98. }
  99. export interface Vote {
  100. vote: string;
  101. handle: string;
  102. }
  103. export type ProposalArray = number[];
  104. export interface ProposalPost {
  105. threadId: number;
  106. text: string;
  107. id: number;
  108. }
  109. export interface Proposals {
  110. current: number;
  111. last: number;
  112. active: ProposalArray;
  113. executing: ProposalArray;
  114. }
  115. export interface Channel {
  116. id: number;
  117. handle: string;
  118. title: string;
  119. description: string;
  120. avatar: string;
  121. banner: string;
  122. content: string;
  123. ownerId: number;
  124. accountId: string;
  125. publicationStatus: boolean;
  126. curation: string;
  127. createdAt: string;
  128. principal: number;
  129. }
  130. export interface Category {
  131. id: number;
  132. threadId: number;
  133. title: string;
  134. description: string;
  135. createdAt: number;
  136. deleted: boolean;
  137. archived: boolean;
  138. subcategories: number;
  139. unmoderatedThreads: number;
  140. moderatedThreads: number;
  141. position: number;
  142. moderatorId: string;
  143. }
  144. export interface Post {
  145. id: number;
  146. text: string;
  147. threadId: number;
  148. authorId: string;
  149. createdAt: { block: number; time: number };
  150. }
  151. export interface Thread {
  152. id: number;
  153. title: string;
  154. categoryId: number;
  155. nrInCategory: number;
  156. moderation: string;
  157. createdAt: string;
  158. authorId: string;
  159. }
  160. export interface Member {
  161. account: string;
  162. handle: string;
  163. id: number;
  164. registeredAt: number;
  165. about: string;
  166. }
  167. export interface Block {
  168. id: number;
  169. timestamp: number;
  170. duration: number;
  171. }
  172. export interface Summary {
  173. blocks: Block[];
  174. validators: number[];
  175. nominators: number[];
  176. }
  177. export type NominatorsEntries = [StorageKey, Option<Nominations>][];
  178. export interface ProviderStatus {
  179. [propName: string]: boolean;
  180. }
  181. export interface Handles {
  182. [key: string]: string;
  183. }
  184. export interface Tokenomics {
  185. price: string;
  186. totalIssuance: string;
  187. validators: { total_stake: string };
  188. burns: Burn[];
  189. exchanges: Exchange[];
  190. extecutedBurnsAmount: number;
  191. }
  192. export interface Burn {
  193. amount: number;
  194. blockHeight: number;
  195. date: string; // "2020-09-21T11:07:54.000Z"
  196. logTime: string; //"2020-09-21T11:08:54.091Z"
  197. }
  198. export interface Exchange {
  199. amount: number;
  200. amountUSD: number;
  201. blockHeight: number;
  202. date: string; // "2020-09-21T11:07:48.000Z"
  203. logTime: string; // "2020-09-21T11:08:48.552Z"
  204. price: number; // 0.000053676219442924057
  205. recipient: string; //"5D5PhZQNJzcJXVBxwJxZcsutjKPqUPydrvpu6HeiBfMaeKQu"
  206. sender: string; // "5DACzSg65taZ2NRktUtzBjhLZr8H5T8rwNoZUng9gQV6ayqT"
  207. senderMemo: string; //"4Testing1337SendToBurnerAddressHopingItWorksOfc5D5PhZQNJzcJXVBxwJxZcsutjKPqUPydrvpu6HeiBfMaeKQu"
  208. status: string; // FINALIZED | PENDING
  209. xmrAddress: string; //"No address found"
  210. }
  211. export interface Event {
  212. text: string;
  213. date: number;
  214. category: {
  215. tag: string;
  216. color: string;
  217. };
  218. link: {
  219. url: string;
  220. text: string;
  221. };
  222. }
  223. export interface CalendarItem {
  224. id: number;
  225. group: number;
  226. title: string;
  227. start_time: number;
  228. end_time: number;
  229. }
  230. export interface CalendarGroup {
  231. id: number;
  232. title: string;
  233. }
  234. export interface Status {
  235. }