Ver Fonte

improvements from `scripts/minting-burning-report/src/joystream-lib`

https://github.com/Joystream/community-repo/commit/c3b18cd6fac9a6a52954a3f6580127d1081c10c3
Joystream Stats há 2 anos atrás
pai
commit
a5b6553f7f
2 ficheiros alterados com 14 adições e 32 exclusões
  1. 14 15
      api.ts
  2. 0 17
      types.ts

+ 14 - 15
api.ts

@@ -28,7 +28,12 @@ import {
 } from "@joystream/types/council";
 import { Entity, EntityId } from "@joystream/types/content-directory";
 import { ContentId, DataObject } from "@joystream/types/media";
-import { MemberId, Membership } from "@joystream/types/members";
+import {
+  MemberId,
+  Membership,
+  PaidMembershipTerms,
+  PaidTermId,
+} from "@joystream/types/members";
 import { Mint, MintId } from "@joystream/types/mint";
 import {
   Proposal,
@@ -278,10 +283,8 @@ export const getWorkerReward = (
 export const getCouncilMint = (api: ApiPromise, hash: Hash): Promise<MintId> =>
   api.query.council.councilMint.at(hash);
 
-export const getGroupMint = async (
-  api: ApiPromise,
-  group: string
-): Promise<MintId> => (await api.query[group].mint()) as MintId;
+export const getGroupMint = (api: ApiPromise, group: string): Promise<MintId> =>
+  api.query[group].mint();
 
 export const getMintsCreated = async (
   api: ApiPromise,
@@ -507,8 +510,8 @@ export const getPaidMembershipTermsById = (
   api: ApiPromise,
   hash: Hash,
   id: PaidTermId | number
-): Promise<PaidMembershipTerms> => api.query.members.paidMembershipTermsById.at(hash, id);
-
+): Promise<PaidMembershipTerms> =>
+  api.query.members.paidMembershipTermsById.at(hash, id);
 
 // media
 export const getNextEntity = async (
@@ -519,15 +522,11 @@ export const getNextEntity = async (
     (await api.query.contentDirectory.nextEntityId.at(hash)) as EntityId
   ).toNumber();
 
-export const getNextChannel = async (
-  api: ApiPromise,
-  hash: Hash
-): Promise<number> => Number(await api.query.content.nextChannelId.at(hash));
+export const getNextChannel = (api: ApiPromise, hash: Hash): Promise<number> =>
+  api.query.content.nextChannelId.at(hash);
 
-export const getNextVideo = async (
-  api: ApiPromise,
-  hash: Hash
-): Promise<number> => Number(await api.query.content.nextVideoId.at(hash));
+export const getNextVideo = (api: ApiPromise, hash: Hash): Promise<number> =>
+  api.query.content.nextVideoId.at(hash);
 
 export const getEntity = (
   api: ApiPromise,

+ 0 - 17
types.ts

@@ -41,13 +41,6 @@ export interface ProposalDetail {
   authorId: number;
 }
 
-export interface ProposalStatus {
-  finalized: { proposalStatus: { approved: { pendingExecution: any } } };
-  finalizedAt: number;
-  encodedUnstakingErrorDueToBrokenRuntime?: any;
-  stakeDataAfterUnstakingError?: any;
-}
-
 export interface SpendingProposal {
   id: number;
   title: string;
@@ -137,13 +130,3 @@ export interface Exchange {
   status: string;
   xmrAddress: string;
 }
-
-export class Media {
-  constructor(public id: number, public title: string) {
-  }
-}
-
-export class Channel {
-  constructor(public id: number, public title: string) {
-  }
-}