Browse Source

query node - content nft joystream types + schema and mappings improvements

ondratra 3 years ago
parent
commit
79c736e875

File diff suppressed because it is too large
+ 0 - 0
chain-metadata.json


+ 46 - 0
query-node/manifest.yml

@@ -85,6 +85,22 @@ typegen:
     - content.FeaturedVideosSet
     - content.ChannelDeleted
 
+    # content NFTs
+    - content.AuctionStarted
+    - content.NftIssued
+    - content.AuctionBidMade
+    - content.AuctionBidCanceled
+    - content.AuctionCanceled
+    - content.EnglishAuctionCompleted
+    - content.BidMadeCompletingAuction
+    - content.OpenAuctionBidAccepted
+    - content.OfferStarted
+    - content.OfferAccepted
+    - content.OfferCanceled
+    - content.NftSellOrderMade
+    - content.NftBought
+    - content.BuyNowCanceled
+
     # working groups (we're using "storage_working_group" as a reference module)
     - storage_working_group.WorkerStorageUpdated
     - storage_working_group.OpeningFilled
@@ -176,6 +192,36 @@ mappings:
     - event: content.ChannelDeleted
       handler: content_ChannelDeleted
 
+    # content NFTs
+    - event: content.AuctionStarted
+      handler: content_AuctionStarted
+    - event: content.NftIssued
+      handler: content_NftIssued
+    - event: content.AuctionBidMade
+      handler: content_AuctionBidMade
+    - event: content.AuctionBidCanceled
+      handler: content_AuctionBidCanceled
+    - event: content.AuctionCanceled
+      handler: content_AuctionCanceled
+    - event: content.EnglishAuctionCompleted
+      handler: content_EnglishAuctionCompleted
+    - event: content.BidMadeCompletingAuction
+      handler: content_BidMadeCompletingAuction
+    - event: content.OpenAuctionBidAccepted
+      handler: content_OpenAuctionBidAccepted
+    - event: content.OfferStarted
+      handler: content_OfferStarted
+    - event: content.OfferAccepted
+      handler: content_OfferAccepted
+    - event: content.OfferCanceled
+      handler: content_OfferCanceled
+    - event: content.NftSellOrderMade
+      handler: content_NftSellOrderMade
+    - event: content.NftBought
+      handler: content_NftBought
+    - event: content.BuyNowCanceled
+      handler: content_BuyNowCanceled
+
     # working groups
     ## storage - workers
     - event: storageWorkingGroup.WorkerStorageUpdated

+ 16 - 0
query-node/mappings/common.ts

@@ -4,6 +4,7 @@ import { Network } from 'query-node/dist/model'
 import { BaseModel } from '@joystream/warthog'
 import { metaToObject } from '@joystream/metadata-protobuf/utils'
 import { AnyMetadataClass, DecodedMetadataObject } from '@joystream/metadata-protobuf/types'
+import { Event } from 'query-node/dist/model'
 
 export const CURRENT_NETWORK = Network.GIZA
 /*
@@ -30,6 +31,21 @@ class Logger {
 
 export const logger = new Logger()
 
+
+export function genericEventFields(substrateEvent: SubstrateEvent): Partial<BaseModel & Event> {
+  const { blockNumber, indexInBlock, extrinsic, blockTimestamp } = substrateEvent
+  const eventTime = new Date(blockTimestamp)
+  return {
+    createdAt: eventTime,
+    updatedAt: eventTime,
+    id: `${CURRENT_NETWORK}-${blockNumber}-${indexInBlock}`,
+    inBlock: blockNumber,
+    network: CURRENT_NETWORK,
+    inExtrinsic: extrinsic?.hash,
+    indexInBlock,
+  }
+}
+
 /*
   Reports that insurmountable inconsistent state has been encountered and throws an exception.
 */

+ 40 - 6
query-node/mappings/content/curatorGroup.ts

@@ -1,12 +1,36 @@
 /*
 eslint-disable @typescript-eslint/naming-convention
 */
-import { EventContext, StoreContext } from '@joystream/hydra-common'
+import { DatabaseManager, EventContext, StoreContext } from '@joystream/hydra-common'
 import { FindConditions } from 'typeorm'
-import { CuratorGroup } from 'query-node/dist/model'
+import { Curator, CuratorGroup } from 'query-node/dist/model'
 import { Content } from '../generated/types'
 import { inconsistentState, logger } from '../common'
 
+async function getCurator(store: DatabaseManager, curatorId: string): Promise<Curator | undefined> {
+  const existingCurator = await store.get(Curator, {
+    where: { id: curatorId.toString() } as FindConditions<Curator>,
+  })
+
+  return existingCurator
+}
+
+async function createCurator(store: DatabaseManager, curatorId: string): Promise<Curator> {
+  const curator = new Curator({
+    id: curatorId,
+
+    curatorGroups: [],
+  })
+
+  await store.save<Curator>(curator)
+
+  return curator
+}
+
+async function ensureCurator(store: DatabaseManager, curatorId: string): Promise<Curator> {
+  return await getCurator(store, curatorId) || await createCurator(store, curatorId)
+}
+
 export async function content_CuratorGroupCreated({ store, event }: EventContext & StoreContext): Promise<void> {
   // read event data
   const [curatorGroupId] = new Content.CuratorGroupCreatedEvent(event).params
@@ -15,7 +39,7 @@ export async function content_CuratorGroupCreated({ store, event }: EventContext
   const curatorGroup = new CuratorGroup({
     // main data
     id: curatorGroupId.toString(),
-    curatorIds: [],
+    curators: [],
     isActive: false, // runtime creates inactive curator groups by default
 
     // fill in auto-generated fields
@@ -71,8 +95,11 @@ export async function content_CuratorAdded({ store, event }: EventContext & Stor
     return inconsistentState('Curator add to non-existing curator group requested', curatorGroupId)
   }
 
+  // load curator
+  const curator = await ensureCurator(store, curatorId.toString())
+
   // update curator group
-  curatorGroup.curatorIds.push(curatorId.toNumber())
+  curatorGroup.curators.push(curator)
 
   // set last update time
   curatorGroup.updatedAt = new Date(event.blockTimestamp)
@@ -98,7 +125,14 @@ export async function content_CuratorRemoved({ store, event }: EventContext & St
     return inconsistentState('Non-existing curator group removal requested', curatorGroupId)
   }
 
-  const curatorIndex = curatorGroup.curatorIds.indexOf(curatorId.toNumber())
+  // load curator
+  const curator = await getCurator(store, curatorId.toString())
+
+  if (!curator) {
+    return inconsistentState('Non-existing curator removal from curator group requested', curatorGroupId)
+  }
+
+  const curatorIndex = curatorGroup.curators.findIndex(item => item.id.toString() == curator.toString())
 
   // ensure curator group exists
   if (curatorIndex < 0) {
@@ -106,7 +140,7 @@ export async function content_CuratorRemoved({ store, event }: EventContext & St
   }
 
   // update curator group
-  curatorGroup.curatorIds.splice(curatorIndex, 1)
+  curatorGroup.curators.splice(curatorIndex, 1)
 
   // save curator group
   await store.save<CuratorGroup>(curatorGroup)

+ 229 - 0
query-node/mappings/content/nft.ts

@@ -0,0 +1,229 @@
+import { EventContext, StoreContext, DatabaseManager } from '@joystream/hydra-common'
+import { genericEventFields } from '../common'
+import {
+  AuctionStartedEvent,
+  NftIssuedEvent,
+  AuctionBidMadeEvent,
+  AuctionBidCanceledEvent,
+  AuctionCanceledEvent,
+  EnglishAuctionCompletedEvent,
+  BidMadeCompletingAuctionEvent,
+  OpenAuctionBidAcceptedEvent,
+  OfferStartedEvent,
+  OfferAcceptedEvent,
+  OfferCanceledEvent,
+  NftSellOrderMadeEvent,
+  NftBoughtEvent,
+  BuyNowCanceledEvent,
+} from 'query-node/dist/model'
+import { Content } from '../generated/types'
+
+export async function contentNft_AuctionStarted({ event, store }: EventContext & StoreContext): Promise<void> {
+  // common event processing
+
+  const [ownerId, videoId, auctionParams] = new Content.AuctionStartedEvent(event).params
+
+  const announcingPeriodStartedEvent = new AuctionStartedEvent({
+    ...genericEventFields(event),
+  })
+
+  await store.save<AuctionStartedEvent>(announcingPeriodStartedEvent)
+
+  // specific event processing
+
+}
+
+export async function contentNft_NftIssued({ event, store }: EventContext & StoreContext): Promise<void> {
+  // common event processing
+
+  const [actor, videoId, royalty, metadata, newOwner] = new Content.NftIssuedEvent(event).params
+
+  const announcingPeriodStartedEvent = new NftIssuedEvent({
+    ...genericEventFields(event),
+  })
+
+  await store.save<NftIssuedEvent>(announcingPeriodStartedEvent)
+
+  // specific event processing
+
+}
+
+export async function contentNft_AuctionBidMade({ event, store }: EventContext & StoreContext): Promise<void> {
+  // common event processing
+
+  const [member, video, bidAmount, extendsAuction] = new Content.AuctionBidMadeEvent(event).params
+
+  const announcingPeriodStartedEvent = new AuctionBidMadeEvent({
+    ...genericEventFields(event),
+  })
+
+  await store.save<AuctionBidMadeEvent>(announcingPeriodStartedEvent)
+
+  // specific event processing
+
+}
+
+export async function contentNft_AuctionBidCanceled({ event, store }: EventContext & StoreContext): Promise<void> {
+  // common event processing
+
+  const [member, video] = new Content.AuctionBidCanceledEvent(event).params
+
+  const announcingPeriodStartedEvent = new AuctionBidCanceledEvent({
+    ...genericEventFields(event),
+  })
+
+  await store.save<AuctionBidCanceledEvent>(announcingPeriodStartedEvent)
+
+  // specific event processing
+
+}
+
+export async function contentNft_AuctionCanceled({ event, store }: EventContext & StoreContext): Promise<void> {
+  // common event processing
+
+  const [contentActor, video] = new Content.AuctionCanceledEvent(event).params
+
+  const announcingPeriodStartedEvent = new AuctionCanceledEvent({
+    ...genericEventFields(event),
+  })
+
+  await store.save<AuctionCanceledEvent>(announcingPeriodStartedEvent)
+
+  // specific event processing
+
+}
+
+export async function contentNft_EnglishAuctionCompleted({ event, store }: EventContext & StoreContext): Promise<void> {
+  // common event processing
+
+  const [member, video] = new Content.EnglishAuctionCompletedEvent(event).params
+
+  const announcingPeriodStartedEvent = new EnglishAuctionCompletedEvent({
+    ...genericEventFields(event),
+  })
+
+  await store.save<EnglishAuctionCompletedEvent>(announcingPeriodStartedEvent)
+
+  // specific event processing
+
+}
+
+export async function contentNft_BidMadeCompletingAuction({ event, store }: EventContext & StoreContext): Promise<void> {
+  // common event processing
+
+  const [member, video] = new Content.BidMadeCompletingAuctionEvent(event).params
+
+  const announcingPeriodStartedEvent = new BidMadeCompletingAuctionEvent({
+    ...genericEventFields(event),
+  })
+
+  await store.save<BidMadeCompletingAuctionEvent>(announcingPeriodStartedEvent)
+
+  // specific event processing
+
+}
+
+export async function contentNft_OpenAuctionBidAccepted({ event, store }: EventContext & StoreContext): Promise<void> {
+  // common event processing
+
+  const [contentActor, video] = new Content.OpenAuctionBidAcceptedEvent(event).params
+
+  const announcingPeriodStartedEvent = new OpenAuctionBidAcceptedEvent({
+    ...genericEventFields(event),
+  })
+
+  await store.save<OpenAuctionBidAcceptedEvent>(announcingPeriodStartedEvent)
+
+  // specific event processing
+
+}
+
+export async function contentNft_OfferStarted({ event, store }: EventContext & StoreContext): Promise<void> {
+  // common event processing
+
+  const [video, contentActor, member, price] = new Content.OfferStartedEvent(event).params
+
+  const announcingPeriodStartedEvent = new OfferStartedEvent({
+    ...genericEventFields(event),
+  })
+
+  await store.save<OfferStartedEvent>(announcingPeriodStartedEvent)
+
+  // specific event processing
+
+}
+
+export async function contentNft_OfferAccepted({ event, store }: EventContext & StoreContext): Promise<void> {
+  // common event processing
+
+  const [video] = new Content.OfferAcceptedEvent(event).params
+
+  const announcingPeriodStartedEvent = new OfferAcceptedEvent({
+    ...genericEventFields(event),
+  })
+
+  await store.save<OfferAcceptedEvent>(announcingPeriodStartedEvent)
+
+  // specific event processing
+
+}
+
+export async function contentNft_OfferCanceled({ event, store }: EventContext & StoreContext): Promise<void> {
+  // common event processing
+
+  const [video, contentActor] = new Content.OfferCanceledEvent(event).params
+
+  const announcingPeriodStartedEvent = new OfferCanceledEvent({
+    ...genericEventFields(event),
+  })
+
+  await store.save<OfferCanceledEvent>(announcingPeriodStartedEvent)
+
+  // specific event processing
+
+}
+
+export async function contentNft_NftSellOrderMade({ event, store }: EventContext & StoreContext): Promise<void> {
+  // common event processing
+
+  const [video, contentActor, price] = new Content.NFTSellOrderMadeEvent(event).params
+
+  const announcingPeriodStartedEvent = new NftSellOrderMadeEvent({
+    ...genericEventFields(event),
+  })
+
+  await store.save<NftSellOrderMadeEvent>(announcingPeriodStartedEvent)
+
+  // specific event processing
+
+}
+
+export async function contentNft_NftBought({ event, store }: EventContext & StoreContext): Promise<void> {
+  // common event processing
+
+  const [video, member] = new Content.NFTBoughtEvent(event).params
+
+  const announcingPeriodStartedEvent = new NftBoughtEvent({
+    ...genericEventFields(event),
+  })
+
+  await store.save<NftBoughtEvent>(announcingPeriodStartedEvent)
+
+  // specific event processing
+
+}
+
+export async function contentNft_BuyNowCanceled({ event, store }: EventContext & StoreContext): Promise<void> {
+  // common event processing
+
+  const [video, contentActor] = new Content.BuyNowCanceledEvent(event).params
+
+  const announcingPeriodStartedEvent = new BuyNowCanceledEvent({
+    ...genericEventFields(event),
+  })
+
+  await store.save<BuyNowCanceledEvent>(announcingPeriodStartedEvent)
+
+  // specific event processing
+
+}

+ 18 - 0
query-node/schemas/common.graphql

@@ -4,3 +4,21 @@ enum Network {
   ALEXANDRIA
   ROME
 }
+
+# FIXME: https://github.com/Joystream/hydra/issues/359
+interface Event @entity {
+  "(network}-{blockNumber}-{indexInBlock}"
+  id: ID!
+
+  "Hash of the extrinsic which caused the event to be emitted"
+  inExtrinsic: String
+
+  "Blocknumber of the block in which the event was emitted."
+  inBlock: Int!
+
+  "Network the block was produced in"
+  network: Network!
+
+  "Index of event in block from which it was emitted."
+  indexInBlock: Int!
+}

+ 6 - 3
query-node/schemas/contentNft.graphql

@@ -38,17 +38,20 @@ type CuratorGroup @entity {
   isActive: Boolean!
 
   "Curators belonging to this group"
-  curators: [Curator!]! @derivedFrom(field: "curatorGroup")
+  curators: [Curator!]! @derivedFrom(field: "curatorGroups")
 
   "Channels curated by this group"
   channels: [Channel!]! @derivedFrom(field: "ownerCuratorGroup")
 }
 
 type Curator @entity {
-  #TODO: curator
+  "Runtime identifier"
+  id: ID!
+
+  "Type needs to have at least one non-relation entity. This value is not used."
   dummy: Int
 
-  curatorGroup: CuratorGroup!
+  curatorGroups: [CuratorGroup!]!
 }
 
 "Represents NFT details"

+ 14 - 14
query-node/schemas/contentNftEvents.graphql

@@ -2,7 +2,7 @@
 # remove relations in events and save snapshot representation (immutable)
 # TODO: unite leading dot `.` in property descriptions
 
-type AuctionStartedEvent @entity {
+type AuctionStartedEvent implements Event @entity {
   ### GENERIC DATA ###
 
   "(network}-{blockNumber}-{indexInBlock}"
@@ -32,7 +32,7 @@ type AuctionStartedEvent @entity {
   auction: Auction!
 }
 
-type NftIssuedEvent @entity {
+type NftIssuedEvent implements Event @entity {
   ### GENERIC DATA ###
 
   "(network}-{blockNumber}-{indexInBlock}"
@@ -69,7 +69,7 @@ type NftIssuedEvent @entity {
   newOwner: Membership
 }
 
-type AuctionBidMadeEvent @entity {
+type AuctionBidMadeEvent implements Event @entity {
   ### GENERIC DATA ###
 
   "(network}-{blockNumber}-{indexInBlock}"
@@ -102,7 +102,7 @@ type AuctionBidMadeEvent @entity {
   extendsAuction: Boolean!
 }
 
-type AuctionBidCanceledEvent @entity {
+type AuctionBidCanceledEvent implements Event @entity {
   ### GENERIC DATA ###
 
   "(network}-{blockNumber}-{indexInBlock}"
@@ -129,7 +129,7 @@ type AuctionBidCanceledEvent @entity {
   video: Video!
 }
 
-type AuctionCanceledEvent @entity {
+type AuctionCanceledEvent implements Event @entity {
   ### GENERIC DATA ###
 
   "(network}-{blockNumber}-{indexInBlock}"
@@ -156,7 +156,7 @@ type AuctionCanceledEvent @entity {
   video: Video!
 }
 
-type EnglishAuctionCompletedEvent @entity {
+type EnglishAuctionCompletedEvent implements Event @entity {
   ### GENERIC DATA ###
 
   "(network}-{blockNumber}-{indexInBlock}"
@@ -183,7 +183,7 @@ type EnglishAuctionCompletedEvent @entity {
   video: Video!
 }
 
-type BidMadeCompletingAuctionEvent @entity {
+type BidMadeCompletingAuctionEvent implements Event @entity {
   ### GENERIC DATA ###
 
   "(network}-{blockNumber}-{indexInBlock}"
@@ -210,7 +210,7 @@ type BidMadeCompletingAuctionEvent @entity {
   video: Video!
 }
 
-type OpenAuctionBidAcceptedEvent @entity {
+type OpenAuctionBidAcceptedEvent implements Event @entity {
   ### GENERIC DATA ###
 
   "(network}-{blockNumber}-{indexInBlock}"
@@ -237,7 +237,7 @@ type OpenAuctionBidAcceptedEvent @entity {
   video: Video!
 }
 
-type OfferStartedEvent @entity {
+type OfferStartedEvent implements Event @entity {
   ### GENERIC DATA ###
 
   "(network}-{blockNumber}-{indexInBlock}"
@@ -270,7 +270,7 @@ type OfferStartedEvent @entity {
   price: BigInt
 }
 
-type OfferAcceptedEvent @entity {
+type OfferAcceptedEvent implements Event @entity {
   ### GENERIC DATA ###
 
   "(network}-{blockNumber}-{indexInBlock}"
@@ -294,7 +294,7 @@ type OfferAcceptedEvent @entity {
   video: Video!
 }
 
-type OfferCanceledEvent @entity {
+type OfferCanceledEvent implements Event @entity {
   ### GENERIC DATA ###
 
   "(network}-{blockNumber}-{indexInBlock}"
@@ -321,7 +321,7 @@ type OfferCanceledEvent @entity {
   contentActor: ContentActor!
 }
 
-type NftSellOrderMadeEvent @entity { # NFT in name can't be UPPERCASE because it causes codegen errors
+type NftSellOrderMadeEvent @entity { # NFT in name can't be UPPERCASE because it causes codegenimplements Event  errors
   ### GENERIC DATA ###
 
   "(network}-{blockNumber}-{indexInBlock}"
@@ -351,7 +351,7 @@ type NftSellOrderMadeEvent @entity { # NFT in name can't be UPPERCASE because it
   price: BigInt!
 }
 
-type NftBoughtEvent @entity {
+type NftBoughtEvent implements Event @entity {
   ### GENERIC DATA ###
 
   "(network}-{blockNumber}-{indexInBlock}"
@@ -378,7 +378,7 @@ type NftBoughtEvent @entity {
   member: Membership!
 }
 
-type BuyNowCanceledEvent @entity {
+type BuyNowCanceledEvent implements Event @entity {
   ### GENERIC DATA ###
 
   "(network}-{blockNumber}-{indexInBlock}"

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


File diff suppressed because it is too large
+ 1179 - 53
types/augment-codec/augment-api-errors.ts


+ 57 - 0
types/augment/all/defs.json

@@ -844,5 +844,62 @@
         "current_id": "ChannelId",
         "final_id": "ChannelId"
     },
+    "EnglishAuctionDetails": {
+        "extension_period": "u32",
+        "auction_duration": "u32"
+    },
+    "OpenAuctionDetails": {
+        "bid_lock_duration": "u32"
+    },
+    "AuctionType": {
+        "_enum": {
+            "English": "EnglishAuctionDetails",
+            "Open": "CuratorId"
+        }
+    },
+    "AuctionParams": {
+        "auction_type": "AuctionType",
+        "starting_price": "u128",
+        "minimal_bid_step": "u128",
+        "buy_now_price": "Option<u128>",
+        "starts_at": "Option<u32>",
+        "whitelist": "BTreeSet<MemberId>"
+    },
+    "Royalty": "u32",
+    "Bid": {
+        "bidder": "MemberId",
+        "bidder_account_id": "GenericAccountId",
+        "amount": "u128",
+        "made_at_block": "u32"
+    },
+    "AuctionRecord": {
+        "starting_price": "u128",
+        "buy_now_price": "u128",
+        "auction_type": "AuctionType",
+        "minimal_bid_step": "u128",
+        "last_bid": "Option<Bid>",
+        "starts_at": "Option<u32>",
+        "whitelist": "BTreeSet<MemberId>"
+    },
+    "TransactionalStatus": {
+        "_enum": {
+            "Idle": "Null",
+            "InitiatedOfferToMember": "(MemberId,Option<u128>)",
+            "Auction": "AuctionRecord",
+            "BuyNow": "u128"
+        }
+    },
+    "NFTOwner": {
+        "_enum": {
+            "ChannelOwner": "Null",
+            "Member": "MemberId"
+        }
+    },
+    "OwnedNFT": {
+        "owner": "NFTOwner",
+        "transactional_status": "TransactionalStatus",
+        "creator_royalty": "Option<Royalty>"
+    },
+    "IsExtended": "bool",
     "AccountInfo": "AccountInfoWithRefCount"
 }

+ 155 - 76
types/augment/all/types.ts

@@ -137,6 +137,35 @@ export interface Approved extends Enum {
   readonly asExecutionFailed: ExecutionFailed;
 }
 
+/** @name AuctionParams */
+export interface AuctionParams extends Struct {
+  readonly auction_type: AuctionType;
+  readonly starting_price: u128;
+  readonly minimal_bid_step: u128;
+  readonly buy_now_price: Option<u128>;
+  readonly starts_at: Option<u32>;
+  readonly whitelist: BTreeSet<MemberId>;
+}
+
+/** @name AuctionRecord */
+export interface AuctionRecord extends Struct {
+  readonly starting_price: u128;
+  readonly buy_now_price: u128;
+  readonly auction_type: AuctionType;
+  readonly minimal_bid_step: u128;
+  readonly last_bid: Option<Bid>;
+  readonly starts_at: Option<u32>;
+  readonly whitelist: BTreeSet<MemberId>;
+}
+
+/** @name AuctionType */
+export interface AuctionType extends Enum {
+  readonly isEnglish: boolean;
+  readonly asEnglish: EnglishAuctionDetails;
+  readonly isOpen: boolean;
+  readonly asOpen: CuratorId;
+}
+
 /** @name Backer */
 export interface Backer extends Struct {
   readonly member: GenericAccountId;
@@ -174,6 +203,14 @@ export interface BagIdType extends Enum {
 /** @name BalanceOfMint */
 export interface BalanceOfMint extends u128 {}
 
+/** @name Bid */
+export interface Bid extends Struct {
+  readonly bidder: MemberId;
+  readonly bidder_account_id: GenericAccountId;
+  readonly amount: u128;
+  readonly made_at_block: u32;
+}
+
 /** @name BlockAndTime */
 export interface BlockAndTime extends Struct {
   readonly block: u32;
@@ -198,82 +235,6 @@ export interface Category extends Struct {
 /** @name CategoryId */
 export interface CategoryId extends u64 {}
 
-/** @name Channel */
-export interface Channel extends Struct {
-  readonly owner: ChannelOwner;
-  readonly num_videos: u64;
-  readonly is_censored: bool;
-  readonly reward_account: Option<GenericAccountId>;
-  readonly collaborators: BTreeSet<MemberId>;
-}
-
-/** @name ChannelCategory */
-export interface ChannelCategory extends Struct {}
-
-/** @name ChannelCategoryCreationParameters */
-export interface ChannelCategoryCreationParameters extends Struct {
-  readonly meta: Bytes;
-}
-
-/** @name ChannelCategoryId */
-export interface ChannelCategoryId extends u64 {}
-
-/** @name ChannelCategoryUpdateParameters */
-export interface ChannelCategoryUpdateParameters extends Struct {
-  readonly new_meta: Bytes;
-}
-
-/** @name ChannelCreationParameters */
-export interface ChannelCreationParameters extends Struct {
-  readonly assets: Option<StorageAssets>;
-  readonly meta: Option<Bytes>;
-  readonly reward_account: Option<GenericAccountId>;
-  readonly collaborators: BTreeSet<MemberId>;
-}
-
-/** @name ChannelId */
-export interface ChannelId extends u64 {}
-
-/** @name ChannelMigrationConfig */
-export interface ChannelMigrationConfig extends Struct {
-  readonly current_id: ChannelId;
-  readonly final_id: ChannelId;
-}
-
-/** @name ChannelOwner */
-export interface ChannelOwner extends Enum {
-  readonly isMember: boolean;
-  readonly asMember: MemberId;
-  readonly isCurators: boolean;
-  readonly asCurators: CuratorGroupId;
-}
-
-/** @name ChannelOwnershipTransferRequest */
-export interface ChannelOwnershipTransferRequest extends Struct {
-  readonly channel_id: ChannelId;
-  readonly new_owner: ChannelOwner;
-  readonly payment: u128;
-  readonly new_reward_account: Option<GenericAccountId>;
-}
-
-/** @name ChannelOwnershipTransferRequestId */
-export interface ChannelOwnershipTransferRequestId extends u64 {}
-
-/** @name ChannelUpdateParameters */
-export interface ChannelUpdateParameters extends Struct {
-  readonly assets_to_upload: Option<StorageAssets>;
-  readonly new_meta: Option<Bytes>;
-  readonly reward_account: Option<Option<GenericAccountId>>;
-  readonly assets_to_remove: BTreeSet<DataObjectId>;
-  readonly collaborators: Option<BTreeSet<MemberId>>;
-}
-
-/** @name ChildPositionInParentCategory */
-export interface ChildPositionInParentCategory extends Struct {
-  readonly parent_id: CategoryId;
-  readonly child_nr_in_parent_category: u32;
-}
-
 /** @name Cid */
 export interface Cid extends Bytes {}
 
@@ -467,6 +428,12 @@ export interface ElectionStake extends Struct {
   readonly transferred: u128;
 }
 
+/** @name EnglishAuctionDetails */
+export interface EnglishAuctionDetails extends Struct {
+  readonly extension_period: u32;
+  readonly auction_duration: u32;
+}
+
 /** @name EntryMethod */
 export interface EntryMethod extends Enum {
   readonly isPaid: boolean;
@@ -508,6 +475,82 @@ export interface Finalized extends Struct {
 /** @name HiringApplicationId */
 export interface HiringApplicationId extends u64 {}
 
+/** @name Channel */
+export interface Channel extends Struct {
+  readonly owner: ChannelOwner;
+  readonly num_videos: u64;
+  readonly is_censored: bool;
+  readonly reward_account: Option<GenericAccountId>;
+  readonly collaborators: BTreeSet<MemberId>;
+}
+
+/** @name ChannelCategory */
+export interface ChannelCategory extends Struct {}
+
+/** @name ChannelCategoryCreationParameters */
+export interface ChannelCategoryCreationParameters extends Struct {
+  readonly meta: Bytes;
+}
+
+/** @name ChannelCategoryId */
+export interface ChannelCategoryId extends u64 {}
+
+/** @name ChannelCategoryUpdateParameters */
+export interface ChannelCategoryUpdateParameters extends Struct {
+  readonly new_meta: Bytes;
+}
+
+/** @name ChannelCreationParameters */
+export interface ChannelCreationParameters extends Struct {
+  readonly assets: Option<StorageAssets>;
+  readonly meta: Option<Bytes>;
+  readonly reward_account: Option<GenericAccountId>;
+  readonly collaborators: BTreeSet<MemberId>;
+}
+
+/** @name ChannelId */
+export interface ChannelId extends u64 {}
+
+/** @name ChannelMigrationConfig */
+export interface ChannelMigrationConfig extends Struct {
+  readonly current_id: ChannelId;
+  readonly final_id: ChannelId;
+}
+
+/** @name ChannelOwner */
+export interface ChannelOwner extends Enum {
+  readonly isMember: boolean;
+  readonly asMember: MemberId;
+  readonly isCurators: boolean;
+  readonly asCurators: CuratorGroupId;
+}
+
+/** @name ChannelOwnershipTransferRequest */
+export interface ChannelOwnershipTransferRequest extends Struct {
+  readonly channel_id: ChannelId;
+  readonly new_owner: ChannelOwner;
+  readonly payment: u128;
+  readonly new_reward_account: Option<GenericAccountId>;
+}
+
+/** @name ChannelOwnershipTransferRequestId */
+export interface ChannelOwnershipTransferRequestId extends u64 {}
+
+/** @name ChannelUpdateParameters */
+export interface ChannelUpdateParameters extends Struct {
+  readonly assets_to_upload: Option<StorageAssets>;
+  readonly new_meta: Option<Bytes>;
+  readonly reward_account: Option<Option<GenericAccountId>>;
+  readonly assets_to_remove: BTreeSet<DataObjectId>;
+  readonly collaborators: Option<BTreeSet<MemberId>>;
+}
+
+/** @name ChildPositionInParentCategory */
+export interface ChildPositionInParentCategory extends Struct {
+  readonly parent_id: CategoryId;
+  readonly child_nr_in_parent_category: u32;
+}
+
 /** @name InactiveApplicationStage */
 export interface InactiveApplicationStage extends Struct {
   readonly deactivation_initiated: u32;
@@ -524,6 +567,9 @@ export interface InputValidationLengthConstraint extends Struct {
 /** @name IsCensored */
 export interface IsCensored extends bool {}
 
+/** @name IsExtended */
+export interface IsExtended extends bool {}
+
 /** @name LookupSource */
 export interface LookupSource extends AccountId {}
 
@@ -580,9 +626,21 @@ export interface NextAdjustment extends Struct {
   readonly at_block: u32;
 }
 
+/** @name NFTOwner */
+export interface NFTOwner extends Enum {
+  readonly isChannelOwner: boolean;
+  readonly isMember: boolean;
+  readonly asMember: MemberId;
+}
+
 /** @name ObjectOwner */
 export interface ObjectOwner extends Null {}
 
+/** @name OpenAuctionDetails */
+export interface OpenAuctionDetails extends Struct {
+  readonly bid_lock_duration: u32;
+}
+
 /** @name Opening */
 export interface Opening extends Struct {
   readonly created: u32;
@@ -644,6 +702,13 @@ export interface OpeningType extends Enum {
   readonly isWorker: boolean;
 }
 
+/** @name OwnedNFT */
+export interface OwnedNFT extends Struct {
+  readonly owner: NFTOwner;
+  readonly transactional_status: TransactionalStatus;
+  readonly creator_royalty: Option<Royalty>;
+}
+
 /** @name PaidMembershipTerms */
 export interface PaidMembershipTerms extends Struct {
   readonly fee: u128;
@@ -919,6 +984,9 @@ export interface RoleStakeProfile extends Struct {
   readonly exit_unstaking_period: Option<u32>;
 }
 
+/** @name Royalty */
+export interface Royalty extends u32 {}
+
 /** @name SealedVote */
 export interface SealedVote extends Struct {
   readonly voter: GenericAccountId;
@@ -1121,6 +1189,17 @@ export interface ThreadCounter extends Struct {
 /** @name ThreadId */
 export interface ThreadId extends u64 {}
 
+/** @name TransactionalStatus */
+export interface TransactionalStatus extends Enum {
+  readonly isIdle: boolean;
+  readonly isInitiatedOfferToMember: boolean;
+  readonly asInitiatedOfferToMember: ITuple<[MemberId, Option<u128>]>;
+  readonly isAuction: boolean;
+  readonly asAuction: AuctionRecord;
+  readonly isBuyNow: boolean;
+  readonly asBuyNow: u128;
+}
+
 /** @name TransferableStake */
 export interface TransferableStake extends Struct {
   readonly seat: u128;

File diff suppressed because it is too large
+ 1179 - 53
types/augment/augment-api-errors.ts


+ 76 - 0
types/src/content/index.ts

@@ -182,6 +182,71 @@ export class ChannelMigrationConfig extends JoyStructDecorated({
   final_id: ChannelId,
 }) {}
 
+export class IsExtended extends bool {}
+
+export class EnglishAuctionDetails extends JoyStructDecorated({
+  extension_period: u32, // BlockNumber
+  auction_duration: u32, // BlockNumber
+}) {}
+
+export class OpenAuctionDetails extends JoyStructDecorated({
+  bid_lock_duration: u32, // BlockNumber
+}) {}
+
+export class AuctionType extends JoyEnum({
+  English: EnglishAuctionDetails,
+  Open: CuratorId,
+}) {}
+
+export class AuctionParams extends JoyStructDecorated({
+  auction_type: AuctionType,
+  starting_price: u128, // Balance
+  minimal_bid_step: u128, // Balance
+  buy_now_price: Option.with(u128), // Option<Balance>
+  starts_at: Option.with(u32), // Option<BlockNumber>
+  whitelist: BTreeSet.with(MemberId),
+}) {}
+
+export class Royalty extends u32 {}
+
+export class Bid extends JoyStructDecorated({
+  bidder: MemberId,
+  bidder_account_id: AccountId,
+  amount: u128, // Balance
+  made_at_block: u32, // BlockNumber
+}) {}
+
+export class AuctionRecord extends JoyStructDecorated({
+  starting_price: u128, // Balance
+  buy_now_price: u128, // Balance
+  auction_type: AuctionType,
+  minimal_bid_step: u128, // Balance
+  last_bid: Option.with(Bid),
+  starts_at: Option.with(u32), // Option<BlockNumber>
+  whitelist: BTreeSet.with(MemberId),
+}) {}
+
+export class TransactionalStatus extends JoyEnum({
+  Idle: Null,
+  InitiatedOfferToMember: Tuple.with([
+    MemberId,
+    Option.with(u128) // Option<Balance>
+  ]),
+  Auction: AuctionRecord,
+  BuyNow: u128, // Balance
+}) {}
+
+export class NFTOwner extends JoyEnum({
+  ChannelOwner: Null,
+  Member: MemberId,
+}) {}
+
+export class OwnedNFT extends JoyStructDecorated({
+  owner: NFTOwner,
+  transactional_status: TransactionalStatus,
+  creator_royalty: Option.with(Royalty),
+}) {}
+
 export const contentTypes = {
   CuratorId,
   CuratorGroupId,
@@ -226,6 +291,17 @@ export const contentTypes = {
   IsCensored,
   VideoMigrationConfig,
   ChannelMigrationConfig,
+  EnglishAuctionDetails,
+  OpenAuctionDetails,
+  AuctionType,
+  AuctionParams,
+  Royalty,
+  Bid,
+  AuctionRecord,
+  TransactionalStatus,
+  NFTOwner,
+  OwnedNFT,
+  IsExtended,
 }
 
 export default contentTypes

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