types.ts 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  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. mints: any[];
  59. tokenomics?: Tokenomics;
  60. reports: { [key: string]: string };
  61. [key: string]: any;
  62. stars: { [key: string]: boolean };
  63. stakes?: { [key: string]: Stakes };
  64. rewardPoints?: RewardPoints;
  65. hideFooter: boolean;
  66. showStatus: boolean;
  67. }
  68. export interface RewardPoints {
  69. total: number;
  70. individual: { [account: string]: number };
  71. }
  72. export interface Stake {
  73. who: string;
  74. value: number;
  75. }
  76. export interface Stakes {
  77. total: number;
  78. own: number;
  79. others: Stake[];
  80. commission: number;
  81. }
  82. export interface Seat {
  83. member: string;
  84. handle?: string;
  85. id?: number;
  86. stake: number;
  87. backers: Backer[];
  88. }
  89. export interface Backer {
  90. member: string;
  91. stake: number;
  92. }
  93. export interface Council {
  94. round: number;
  95. last: string;
  96. }
  97. export interface Options {
  98. verbose: number;
  99. channel: boolean;
  100. council: boolean;
  101. forum: boolean;
  102. proposals: boolean;
  103. }
  104. export interface ProposalDetail {
  105. createdAt: number;
  106. finalizedAt: number;
  107. message: string;
  108. parameters: ProposalParameters;
  109. stage: any;
  110. result: string;
  111. executed?: { Executed: null } | { ExecutionFailed: { error: string } };
  112. id: number;
  113. title: string;
  114. description: any;
  115. votes: VotingResults;
  116. type: string;
  117. votesByAccount?: Vote[];
  118. author: string;
  119. authorId: number;
  120. detail?: any;
  121. }
  122. export interface Vote {
  123. vote: string;
  124. handle: string;
  125. }
  126. export type ProposalArray = number[];
  127. export interface ProposalPost {
  128. threadId: number;
  129. text: string;
  130. id: number;
  131. handle?: string;
  132. }
  133. export interface Proposals {
  134. current: number;
  135. last: number;
  136. active: ProposalArray;
  137. executing: ProposalArray;
  138. }
  139. export interface Channel {
  140. id: number;
  141. handle: string;
  142. title: string;
  143. description: string;
  144. avatar: string;
  145. banner: string;
  146. content: string;
  147. ownerId: number;
  148. accountId: string;
  149. publicationStatus: boolean;
  150. curation: string;
  151. createdAt: string;
  152. principal: number;
  153. }
  154. export interface Category {
  155. id: number;
  156. threadId: number;
  157. title: string;
  158. description: string;
  159. createdAt: number;
  160. deleted: boolean;
  161. archived: boolean;
  162. subcategories: number;
  163. unmoderatedThreads: number;
  164. moderatedThreads: number;
  165. position: number;
  166. moderatorId: string;
  167. }
  168. export interface Post {
  169. id: number;
  170. text: string;
  171. threadId: number;
  172. authorId: string;
  173. createdAt: { block: number; time: number };
  174. }
  175. export interface Thread {
  176. id: number;
  177. title: string;
  178. categoryId: number;
  179. nrInCategory: number;
  180. moderation: string;
  181. createdAt: string;
  182. authorId: string;
  183. }
  184. export interface Member {
  185. account: string;
  186. handle: string;
  187. id: number;
  188. registeredAt: number;
  189. about: string;
  190. }
  191. export interface Block {
  192. id: number;
  193. timestamp: number;
  194. duration: number;
  195. }
  196. export interface Summary {
  197. blocks: Block[];
  198. validators: number[];
  199. nominators: number[];
  200. }
  201. export type NominatorsEntries = [StorageKey, Option<Nominations>][];
  202. export interface ProviderStatus {
  203. [propName: string]: boolean;
  204. }
  205. export interface Handles {
  206. [key: string]: string;
  207. }
  208. export interface Tokenomics {
  209. price: string;
  210. totalIssuance: string;
  211. validators: { total_stake: string };
  212. burns: Burn[];
  213. exchanges: Exchange[];
  214. extecutedBurnsAmount: number;
  215. }
  216. export interface Burn {
  217. amount: number;
  218. blockHeight: number;
  219. date: string; // "2020-09-21T11:07:54.000Z"
  220. logTime: string; //"2020-09-21T11:08:54.091Z"
  221. }
  222. export interface Exchange {
  223. amount: number;
  224. amountUSD: number;
  225. blockHeight: number;
  226. date: string; // "2020-09-21T11:07:48.000Z"
  227. logTime: string; // "2020-09-21T11:08:48.552Z"
  228. price: number; // 0.000053676219442924057
  229. recipient: string; //"5D5PhZQNJzcJXVBxwJxZcsutjKPqUPydrvpu6HeiBfMaeKQu"
  230. sender: string; // "5DACzSg65taZ2NRktUtzBjhLZr8H5T8rwNoZUng9gQV6ayqT"
  231. senderMemo: string; //"4Testing1337SendToBurnerAddressHopingItWorksOfc5D5PhZQNJzcJXVBxwJxZcsutjKPqUPydrvpu6HeiBfMaeKQu"
  232. status: string; // FINALIZED | PENDING
  233. xmrAddress: string; //"No address found"
  234. }
  235. export interface Event {
  236. text: string;
  237. date: number;
  238. category: {
  239. tag: string;
  240. color: string;
  241. };
  242. link: {
  243. url: string;
  244. text: string;
  245. };
  246. }
  247. export interface Transaction {
  248. id: number;
  249. block: number;
  250. from: string;
  251. to: string;
  252. amount: number;
  253. }
  254. export interface Burner {
  255. wallet: string,
  256. totalburned: number;
  257. }
  258. export interface Burner {
  259. wallet: string,
  260. totalburned: number;
  261. }
  262. export interface ValidatorApiResponse {
  263. pageSize: number;
  264. totalCount: number;
  265. startBlock: number;
  266. endBlock: number;
  267. startTime: string;
  268. endTime: string;
  269. startEra: number;
  270. endEra: number;
  271. totalBlocks: number;
  272. report: ValidatorReportLineItem[]
  273. }
  274. export interface ValidatorReportLineItem {
  275. id: number;
  276. stakeTotal: string;
  277. stakeOwn: string;
  278. points: number;
  279. rewards: number;
  280. commission: number;
  281. blocksCount: number;
  282. }
  283. export interface CalendarGroup {
  284. id: number;
  285. title: string;
  286. }