3
1

types.ts 5.5 KB

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