Browse Source

types: Format the code.

Shamil Gadelshin 3 years ago
parent
commit
fa5361147d
4 changed files with 144 additions and 145 deletions
  1. 4 3
      types/src/JoyStruct.ts
  2. 1 2
      types/src/common.ts
  3. 1 2
      types/src/proposals.ts
  4. 138 138
      types/src/storage.ts

+ 4 - 3
types/src/JoyStruct.ts

@@ -13,9 +13,10 @@ export type ExtendedStructGetters<FieldTypes extends Record<string, Constructor>
   [k in keyof FieldTypes]: InstanceType<FieldTypes[k]>
 }
 // More rich TypeScript definition of the Struct (includes automatically created getters)
-export type ExtendedStructDecorated<
-  FieldTypes extends Record<string, Constructor>
-> = ExtendedStructGetters<FieldTypes> & ExtendedStruct<FieldTypes>
+export type ExtendedStructDecorated<FieldTypes extends Record<string, Constructor>> = ExtendedStructGetters<
+  FieldTypes
+> &
+  ExtendedStruct<FieldTypes>
 
 export interface StructConstructor<
   FieldTypes extends Record<string, Constructor>,

+ 1 - 2
types/src/common.ts

@@ -98,8 +98,7 @@ export type InputValidationLengthConstraintType = {
   max_min_diff: u16
 }
 
-export class InputValidationLengthConstraint
-  extends JoyStructDecorated({ min: u16, max_min_diff: u16 })
+export class InputValidationLengthConstraint extends JoyStructDecorated({ min: u16, max_min_diff: u16 })
   implements InputValidationLengthConstraintType {
   get max(): u16 {
     return this.registry.createType('u16', this.min.add(this.max_min_diff))

+ 1 - 2
types/src/proposals.ts

@@ -82,8 +82,7 @@ export type IActiveStake = {
   stake_id: StakeId
   source_account_id: AccountId
 }
-export class ActiveStake
-  extends JoyStructDecorated({ stake_id: StakeId, source_account_id: AccountId })
+export class ActiveStake extends JoyStructDecorated({ stake_id: StakeId, source_account_id: AccountId })
   implements IActiveStake {}
 
 export class ExecutionFailedStatus extends JoyStructDecorated({

+ 138 - 138
types/src/storage.ts

@@ -8,30 +8,30 @@ export class DataObjectId extends u64 {}
 export class StorageBucketId extends u64 {}
 
 export type IStorageBucketsPerBagValueConstraint = {
-    min: u64
-    max_min_diff: u64
+  min: u64
+  max_min_diff: u64
 }
 
 export class StorageBucketsPerBagValueConstraint
-    extends JoyStructDecorated({
-        min: u64,
-        max_min_diff: u64,
-    })
-    implements IStorageBucketsPerBagValueConstraint {}
+  extends JoyStructDecorated({
+    min: u64,
+    max_min_diff: u64,
+  })
+  implements IStorageBucketsPerBagValueConstraint {}
 
 export type IDataObject = {
-    accepted: bool
-    deletion_prize: BalanceOf
-    size: u64
+  accepted: bool
+  deletion_prize: BalanceOf
+  size: u64
 }
 
 export class DataObject
-    extends JoyStructDecorated({
-        accepted: bool,
-        deletion_prize: BalanceOf,
-        size: u64,
-    })
-    implements IDataObject {}
+  extends JoyStructDecorated({
+    accepted: bool,
+    deletion_prize: BalanceOf,
+    size: u64,
+  })
+  implements IDataObject {}
 
 export class DataObjectIdSet extends JoyBTreeSet(DataObjectId) {}
 export class DistributionBucketId extends u64 {}
@@ -40,55 +40,55 @@ export class StorageBucketIdSet extends JoyBTreeSet(StorageBucketId) {}
 export class DistributionBucketSet extends JoyBTreeSet(DistributionBucketId) {}
 
 export type IDynamicBagDeletionPrize = {
-    account_id: AccountId
-    prize: BalanceOf
+  account_id: AccountId
+  prize: BalanceOf
 }
 
 export class DynamicBagDeletionPrize
-    extends JoyStructDecorated({
-        account_id: AccountId,
-        prize: BalanceOf,
-    })
-    implements IDynamicBagDeletionPrize {}
+  extends JoyStructDecorated({
+    account_id: AccountId,
+    prize: BalanceOf,
+  })
+  implements IDynamicBagDeletionPrize {}
 
 export class DynamicBagDeletionPrizeRecord extends DynamicBagDeletionPrize {}
 
 export type IBag = {
-    objects: BTreeMap<DataObjectId, DataObject>
-    stored_by: StorageBucketIdSet
-    distributed_by: DistributionBucketSet
-    deletion_prize: Option<BalanceOf>
+  objects: BTreeMap<DataObjectId, DataObject>
+  stored_by: StorageBucketIdSet
+  distributed_by: DistributionBucketSet
+  deletion_prize: Option<BalanceOf>
 }
 
 export class Bag
-    extends JoyStructDecorated({
-        objects: BTreeMap.with(DataObjectId, DataObject),
-        stored_by: StorageBucketIdSet,
-        distributed_by: DistributionBucketSet,
-        deletion_prize: Option.with(BalanceOf),
-    })
-    implements IBag {}
+  extends JoyStructDecorated({
+    objects: BTreeMap.with(DataObjectId, DataObject),
+    stored_by: StorageBucketIdSet,
+    distributed_by: DistributionBucketSet,
+    deletion_prize: Option.with(BalanceOf),
+  })
+  implements IBag {}
 
 export type IDynamicBagCreationPolicy = {
-    numberOfStorageBuckets: u64
+  numberOfStorageBuckets: u64
 }
 
 export class DynamicBagCreationPolicy
-    extends JoyStructDecorated({
-        numberOfStorageBuckets: u64,
-    })
-    implements IDynamicBagCreationPolicy {}
+  extends JoyStructDecorated({
+    numberOfStorageBuckets: u64,
+  })
+  implements IDynamicBagCreationPolicy {}
 
 export const DynamicBagTypeDef = {
-    Member: Null,
-    Channel: Null,
+  Member: Null,
+  Channel: Null,
 } as const
 export type DynamicBagTypeKey = keyof typeof DynamicBagTypeDef
 export class DynamicBagType extends JoyEnum(DynamicBagTypeDef) {}
 
 export const StaticBagIdDef = {
-    Council: Null,
-    WorkingGroup: WorkingGroup,
+  Council: Null,
+  WorkingGroup: WorkingGroup,
 } as const
 export class StaticBagId extends JoyEnum(StaticBagIdDef) {}
 export class Static extends StaticBagId {}
@@ -97,15 +97,15 @@ export class Static extends StaticBagId {}
 export class ChannelId extends u64 {}
 
 export const DynamicBagIdDef = {
-    Member: MemberId,
-    Channel: ChannelId,
+  Member: MemberId,
+  Channel: ChannelId,
 } as const
 export class DynamicBagId extends JoyEnum(DynamicBagIdDef) {}
 export class Dynamic extends DynamicBagId {}
 
 export const BagIdDef = {
-    Static,
-    Dynamic,
+  Static,
+  Dynamic,
 } as const
 export class BagId extends JoyEnum(BagIdDef) {}
 
@@ -113,133 +113,133 @@ export class BagId extends JoyEnum(BagIdDef) {}
 export class BagIdType extends BagId {}
 
 export type IVoucher = {
-    sizeLimit: u64
-    objectsLimit: u64
-    sizeUsed: u64
-    objectsUsed: u64
+  sizeLimit: u64
+  objectsLimit: u64
+  sizeUsed: u64
+  objectsUsed: u64
 }
 
 export class Voucher
-    extends JoyStructDecorated({
-        sizeLimit: u64,
-        objectsLimit: u64,
-        sizeUsed: u64,
-        objectsUsed: u64,
-    })
-    implements IVoucher {}
+  extends JoyStructDecorated({
+    sizeLimit: u64,
+    objectsLimit: u64,
+    sizeUsed: u64,
+    objectsUsed: u64,
+  })
+  implements IVoucher {}
 
 export const StorageBucketOperatorStatusDef = {
-    Missing: Null,
-    InvitedStorageWorker: WorkerId,
-    StorageWorker: WorkerId,
+  Missing: Null,
+  InvitedStorageWorker: WorkerId,
+  StorageWorker: WorkerId,
 } as const
 export class StorageBucketOperatorStatus extends JoyEnum(StorageBucketOperatorStatusDef) {}
 
 export type IStorageBucket = {
-    operator_status: StorageBucketOperatorStatus
-    accepting_new_bags: bool
-    voucher: Voucher
-    metadata: Bytes
+  operator_status: StorageBucketOperatorStatus
+  accepting_new_bags: bool
+  voucher: Voucher
+  metadata: Bytes
 }
 
 export class StorageBucket
-    extends JoyStructDecorated({
-        operator_status: StorageBucketOperatorStatus,
-        accepting_new_bags: bool,
-        voucher: Voucher,
-        metadata: Bytes,
-    })
-    implements IStorageBucket {}
+  extends JoyStructDecorated({
+    operator_status: StorageBucketOperatorStatus,
+    accepting_new_bags: bool,
+    voucher: Voucher,
+    metadata: Bytes,
+  })
+  implements IStorageBucket {}
 
 export type IDataObjectCreationParameters = {
-    size: u64
-    ipfsContentId: Bytes
+  size: u64
+  ipfsContentId: Bytes
 }
 
 export class DataObjectCreationParameters
-    extends JoyStructDecorated({
-        size: u64,
-        ipfsContentId: Bytes,
-    })
-    implements IDataObjectCreationParameters {}
+  extends JoyStructDecorated({
+    size: u64,
+    ipfsContentId: Bytes,
+  })
+  implements IDataObjectCreationParameters {}
 
 export type IUploadParameters = {
-    authenticationKey: Bytes
-    bagId: BagId
-    objectCreationList: Vec<DataObjectCreationParameters>
-    deletionPrizeSourceAccountId: AccountId
-    expectedDataSizeFee: BalanceOf
+  authenticationKey: Bytes
+  bagId: BagId
+  objectCreationList: Vec<DataObjectCreationParameters>
+  deletionPrizeSourceAccountId: AccountId
+  expectedDataSizeFee: BalanceOf
 }
 
 export class UploadParameters
-    extends JoyStructDecorated({
-        authenticationKey: Bytes,
-        bagId: BagId,
-        objectCreationList: Vec.with(DataObjectCreationParameters),
-        deletionPrizeSourceAccountId: AccountId,
-        expectedDataSizeFee: BalanceOf,
-    })
-    implements IUploadParameters {}
+  extends JoyStructDecorated({
+    authenticationKey: Bytes,
+    bagId: BagId,
+    objectCreationList: Vec.with(DataObjectCreationParameters),
+    deletionPrizeSourceAccountId: AccountId,
+    expectedDataSizeFee: BalanceOf,
+  })
+  implements IUploadParameters {}
 
 export class Cid extends Bytes {}
 export class ContentIdSet extends BTreeSet.with(Cid) {}
 
 export type IDistributionBucket = {
-    accepting_new_bags: bool
-    distributing: bool
-    pending_invitations: BTreeSet<WorkerId>
-    operators: BTreeSet<WorkerId>
-    assigned_bags: u64
+  accepting_new_bags: bool
+  distributing: bool
+  pending_invitations: BTreeSet<WorkerId>
+  operators: BTreeSet<WorkerId>
+  assigned_bags: u64
 }
 
 export class DistributionBucket
-    extends JoyStructDecorated({
-        accepting_new_bags: bool,
-        distributing: bool,
-        pending_invitations: BTreeSet.with(WorkerId),
-        operators: BTreeSet.with(WorkerId),
-        assigned_bags: u64,
-    })
-    implements IDistributionBucket {}
+  extends JoyStructDecorated({
+    accepting_new_bags: bool,
+    distributing: bool,
+    pending_invitations: BTreeSet.with(WorkerId),
+    operators: BTreeSet.with(WorkerId),
+    assigned_bags: u64,
+  })
+  implements IDistributionBucket {}
 
 export type IDistributionBucketFamily = {
-    distribution_buckets: BTreeMap<DistributionBucketId, DistributionBucket>
+  distribution_buckets: BTreeMap<DistributionBucketId, DistributionBucket>
 }
 
 export class DistributionBucketFamily
-    extends JoyStructDecorated({
-        distribution_buckets: BTreeMap.with(DistributionBucketId, DistributionBucket),
-    })
-    implements IDistributionBucketFamily {}
+  extends JoyStructDecorated({
+    distribution_buckets: BTreeMap.with(DistributionBucketId, DistributionBucket),
+  })
+  implements IDistributionBucketFamily {}
 
 export const storageTypes: RegistryTypes = {
-    StorageBucketId,
-    StorageBucketsPerBagValueConstraint,
-    DataObjectId,
-    DynamicBagId,
-    Voucher,
-    DynamicBagType,
-    DynamicBagCreationPolicy,
-    DynamicBagDeletionPrize,
-    DynamicBagDeletionPrizeRecord,
-    Bag,
-    StorageBucket,
-    StaticBagId,
-    Static,
-    Dynamic,
-    BagId,
-    DataObjectCreationParameters,
-    BagIdType,
-    UploadParameters,
-    StorageBucketIdSet,
-    DataObjectIdSet,
-    ContentIdSet,
-    Cid,
-    StorageBucketOperatorStatus,
-    DataObject,
-    DistributionBucketId,
-    DistributionBucketFamilyId,
-    DistributionBucket,
-    DistributionBucketFamily,
+  StorageBucketId,
+  StorageBucketsPerBagValueConstraint,
+  DataObjectId,
+  DynamicBagId,
+  Voucher,
+  DynamicBagType,
+  DynamicBagCreationPolicy,
+  DynamicBagDeletionPrize,
+  DynamicBagDeletionPrizeRecord,
+  Bag,
+  StorageBucket,
+  StaticBagId,
+  Static,
+  Dynamic,
+  BagId,
+  DataObjectCreationParameters,
+  BagIdType,
+  UploadParameters,
+  StorageBucketIdSet,
+  DataObjectIdSet,
+  ContentIdSet,
+  Cid,
+  StorageBucketOperatorStatus,
+  DataObject,
+  DistributionBucketId,
+  DistributionBucketFamilyId,
+  DistributionBucket,
+  DistributionBucketFamily,
 }
 export default storageTypes