소스 검색

Fix getStorageBuckets

Ricardo Maltez 2 년 전
부모
커밋
aecbae8fe9
1개의 변경된 파일5개의 추가작업 그리고 3개의 파일을 삭제
  1. 5 3
      storage.ts

+ 5 - 3
storage.ts

@@ -98,9 +98,11 @@ export const getStorageBucket = (
     : api.query.storage.storageBucketById(bucketId)) as Promise<StorageBucket>;
 
 export const getStorageBuckets = (
-  api: ApiPromise
-): Promise<Map<StorageBucketId, StorageBucket>> =>
-  api.query.storage.storageBucketById.entries() as any;
+    api: ApiPromise
+): Promise<Map<StorageBucketId, StorageBucket>> => api.query.storage.storageBucketById.entries<StorageBucket>().then((entries) => entries.map(([{
+        args: [id],
+    }, bucket]) => [id, bucket]
+)) as Promise<Map<StorageBucketId, StorageBucket>>
 
 // distribution
 export const getDistributionFamilyNumber = (api: ApiPromise): Promise<number> =>