|
@@ -1,40 +1,49 @@
|
|
|
-import {Null, u64, Text, Vec, GenericAccountId as AccountId} from "@polkadot/types";
|
|
|
-import {RegistryTypes} from "@polkadot/types/types";
|
|
|
-import {JoyBTreeSet, JoyEnum, JoyStructDecorated} from './common'
|
|
|
+import { Null, u64, Text, Vec, GenericAccountId as AccountId } from '@polkadot/types'
|
|
|
+import { RegistryTypes } from '@polkadot/types/types'
|
|
|
+import { JoyBTreeSet, JoyEnum, JoyStructDecorated } from './common'
|
|
|
|
|
|
export class DataObjectId extends u64 {}
|
|
|
export class StorageBucketId extends u64 {}
|
|
|
|
|
|
export type StorageBucketsPerBagValueConstraintType = {
|
|
|
- min: u64,
|
|
|
- max_min_diff: u64,
|
|
|
+ min: u64
|
|
|
+ max_min_diff: u64
|
|
|
}
|
|
|
|
|
|
export class StorageBucketsPerBagValueConstraint
|
|
|
- extends JoyStructDecorated({
|
|
|
- min: u64,
|
|
|
- max_min_diff: u64,
|
|
|
- })
|
|
|
- implements StorageBucketsPerBagValueConstraintType {}
|
|
|
+ extends JoyStructDecorated({
|
|
|
+ min: u64,
|
|
|
+ max_min_diff: u64,
|
|
|
+ })
|
|
|
+ implements StorageBucketsPerBagValueConstraintType {}
|
|
|
|
|
|
//TODO: implement these types
|
|
|
export class DynamicBagId extends u64 {}
|
|
|
-export class DynamicBagCreationPolicy extends u64 {}
|
|
|
export class DynamicBag extends u64 {}
|
|
|
export class StaticBag extends u64 {}
|
|
|
export class StorageBucket extends u64 {}
|
|
|
//
|
|
|
|
|
|
+export type DynamicBagCreationPolicyType = {
|
|
|
+ numberOfStorageBuckets: u64
|
|
|
+}
|
|
|
+
|
|
|
+export class DynamicBagCreationPolicy
|
|
|
+ extends JoyStructDecorated({
|
|
|
+ numberOfStorageBuckets: u64,
|
|
|
+ })
|
|
|
+ implements DynamicBagCreationPolicyType {}
|
|
|
+
|
|
|
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: Null,
|
|
|
+ Council: Null,
|
|
|
+ WorkingGroup: Null,
|
|
|
} as const
|
|
|
export type StaticBagIdKey = keyof typeof StaticBagIdDef
|
|
|
export class StaticBagId extends JoyEnum(StaticBagIdDef) {}
|
|
@@ -42,8 +51,8 @@ export class StaticBagId extends JoyEnum(StaticBagIdDef) {}
|
|
|
export class Static extends StaticBagId {}
|
|
|
|
|
|
export const BagIdDef = {
|
|
|
- Static,
|
|
|
- Dynamic: Null,//TODO: implement dynamic type
|
|
|
+ Static,
|
|
|
+ Dynamic: Null, //TODO: implement dynamic type
|
|
|
} as const
|
|
|
export type BagIdKey = keyof typeof BagIdDef
|
|
|
export class BagId extends JoyEnum(BagIdDef) {}
|
|
@@ -52,72 +61,71 @@ export class BagId extends JoyEnum(BagIdDef) {}
|
|
|
export class BagIdType extends BagId {}
|
|
|
|
|
|
export type VoucherType = {
|
|
|
+ sizeLimit: u64
|
|
|
+ objectsLimit: u64
|
|
|
+ sizeUsed: u64
|
|
|
+ objectsUsed: u64
|
|
|
+}
|
|
|
+
|
|
|
+export class Voucher
|
|
|
+ extends JoyStructDecorated({
|
|
|
sizeLimit: u64,
|
|
|
objectsLimit: u64,
|
|
|
sizeUsed: u64,
|
|
|
objectsUsed: u64,
|
|
|
-}
|
|
|
-
|
|
|
-export class Voucher
|
|
|
- extends JoyStructDecorated({
|
|
|
- sizeLimit: u64,
|
|
|
- objectsLimit: u64,
|
|
|
- sizeUsed: u64,
|
|
|
- objectsUsed: u64,
|
|
|
- })
|
|
|
- implements VoucherType {}
|
|
|
+ })
|
|
|
+ implements VoucherType {}
|
|
|
|
|
|
export class StorageBucketIdSet extends JoyBTreeSet(StorageBucketId) {}
|
|
|
|
|
|
export class DataObjectIdSet extends JoyBTreeSet(DataObjectId) {}
|
|
|
|
|
|
export type DataObjectCreationParametersType = {
|
|
|
- size: u64,
|
|
|
- ipfsContentId: Text,
|
|
|
+ size: u64
|
|
|
+ ipfsContentId: Text
|
|
|
}
|
|
|
|
|
|
export class DataObjectCreationParameters
|
|
|
- extends JoyStructDecorated({
|
|
|
- size: u64,
|
|
|
- ipfsContentId: Text,
|
|
|
- })
|
|
|
- implements DataObjectCreationParametersType {}
|
|
|
+ extends JoyStructDecorated({
|
|
|
+ size: u64,
|
|
|
+ ipfsContentId: Text,
|
|
|
+ })
|
|
|
+ implements DataObjectCreationParametersType {}
|
|
|
|
|
|
export type UploadParametersType = {
|
|
|
- authenticationKey: Text,
|
|
|
- bagId: BagId,
|
|
|
- objectCreationList: Vec<DataObjectCreationParameters>,
|
|
|
- deletionPrizeSourceAccountId: AccountId,
|
|
|
+ authenticationKey: Text
|
|
|
+ bagId: BagId
|
|
|
+ objectCreationList: Vec<DataObjectCreationParameters>
|
|
|
+ deletionPrizeSourceAccountId: AccountId
|
|
|
}
|
|
|
|
|
|
export class UploadParameters
|
|
|
- extends JoyStructDecorated({
|
|
|
- authenticationKey: Text,
|
|
|
- bagId: BagId,
|
|
|
- objectCreationList: Vec.with(DataObjectCreationParameters),
|
|
|
- deletionPrizeSourceAccountId: AccountId,
|
|
|
- })
|
|
|
- implements UploadParametersType {}
|
|
|
-
|
|
|
+ extends JoyStructDecorated({
|
|
|
+ authenticationKey: Text,
|
|
|
+ bagId: BagId,
|
|
|
+ objectCreationList: Vec.with(DataObjectCreationParameters),
|
|
|
+ deletionPrizeSourceAccountId: AccountId,
|
|
|
+ })
|
|
|
+ implements UploadParametersType {}
|
|
|
|
|
|
export const storageTypes: RegistryTypes = {
|
|
|
- StorageBucketId,
|
|
|
- StorageBucketsPerBagValueConstraint,
|
|
|
- DataObjectId,
|
|
|
- DynamicBagId,
|
|
|
- Voucher,
|
|
|
- DynamicBagType,
|
|
|
- DynamicBagCreationPolicy,
|
|
|
- DynamicBag,
|
|
|
- StaticBag,
|
|
|
- StorageBucket,
|
|
|
- StaticBagId,
|
|
|
- Static,
|
|
|
- BagId,
|
|
|
- DataObjectCreationParameters,
|
|
|
- BagIdType,
|
|
|
- UploadParameters,
|
|
|
- StorageBucketIdSet,
|
|
|
- DataObjectIdSet,
|
|
|
+ StorageBucketId,
|
|
|
+ StorageBucketsPerBagValueConstraint,
|
|
|
+ DataObjectId,
|
|
|
+ DynamicBagId,
|
|
|
+ Voucher,
|
|
|
+ DynamicBagType,
|
|
|
+ DynamicBagCreationPolicy,
|
|
|
+ DynamicBag,
|
|
|
+ StaticBag,
|
|
|
+ StorageBucket,
|
|
|
+ StaticBagId,
|
|
|
+ Static,
|
|
|
+ BagId,
|
|
|
+ DataObjectCreationParameters,
|
|
|
+ BagIdType,
|
|
|
+ UploadParameters,
|
|
|
+ StorageBucketIdSet,
|
|
|
+ DataObjectIdSet,
|
|
|
}
|
|
|
-export default storageTypes
|
|
|
+export default storageTypes
|