Joystream Stats vor 2 Jahren
Ursprung
Commit
b309a5b664
2 geänderte Dateien mit 23 neuen und 25 gelöschten Zeilen
  1. 5 5
      content.ts
  2. 18 20
      storage.ts

+ 5 - 5
content.ts

@@ -98,7 +98,7 @@ export const getNextCuratorGroup = (
 export const getNextPerson = (api: ApiPromise, hash?: Hash): Promise<number> =>
   hash
     ? api.query.content.nextPersonId.at(hash)
-    : api.query.content.nextPersonId();
+    : (api.query.content.nextPersonId() as any);
 
 export const getNextPlaylist = (
   api: ApiPromise,
@@ -106,17 +106,17 @@ export const getNextPlaylist = (
 ): Promise<number> =>
   hash
     ? api.query.content.nextPlaylistId.at(hash)
-    : api.query.content.nextPlaylistId();
+    : (api.query.content.nextPlaylistId() as any);
 
 export const getNextSeries = (api: ApiPromise, hash?: Hash): Promise<number> =>
   hash
     ? api.query.content.nextSeriesId.at(hash)
-    : api.query.content.nextSeriesId();
+    : (api.query.content.nextSeriesId() as any);
 
 export const getNextVideo = (api: ApiPromise, hash?: Hash): Promise<number> =>
   hash
     ? api.query.content.nextVideoId.at(hash)
-    : api.query.content.nextVideoId();
+    : (api.query.content.nextVideoId() as any);
 
 export const getNextVideoCategory = (
   api: ApiPromise,
@@ -124,4 +124,4 @@ export const getNextVideoCategory = (
 ): Promise<number> =>
   hash
     ? api.query.content.nextVideoCategoryId.at(hash)
-    : api.query.content.nextVideoCategoryId();
+    : (api.query.content.nextVideoCategoryId() as any);

+ 18 - 20
storage.ts

@@ -18,29 +18,29 @@ import {
 import { Hash } from "@polkadot/types/interfaces";
 
 export const uploadingBlocked = (api: ApiPromise): Promise<boolean> =>
-  api.query.storage.uploadingBlocked() as Promise<boolean>;
+  api.query.storage.uploadingBlocked() as any;
 
 export const getBlacklist = (api: ApiPromise): Promise<Cid[]> =>
-  api.query.storage.blacklist();
+  api.query.storage.blacklist() as any;
 
 export const getBlacklistSize = (api: ApiPromise): Promise<number> =>
-  api.query.storage.currentBlacklistSize();
+  api.query.storage.currentBlacklistSize() as any;
 
 export const maxStorageBucketsPerBag = (api: ApiPromise): Promise<number> =>
-  api.query.storage.storageBucketsPerBagLimit();
+  api.query.storage.storageBucketsPerBagLimit() as any;
 
 export const maxDistributionBucketsPerBag = (
   api: ApiPromise
-): Promise<number> => api.query.storage.distributionBucketsPerBagLimit();
+): Promise<number> => api.query.storage.distributionBucketsPerBagLimit() as any;
 
 export const maxStorageBucketObjects = (api: ApiPromise): Promise<number> =>
-  api.query.storage.voucherMaxObjectsNumberLimit();
+  api.query.storage.voucherMaxObjectsNumberLimit() as any;
 
 export const maxStorageBucketSize = (api: ApiPromise): Promise<number> =>
-  api.query.storage.voucherMaxObjectsSizeLimit();
+  api.query.storage.voucherMaxObjectsSizeLimit() as any;
 
-export const feePerMegabyte = (api: ApiPromise): Promise<Bag> =>
-  api.query.storage.dataObjectPerMegabyteFee();
+export const feePerMegabyte = (api: ApiPromise): Promise<number> =>
+  api.query.storage.dataObjectPerMegabyteFee() as any;
 
 export const getDynamicBagPolicy = (
   api: ApiPromise,
@@ -49,7 +49,7 @@ export const getDynamicBagPolicy = (
   DynamicBagCreationPolicy | Map<DynamicBagType, DynamicBagCreationPolicy>
 > =>
   type
-    ? api.query.storage.dynamicBagCreationPolicies(type)
+    ? (api.query.storage.dynamicBagCreationPolicies(type) as any)
     : api.query.storage.dynamicBagCreationPolicies.entries();
 
 export const getNextDataObject = (api: ApiPromise): Promise<DataObjectId> =>
@@ -69,23 +69,23 @@ export const getNextDistributionFamily = (
 export const getBag = (
   api: ApiPromise,
   bagId: BagId | { Static: any } | { Dynamic: any } | string | number
-): Promise<Bag> => api.query.storage.bags(bagId);
+): Promise<Bag> => api.query.storage.bags(bagId) as any;
 
 export const getBags = async (api: ApiPromise): Promise<Map<BagId, Bag>> =>
-  api.query.storage.bags.entries();
+  api.query.storage.bags.entries() as any;
 
 export const getObject = (
   api: ApiPromise,
   bagId: BagId | { Static: any } | { Dynamic: any } | string | number,
   objectId: DataObjectId | number
 ): Promise<Map<DataObjectId, DataObject>> =>
-  api.query.storage.dataObjectsById(bagId, objectId);
+  api.query.storage.dataObjectsById(bagId, objectId) as any;
 
 export const getBagObjects = (
   api: ApiPromise,
   bagId: BagId | { Static: any } | { Dynamic: any } | string | number
 ): Promise<Map<[BagId, DataObjectId], DataObject>> =>
-  api.query.storage.dataObjectsById.entries(bagId);
+  api.query.storage.dataObjectsById.entries(bagId) as any;
 
 // storage
 export const getStorageBucket = (
@@ -100,19 +100,17 @@ export const getStorageBucket = (
 export const getStorageBuckets = (
   api: ApiPromise
 ): Promise<Map<StorageBucketId, StorageBucket>> =>
-  api.query.storage.storageBucketById.entries();
+  api.query.storage.storageBucketById.entries() as any;
 
 // distribution
 export const getDistributionFamilyNumber = (api: ApiPromise): Promise<number> =>
-  api.query.storage.distributionBucketFamilyNumber();
+  api.query.storage.distributionBucketFamilyNumber() as any;
 
 export const getDistributionFamilyBuckets = (
   api: ApiPromise,
   familyId: DistributionBucketFamilyId | number
 ): Promise<Map<DistributionBucketIndex, DistributionBucket>> =>
-  api.query.storage.distributionBucketByFamilyIdById.entries(
-    familyId
-  ) as Promise<Map<DistributionBucketIndex, DistributionBucket>>;
+  api.query.storage.distributionBucketByFamilyIdById.entries(familyId) as any;
 
 export const getDistributionFamilyBucket = (
   api: ApiPromise,
@@ -127,7 +125,7 @@ export const getDistributionFamilyBucket = (
 export const getDistributionFamilies = (
   api: ApiPromise
 ): Promise<Map<DistributionBucketFamilyId, DistributionBucketFamily>> =>
-  api.query.storage.distributionBucketFamilyById.entries();
+  api.query.storage.distributionBucketFamilyById.entries() as any;
 
 export const getDistributionFamily = async (
   api: ApiPromise,