Browse Source

storage-node-v2: Fix types.

Shamil Gadelshin 3 years ago
parent
commit
67b6be058d

File diff suppressed because it is too large
+ 1 - 1
types/augment-codec/all.ts


File diff suppressed because it is too large
+ 0 - 0
types/augment-codec/augment-types.ts


+ 6 - 1
types/augment/all/defs.json

@@ -1008,7 +1008,7 @@
         "prize": "u128"
     },
     "Bag": {
-        "objects": "BTreeMap<DataObjectId,{\"accepted\":\"bool\",\"deletion_prize\":\"u128\",\"size\":\"u64\"}>",
+        "objects": "BTreeMap<DataObjectId,StorageDataObject>",
         "stored_by": "StorageBucketIdSet",
         "distributed_by": "Vec<u64>",
         "deletion_prize": "Option<u128>"
@@ -1070,5 +1070,10 @@
             "InvitedStorageWorker": "u64",
             "StorageWorker": "u64"
         }
+    },
+    "StorageDataObject": {
+        "accepted": "bool",
+        "deletion_prize": "u128",
+        "size": "u64"
     }
 }

+ 7 - 1
types/augment/all/types.ts

@@ -160,7 +160,7 @@ export interface Backers extends Vec<Backer> {}
 
 /** @name Bag */
 export interface Bag extends Struct {
-  readonly objects: BTreeMap<DataObjectId, {"accepted":"bool","deletion_prize":"u128","size":"u64"}>;
+  readonly objects: BTreeMap<DataObjectId, StorageDataObject>;
   readonly stored_by: StorageBucketIdSet;
   readonly distributed_by: Vec<u64>;
   readonly deletion_prize: Option<u128>;
@@ -1317,6 +1317,12 @@ export interface StorageBucketsPerBagValueConstraint extends Struct {
   readonly max_min_diff: u64;
 }
 
+/** @name StorageDataObject */
+export interface StorageDataObject extends Struct {
+  readonly accepted: bool;
+  readonly deletion_prize: u128;
+}
+
 /** @name StorageProviderId */
 export interface StorageProviderId extends u64 {}
 

File diff suppressed because it is too large
+ 0 - 0
types/augment/augment-types.ts


+ 7 - 6
types/src/storage.ts

@@ -30,22 +30,22 @@ export class StorageBucketsPerBagValueConstraint
   })
   implements StorageBucketsPerBagValueConstraintType {}
 
-export type DataObjectType = {
+export type StorageDataObjectType = {
   accepted: bool
   deletion_prize: BalanceOf
   size: u64
 }
 
-export class DataObject
+// DataObject from the storage pallet. Changed due to the types conflict resolution.
+export class StorageDataObject
   extends JoyStructDecorated({
     accepted: bool,
     deletion_prize: BalanceOf,
     size: u64,
   })
-  implements DataObjectType {}
+  implements StorageDataObjectType {}
 
 export class DataObjectIdSet extends JoyBTreeSet(DataObjectId) {}
-export class DataObjectIdMap extends BTreeMap.with(DataObjectId, DataObject) {}
 export class DistributionBucketId extends u64 {}
 export class StorageBucketIdSet extends JoyBTreeSet(StorageBucketId) {}
 export class DistributionBucketSet extends JoyBTreeSet(DistributionBucketId) {}
@@ -65,7 +65,7 @@ export class DynamicBagDeletionPrize
 export class DynamicBagDeletionPrizeObject extends DynamicBagDeletionPrize {}
 
 export type BagTypeDef = {
-  objects: DataObjectIdMap
+  objects: BTreeMap<DataObjectId, StorageDataObject>
   stored_by: StorageBucketIdSet
   distributed_by: DistributionBucketSet
   deletion_prize: Option<BalanceOf>
@@ -73,7 +73,7 @@ export type BagTypeDef = {
 
 export class Bag
   extends JoyStructDecorated({
-    objects: DataObjectIdMap,
+    objects: BTreeMap.with(DataObjectId, StorageDataObject),
     stored_by: StorageBucketIdSet,
     distributed_by: DistributionBucketSet,
     deletion_prize: Option.with(BalanceOf),
@@ -223,5 +223,6 @@ export const storageTypes: RegistryTypes = {
   ContentIdSet,
   Cid,
   StorageBucketOperatorStatus,
+  StorageDataObject,
 }
 export default storageTypes

Some files were not shown because too many files changed in this diff