|
@@ -2,6 +2,9 @@ import { CacheEvent } from "./types";
|
|
import { Mint, MintId } from "@joystream/types/mint";
|
|
import { Mint, MintId } from "@joystream/types/mint";
|
|
import { Moment } from "@polkadot/types/interfaces";
|
|
import { Moment } from "@polkadot/types/interfaces";
|
|
|
|
|
|
|
|
+export const sum = (a: number[]) =>
|
|
|
|
+ a.reduce((s: number, i: number) => s + i, 0);
|
|
|
|
+
|
|
export const getPercent = (value1: number, value2: number): number => {
|
|
export const getPercent = (value1: number, value2: number): number => {
|
|
if (value1 === 0) return value2 > 0 ? 100 : 0;
|
|
if (value1 === 0) return value2 > 0 ? 100 : 0;
|
|
return Number(((value2 * 100) / value1 - 100).toFixed(2));
|
|
return Number(((value2 * 100) / value1 - 100).toFixed(2));
|
|
@@ -32,3 +35,114 @@ export const eventStats = (blockEventsCache: Map<number, CacheEvent[]>) => {
|
|
)
|
|
)
|
|
);
|
|
);
|
|
};
|
|
};
|
|
|
|
+
|
|
|
|
+export {
|
|
|
|
+ connectApi,
|
|
|
|
+ getBlock,
|
|
|
|
+ getBlockHash,
|
|
|
|
+ getHead,
|
|
|
|
+ getBestHash,
|
|
|
|
+ getTimestamp,
|
|
|
|
+ getIssuance,
|
|
|
|
+ getEvents,
|
|
|
|
+ getEra,
|
|
|
|
+ getEraStake,
|
|
|
|
+ getCouncil,
|
|
|
|
+ getCouncilAt,
|
|
|
|
+ getCouncils,
|
|
|
|
+ getCouncilRound,
|
|
|
|
+ getCouncilElectionStage,
|
|
|
|
+ getCouncilTermEnd,
|
|
|
|
+ getCouncilElectionStatus,
|
|
|
|
+ getCouncilSize,
|
|
|
|
+ getCouncilApplicants,
|
|
|
|
+ getCouncilApplicantStakes,
|
|
|
|
+ getCouncilCommitments,
|
|
|
|
+ getCouncilPayoutInterval,
|
|
|
|
+ getCouncilPayout,
|
|
|
|
+ getCouncilElectionDurations,
|
|
|
|
+ getCommitments,
|
|
|
|
+ getCommitment,
|
|
|
|
+ getNextWorker,
|
|
|
|
+ getWorker,
|
|
|
|
+ getWorkers,
|
|
|
|
+ getStake,
|
|
|
|
+ getWorkerReward,
|
|
|
|
+ getCouncilMint,
|
|
|
|
+ getGroupMint,
|
|
|
|
+ getMintsCreated,
|
|
|
|
+ getMint,
|
|
|
|
+ getAccounts,
|
|
|
|
+ getAccount,
|
|
|
|
+ getNextMember,
|
|
|
|
+ getMember,
|
|
|
|
+ getMemberIdByAccount,
|
|
|
|
+ getMemberHandle,
|
|
|
|
+ getMemberHandleByAccount,
|
|
|
|
+ getNextPost,
|
|
|
|
+ getNextThread,
|
|
|
|
+ getNextCategory,
|
|
|
|
+ getCategory,
|
|
|
|
+ getThread,
|
|
|
|
+ getPost,
|
|
|
|
+ getActiveProposals,
|
|
|
|
+ getProposalCount,
|
|
|
|
+ getProposalInfo,
|
|
|
|
+ getProposalDetails,
|
|
|
|
+ getProposalType,
|
|
|
|
+ getProposal,
|
|
|
|
+ getProposalVotes,
|
|
|
|
+ getProposalPost,
|
|
|
|
+ getProposalPosts,
|
|
|
|
+ getProposalPostCount,
|
|
|
|
+ getProposalThreadCount,
|
|
|
|
+ getValidatorCount,
|
|
|
|
+ getValidators,
|
|
|
|
+ getPaidMembershipTermsById,
|
|
|
|
+} from "./api";
|
|
|
|
+
|
|
|
|
+export {
|
|
|
|
+ getChannel,
|
|
|
|
+ getChannelCategory,
|
|
|
|
+ getCuratorGroup,
|
|
|
|
+ getPerson,
|
|
|
|
+ getPlaylist,
|
|
|
|
+ getSeries,
|
|
|
|
+ getVideo,
|
|
|
|
+ getVideoCategory,
|
|
|
|
+ getNextChannel,
|
|
|
|
+ getNextChannelCategory,
|
|
|
|
+ getNextChannelOwnershipTransferRequestId,
|
|
|
|
+ getNextCuratorGroup,
|
|
|
|
+ getNextPerson,
|
|
|
|
+ getNextPlaylist,
|
|
|
|
+ getNextSeries,
|
|
|
|
+ getNextVideo,
|
|
|
|
+ getNextVideoCategory,
|
|
|
|
+} from "./content";
|
|
|
|
+
|
|
|
|
+export {
|
|
|
|
+ feePerMegabyte,
|
|
|
|
+ maxStorageBucketsPerBag,
|
|
|
|
+ maxDistributionBucketsPerBag,
|
|
|
|
+ maxStorageBucketObjects,
|
|
|
|
+ maxStorageBucketSize,
|
|
|
|
+ uploadingBlocked,
|
|
|
|
+ getBlacklist,
|
|
|
|
+ getBlacklistSize,
|
|
|
|
+ getDynamicBagPolicy,
|
|
|
|
+ getNextDataObject,
|
|
|
|
+ getNextStorageBucket,
|
|
|
|
+ getNextDistributionFamily,
|
|
|
|
+ getBag,
|
|
|
|
+ getBags,
|
|
|
|
+ getObject,
|
|
|
|
+ getBagObjects,
|
|
|
|
+ getStorageBucket,
|
|
|
|
+ getStorageBuckets,
|
|
|
|
+ getDistributionFamily,
|
|
|
|
+ getDistributionFamilies,
|
|
|
|
+ getDistributionFamilyNumber,
|
|
|
|
+ getDistributionFamilyBucket,
|
|
|
|
+ getDistributionFamilyBuckets,
|
|
|
|
+} from "./storage";
|