Browse Source

Update types

Leszek Wiesner 3 years ago
parent
commit
75705e1849

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


+ 3 - 3
types/augment-codec/augment-api-query.ts

@@ -960,7 +960,7 @@ declare module '@polkadot/api/types/storage' {
       /**
        * Blacklisted data object hashes.
        **/
-      blacklist: AugmentedQuery<ApiType, (arg: ContentId | string | Uint8Array) => Observable<ITuple<[]>>, [ContentId]>;
+      blacklist: AugmentedQuery<ApiType, (arg: ContentId | string) => Observable<ITuple<[]>>, [ContentId]>;
       /**
        * Blacklist collection counter.
        **/
@@ -976,7 +976,7 @@ declare module '@polkadot/api/types/storage' {
       /**
        * Dynamic bag storage map.
        **/
-      dynamicBags: AugmentedQuery<ApiType, (arg: DynamicBagId | AnyNumber | Uint8Array) => Observable<DynamicBag>, [DynamicBagId]>;
+      dynamicBags: AugmentedQuery<ApiType, (arg: DynamicBagId | { Member: any } | { Channel: any } | string | Uint8Array) => Observable<DynamicBag>, [DynamicBagId]>;
       /**
        * Data object id counter. Starts at zero.
        **/
@@ -988,7 +988,7 @@ declare module '@polkadot/api/types/storage' {
       /**
        * Working groups' and council's bags storage map.
        **/
-      staticBags: AugmentedQuery<ApiType, (arg: StaticBagId | 'Council' | 'WorkingGroup' | number | Uint8Array) => Observable<StaticBag>, [StaticBagId]>;
+      staticBags: AugmentedQuery<ApiType, (arg: StaticBagId | { Council: any } | { WorkingGroup: any } | string | Uint8Array) => Observable<StaticBag>, [StaticBagId]>;
       /**
        * Storage buckets.
        **/

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


+ 26 - 15
types/augment/all/defs.json

@@ -552,7 +552,7 @@
         "identity": "IPNSIdentity",
         "expires_at": "u32"
     },
-    "ContentId": "[u8;32]",
+    "ContentId": "Text",
     "LiaisonJudgement": {
         "_enum": [
             "Pending",
@@ -571,7 +571,7 @@
     },
     "DataObjectStorageRelationshipId": "u64",
     "DataObjectStorageRelationship": {
-        "content_id": "ContentId",
+        "content_id": "Hash",
         "storage_provider": "StorageProviderId",
         "ready": "bool"
     },
@@ -580,7 +580,7 @@
         "description": "Text",
         "active": "bool"
     },
-    "DataObjectsMap": "BTreeMap<ContentId,DataObject>",
+    "DataObjectsMap": "BTreeMap<[u8;32],DataObject>",
     "ProposalId": "u32",
     "ProposalStatus": {
         "_enum": {
@@ -978,7 +978,18 @@
         "max_min_diff": "u64"
     },
     "DataObjectId": "u64",
-    "DynamicBagId": "u64",
+    "DynamicBagIdType": {
+        "_enum": {
+            "Member": "MemberId",
+            "Channel": "ChannelId"
+        }
+    },
+    "DynamicBagId": {
+        "_enum": {
+            "Member": "MemberId",
+            "Channel": "ChannelId"
+        }
+    },
     "Voucher": {
         "sizeLimit": "u64",
         "objectsLimit": "u64",
@@ -998,21 +1009,21 @@
     "StaticBag": "u64",
     "StorageBucket": "u64",
     "StaticBagId": {
-        "_enum": [
-            "Council",
-            "WorkingGroup"
-        ]
+        "_enum": {
+            "Council": "Null",
+            "WorkingGroup": "WorkingGroup"
+        }
     },
     "Static": {
-        "_enum": [
-            "Council",
-            "WorkingGroup"
-        ]
+        "_enum": {
+            "Council": "Null",
+            "WorkingGroup": "WorkingGroup"
+        }
     },
     "BagId": {
         "_enum": {
             "Static": "Static",
-            "Dynamic": "Null"
+            "Dynamic": "DynamicBagIdType"
         }
     },
     "DataObjectCreationParameters": {
@@ -1022,7 +1033,7 @@
     "BagIdType": {
         "_enum": {
             "Static": "Static",
-            "Dynamic": "Null"
+            "Dynamic": "DynamicBagIdType"
         }
     },
     "UploadParameters": {
@@ -1033,5 +1044,5 @@
     },
     "StorageBucketIdSet": "BTreeSet<StorageBucketId>",
     "DataObjectIdSet": "BTreeSet<DataObjectId>",
-    "ContentIdSet": "BTreeSet<Text>"
+    "ContentIdSet": "BTreeSet<ContentId>"
 }

+ 22 - 5
types/augment/all/types.ts

@@ -163,6 +163,7 @@ export interface BagId extends Enum {
   readonly isStatic: boolean;
   readonly asStatic: Static;
   readonly isDynamic: boolean;
+  readonly asDynamic: DynamicBagIdType;
 }
 
 /** @name BagIdType */
@@ -170,6 +171,7 @@ export interface BagIdType extends Enum {
   readonly isStatic: boolean;
   readonly asStatic: Static;
   readonly isDynamic: boolean;
+  readonly asDynamic: DynamicBagIdType;
 }
 
 /** @name BalanceOfMint */
@@ -286,10 +288,10 @@ export interface ClassPermissionsType extends Null {}
 export interface ClassPropertyValue extends Null {}
 
 /** @name ContentId */
-export interface ContentId extends U8aFixed {}
+export interface ContentId extends Text {}
 
 /** @name ContentIdSet */
-export interface ContentIdSet extends BTreeSet<Text> {}
+export interface ContentIdSet extends BTreeSet<ContentId> {}
 
 /** @name CreateEntityOperation */
 export interface CreateEntityOperation extends Struct {
@@ -417,11 +419,11 @@ export interface DataObjectId extends u64 {}
 export interface DataObjectIdSet extends BTreeSet<DataObjectId> {}
 
 /** @name DataObjectsMap */
-export interface DataObjectsMap extends BTreeMap<ContentId, DataObject> {}
+export interface DataObjectsMap extends BTreeMap<U8aFixed, DataObject> {}
 
 /** @name DataObjectStorageRelationship */
 export interface DataObjectStorageRelationship extends Struct {
-  readonly content_id: ContentId;
+  readonly content_id: Hash;
   readonly storage_provider: StorageProviderId;
   readonly ready: bool;
 }
@@ -472,7 +474,20 @@ export interface DynamicBagCreationPolicy extends Struct {
 }
 
 /** @name DynamicBagId */
-export interface DynamicBagId extends u64 {}
+export interface DynamicBagId extends Enum {
+  readonly isMember: boolean;
+  readonly asMember: MemberId;
+  readonly isChannel: boolean;
+  readonly asChannel: ChannelId;
+}
+
+/** @name DynamicBagIdType */
+export interface DynamicBagIdType extends Enum {
+  readonly isMember: boolean;
+  readonly asMember: MemberId;
+  readonly isChannel: boolean;
+  readonly asChannel: ChannelId;
+}
 
 /** @name DynamicBagType */
 export interface DynamicBagType extends Enum {
@@ -1240,6 +1255,7 @@ export interface StakingStatus extends Enum {
 export interface Static extends Enum {
   readonly isCouncil: boolean;
   readonly isWorkingGroup: boolean;
+  readonly asWorkingGroup: WorkingGroup;
 }
 
 /** @name StaticBag */
@@ -1249,6 +1265,7 @@ export interface StaticBag extends u64 {}
 export interface StaticBagId extends Enum {
   readonly isCouncil: boolean;
   readonly isWorkingGroup: boolean;
+  readonly asWorkingGroup: WorkingGroup;
 }
 
 /** @name Status */

+ 3 - 3
types/augment/augment-api-query.ts

@@ -960,7 +960,7 @@ declare module '@polkadot/api/types/storage' {
       /**
        * Blacklisted data object hashes.
        **/
-      blacklist: AugmentedQuery<ApiType, (arg: ContentId | string | Uint8Array) => Observable<ITuple<[]>>, [ContentId]>;
+      blacklist: AugmentedQuery<ApiType, (arg: ContentId | string) => Observable<ITuple<[]>>, [ContentId]>;
       /**
        * Blacklist collection counter.
        **/
@@ -976,7 +976,7 @@ declare module '@polkadot/api/types/storage' {
       /**
        * Dynamic bag storage map.
        **/
-      dynamicBags: AugmentedQuery<ApiType, (arg: DynamicBagId | AnyNumber | Uint8Array) => Observable<DynamicBag>, [DynamicBagId]>;
+      dynamicBags: AugmentedQuery<ApiType, (arg: DynamicBagId | { Member: any } | { Channel: any } | string | Uint8Array) => Observable<DynamicBag>, [DynamicBagId]>;
       /**
        * Data object id counter. Starts at zero.
        **/
@@ -988,7 +988,7 @@ declare module '@polkadot/api/types/storage' {
       /**
        * Working groups' and council's bags storage map.
        **/
-      staticBags: AugmentedQuery<ApiType, (arg: StaticBagId | 'Council' | 'WorkingGroup' | number | Uint8Array) => Observable<StaticBag>, [StaticBagId]>;
+      staticBags: AugmentedQuery<ApiType, (arg: StaticBagId | { Council: any } | { WorkingGroup: any } | string | Uint8Array) => Observable<StaticBag>, [StaticBagId]>;
       /**
        * Storage buckets.
        **/

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


+ 18 - 6
types/src/storage.ts

@@ -1,6 +1,8 @@
 import { Null, u64, Text, Vec, GenericAccountId as AccountId, BTreeSet } from '@polkadot/types'
 import { RegistryTypes } from '@polkadot/types/types'
-import { JoyBTreeSet, JoyEnum, JoyStructDecorated } from './common'
+import { JoyBTreeSet, JoyEnum, JoyStructDecorated, WorkingGroup } from './common'
+import { ChannelId } from './content-working-group'
+import { MemberId } from './members'
 
 export class DataObjectId extends u64 {}
 export class StorageBucketId extends u64 {}
@@ -17,8 +19,17 @@ export class StorageBucketsPerBagValueConstraint
   })
   implements StorageBucketsPerBagValueConstraintType {}
 
-//TODO: implement these types
-export class DynamicBagId extends u64 {}
+export const DynamicBagIdDef = {
+  Member: MemberId,
+  Channel: ChannelId,
+}
+export type DynamicBagIdKey = keyof typeof DynamicBagIdDef
+export class DynamicBagIdType extends JoyEnum(DynamicBagIdDef) {}
+
+// Runtime alias
+export class DynamicBagId extends DynamicBagIdType {}
+
+// TODO: implement these types:
 export class DynamicBag extends u64 {}
 export class StaticBag extends u64 {}
 export class StorageBucket extends u64 {}
@@ -43,7 +54,7 @@ export class DynamicBagType extends JoyEnum(DynamicBagTypeDef) {}
 
 export const StaticBagIdDef = {
   Council: Null,
-  WorkingGroup: Null,
+  WorkingGroup: WorkingGroup,
 } as const
 export type StaticBagIdKey = keyof typeof StaticBagIdDef
 export class StaticBagId extends JoyEnum(StaticBagIdDef) {}
@@ -52,7 +63,7 @@ export class Static extends StaticBagId {}
 
 export const BagIdDef = {
   Static,
-  Dynamic: Null, //TODO: implement dynamic type
+  Dynamic: DynamicBagIdType,
 } as const
 export type BagIdKey = keyof typeof BagIdDef
 export class BagId extends JoyEnum(BagIdDef) {}
@@ -115,6 +126,7 @@ export const storageTypes: RegistryTypes = {
   StorageBucketId,
   StorageBucketsPerBagValueConstraint,
   DataObjectId,
+  DynamicBagIdType,
   DynamicBagId,
   Voucher,
   DynamicBagType,
@@ -131,6 +143,6 @@ export const storageTypes: RegistryTypes = {
   StorageBucketIdSet,
   DataObjectIdSet,
   ContentIdSet,
-  ContentId
+  ContentId,
 }
 export default storageTypes

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