Просмотр исходного кода

Ephesus release (#103)

* Initial commit

* Initial orion draft

* Hide private data

* Fix extendedChannels query

* docker-compose db config adjustments

* Fix ExtendedBasicChannelFields

* Add `video` view

* Storage, Membership and ChannelCreated mappings

* Channel events processing

* Video mappings + some generic fixes

* Mappings: Comments, reactions + some generic fixes

* Cleanup

* NFT mappings, some post-testing fixes

* Video views mutation

* Channel follows + video views improvements

* Channel/video reports

* Category filtering: Part 1

* State subscription

* Category filtering: Part 2 + some refactorization

* Category filtering: Part 3 - add missing views and operator auth

* mostViewedVideosConnection custom query + generic custom queries fixes

* Kill switch

* mostRecentChannels query

* channelNftCollectors query

* extendedVideoCategories query

* Fix AND-OR queries and "eq: null"

* Docker setup improvements

* Video hero

* Category featured videos

* Entity caching (overlay) refactorization

* Prettier

* Documentation, setup improvements, cleanup

* FIX: Save NextEntityIds

* Excludable content

* - Allow limiting the total number of cached entities
- Deployment manifest fixes
- Custom ARCHIVE_GATEWAY_URL instead of HOST/PORT
- Updated dependencies
- `processAssets` bug fix

* setVideoViewPerIpTimeLimit operator mutation

* Ephesus mappings WIP

* Fix conflicts with local Joystream docker setup

* Metadata-protobuf patch location fix

* Ephesus Atlas queries

* Update CHANGELOG

* Linting/formatting fixes, dead code removal

* Apps metaprotocol mappings

* Open auction topBid fix

* Fix metadata-protobuf patch

* Add signAppActionCommitment endpoint

* Tests: Basic data comparison script + bug fixes

* Remove channel-owned apps

* Remove Ephesus scope

* Apps as member-owned initial rework

* Fixes after compareState vs mainnet

* Remove lead-owned apps, fix typeorm-codegen patch

* AppAction support (https://github.com/Joystream/joystream/pull/4631)

* Update CHANGELOG based on tests

* Allow controlling "is_censored" content exclusion via env

* buildExtendedChannelsQuery fix (activeVideosCount_gt: 0)

* Benchmarking script

* Benchmarking results

* Event queries optimalizations, fix gitignored v1 and v2 schemas

* Adjust autovacuum_analyze_scale_factor

* Fix entity cache cleanup

* Add index on event's `inExtrinsic` field

* Benchmarking round 2

* Fix req.ip reverse proxy issue, allow conditionally displaying excluded content in results

* Operator queries

* Update docs

* Prettier format

* Add CI checks

* Remove issue template, fix "workflows" location

* Disallow app deletion

* Update `generateAppActionCommitment` from `@joystream/js`

* Fix channel follows, video views and reports after operator queries

* Fix https://github.com/Joystream/orion/issues/82

* Comment notifications: Don't notify the author about their own comment

* Introduce a mechanism to preserve views, follows, reports and config data when updating the processor

* mostViewedVideosConnection missing params fix

* Fix assets encoding (AppAction)

* Assets url resolving

* Remove accidently commited file

* Fix Aquarium deployment

* Update CHANGELOG

* Improve caching speed and add more logs

* Latest apps-related updated (generateAppActionCommitment, mappings)

* Revert "Remove Ephesus scope"

This reverts commit 92723408691cbd38be1ee614a3aaca815c34bd54.

* Update tests

* Process member banning/unbanning

* Merge latest `orion-v2`

* Update state queries

* Fix: Remove banned members when channel is removed

* Formatting

* Runtime upgrade support

* Fix OpenAuctionBidAccepted event query issue
Leszek Wiesner 1 год назад
Родитель
Сommit
bb107281e0

+ 3 - 3
db/migrations/1679665568053-Data.js → db/migrations/1680280600588-Data.js

@@ -1,5 +1,5 @@
-module.exports = class Data1679665568053 {
-    name = 'Data1679665568053'
+module.exports = class Data1680280600588 {
+    name = 'Data1680280600588'
 
     async up(db) {
         await db.query(`CREATE TABLE "bid" ("id" character varying NOT NULL, "created_at" TIMESTAMP WITH TIME ZONE NOT NULL, "auction_id" character varying, "nft_id" character varying, "bidder_id" character varying, "amount" numeric NOT NULL, "is_canceled" boolean NOT NULL, "created_in_block" integer NOT NULL, "index_in_block" integer NOT NULL, "previous_top_bid_id" character varying, CONSTRAINT "PK_ed405dda320051aca2dcb1a50bb" PRIMARY KEY ("id"))`)
@@ -37,7 +37,7 @@ module.exports = class Data1679665568053 {
         await db.query(`CREATE TABLE "app" ("id" character varying NOT NULL, "name" text NOT NULL, "owner_member_id" character varying, "website_url" text, "use_uri" text, "small_icon" text, "medium_icon" text, "big_icon" text, "one_liner" text, "description" text, "terms_of_service" text, "platforms" text array, "category" text, "auth_key" text, CONSTRAINT "App_name" UNIQUE ("name") DEFERRABLE INITIALLY DEFERRED, CONSTRAINT "PK_9478629fc093d229df09e560aea" PRIMARY KEY ("id"))`)
         await db.query(`CREATE INDEX "IDX_f36adbb7b096ceeb6f3e80ad14" ON "app" ("name") `)
         await db.query(`CREATE INDEX "IDX_c9cc395bbc485f70a15be64553" ON "app" ("owner_member_id") `)
-        await db.query(`CREATE TABLE "channel" ("id" character varying NOT NULL, "created_at" TIMESTAMP WITH TIME ZONE NOT NULL, "owner_member_id" character varying, "title" text, "description" text, "cover_photo_id" character varying, "avatar_photo_id" character varying, "is_public" boolean, "is_censored" boolean NOT NULL, "is_excluded" boolean NOT NULL, "language" text, "created_in_block" integer NOT NULL, "reward_account" text NOT NULL, "channel_state_bloat_bond" numeric NOT NULL, "follows_num" integer NOT NULL, "video_views_num" integer NOT NULL, "entry_app_id" character varying, "total_videos_created" integer NOT NULL, CONSTRAINT "PK_590f33ee6ee7d76437acf362e39" PRIMARY KEY ("id"))`)
+        await db.query(`CREATE TABLE "channel" ("id" character varying NOT NULL, "created_at" TIMESTAMP WITH TIME ZONE NOT NULL, "owner_member_id" character varying, "title" text, "description" text, "cover_photo_id" character varying, "avatar_photo_id" character varying, "is_public" boolean, "is_censored" boolean NOT NULL, "is_excluded" boolean NOT NULL, "language" text, "created_in_block" integer NOT NULL, "reward_account" text NOT NULL, "channel_state_bloat_bond" numeric NOT NULL, "follows_num" integer NOT NULL, "video_views_num" integer NOT NULL, "entry_app_id" character varying, "total_videos_created" integer NOT NULL, "cumulative_reward_claimed" numeric, CONSTRAINT "PK_590f33ee6ee7d76437acf362e39" PRIMARY KEY ("id"))`)
         await db.query(`CREATE INDEX "IDX_25c85bc448b5e236a4c1a5f789" ON "channel" ("owner_member_id") `)
         await db.query(`CREATE INDEX "IDX_a77e12f3d8c6ced020e179a5e9" ON "channel" ("cover_photo_id") `)
         await db.query(`CREATE INDEX "IDX_6997e94413b3f2f25a84e4a96f" ON "channel" ("avatar_photo_id") `)

+ 1 - 0
db/migrations/2000000000000-Views.js

@@ -56,6 +56,7 @@ module.exports = class Views2000000000000 {
         `("data"->>'nft' IS NULL OR EXISTS(SELECT 1 FROM "owned_nft" WHERE "id"="data"->>'nft'))`,
         `("data"->>'auction' IS NULL OR EXISTS(SELECT 1 FROM "auction" WHERE "id"="data"->>'auction'))`,
         `("data"->>'bid' IS NULL OR EXISTS(SELECT 1 FROM "bid" WHERE "id"="data"->>'bid'))`,
+        `("data"->>'winningBid' IS NULL OR EXISTS(SELECT 1 FROM "bid" WHERE "id"="data"->>'winningBid'))`,
         `("data"->>'comment' IS NULL OR EXISTS(SELECT 1 FROM "comment" WHERE "id"="data"->>'comment'))`
       ],
       storage_data_object: [

+ 3 - 0
schema/channels.graphql

@@ -58,6 +58,9 @@ type Channel @entity {
 
   "Number of videos ever created in this channel"
   totalVideosCreated: Int!
+
+  "Cumulative rewards claimed by this channel"
+  cumulativeRewardClaimed: BigInt
 }
 
 type BannedMember @entity @index(fields: ["member", "channel"], unique: true) {

+ 94 - 0
schema/events.graphql

@@ -68,6 +68,11 @@ union EventData =
   | BuyNowCanceledEventData
   | BuyNowPriceUpdatedEventData
   | MetaprotocolTransactionStatusEventData
+  | ChannelRewardClaimedEventData
+  | ChannelRewardClaimedAndWithdrawnEventData
+  | ChannelFundsWithdrawnEventData
+  | ChannelPayoutsUpdatedEventData
+  | ChannelPaymentMadeEventData
   | MemberBannedFromChannelEventData
 
 # Atlas use-case: `GetCommentEdits` query
@@ -262,6 +267,10 @@ type MetaprotocolTransactionResultCommentModerated {
   commentModerated: Comment
 }
 
+type MetaprotocolTransactionResultChannelPaid {
+  channelPaid: Channel
+}
+
 type MetaprotocolTransactionResultOK {
   phantom: Int
 }
@@ -277,12 +286,97 @@ union MetaprotocolTransactionResult =
   | MetaprotocolTransactionResultCommentDeleted
   | MetaprotocolTransactionResultCommentModerated
   | MetaprotocolTransactionResultFailed
+  | MetaprotocolTransactionResultChannelPaid
 
 type MetaprotocolTransactionStatusEventData {
   "The result of metaprotocol action"
   result: MetaprotocolTransactionResult!
 }
 
+type ChannelRewardClaimedEventData {
+  "The channel that claimed the reward"
+  channel: Channel!
+
+  "Reward amount claimed"
+  amount: BigInt!
+}
+
+type ChannelRewardClaimedAndWithdrawnEventData {
+  "The channel that claimed the reward"
+  channel: Channel!
+
+  "Reward amount claimed"
+  amount: BigInt!
+
+  "Destination account ID. Null if claimed by curators' channel (paid to council budget in this case)"
+  account: String
+
+  "Content actor"
+  actor: ContentActor!
+}
+
+type ChannelFundsWithdrawnEventData {
+  "The channel that claimed the reward"
+  channel: Channel!
+
+  "Reward amount claimed"
+  amount: BigInt!
+
+  "Destination account ID. Null if claimed by curators' channel (paid to council budget in this case)"
+  account: String
+
+  "Content actor"
+  actor: ContentActor!
+}
+
+type ChannelPayoutsUpdatedEventData {
+  "Merkle root of the channel payouts"
+  commitment: String
+
+  "Storage data object corresponding to the channel payouts payload"
+  payloadDataObject: StorageDataObject
+
+  "Minimum amount of channel reward cashout allowed at a time"
+  minCashoutAllowed: BigInt
+
+  "Maximum amount of channel reward cashout allowed at a time"
+  maxCashoutAllowed: BigInt
+
+  "Can channel cashout the rewards"
+  channelCashoutsEnabled: Boolean
+}
+
+type PaymentContextVideo {
+  "Video for which the payment was made"
+  video: Video!
+}
+
+type PaymentContextChannel {
+  "Channel for which the payment was made"
+  channel: Channel!
+}
+
+"Various Channel Payment Contexts"
+union PaymentContext = PaymentContextVideo | PaymentContextChannel
+
+"Direct channel payment by any member by-passing the council payouts"
+type ChannelPaymentMadeEventData {
+  "Actor that made the payment"
+  payer: Membership!
+
+  "Amount of the payment"
+  amount: BigInt!
+
+  "Payment and payee context"
+  paymentContext: PaymentContext
+
+  "Channel that received the payment (if any)"
+  payeeChannel: Channel
+
+  "Reason of the payment"
+  rationale: String
+}
+
 # This event is emitted both when a member is banned and when they are unbanned
 type MemberBannedFromChannelEventData {
   "The chanel the member is being banned / unbanned from"

+ 5 - 0
schema/storage.graphql

@@ -196,12 +196,17 @@ type DataObjectTypeVideoSubtitle {
   video: Video!
 }
 
+type DataObjectTypeChannelPayoutsPayload {
+  phantom: Int
+}
+
 union DataObjectType =
     DataObjectTypeChannelAvatar
   | DataObjectTypeChannelCoverPhoto
   | DataObjectTypeVideoMedia
   | DataObjectTypeVideoThumbnail
   | DataObjectTypeVideoSubtitle
+  | DataObjectTypeChannelPayoutsPayload
 
 type StorageDataObject @entity {
   "Data object runtime id"

+ 113 - 1
src/mappings/content/channel.ts

@@ -5,6 +5,12 @@ import {
   Membership,
   MetaprotocolTransactionResultFailed,
   MetaprotocolTransactionStatusEventData,
+  StorageDataObject,
+  DataObjectTypeChannelPayoutsPayload,
+  ChannelPayoutsUpdatedEventData,
+  ChannelRewardClaimedEventData,
+  ChannelRewardClaimedAndWithdrawnEventData,
+  ChannelFundsWithdrawnEventData,
 } from '../../model'
 import { deserializeMetadata, genericEventFields, toAddress, u8aToBytes } from '../utils'
 import {
@@ -16,7 +22,7 @@ import {
 } from '@joystream/metadata-protobuf'
 import { processChannelMetadata, processModeratorRemark, processOwnerRemark } from './metadata'
 import { EventHandlerContext } from '../../utils/events'
-import { processAppActionMetadata, deleteChannel, encodeAssets } from './utils'
+import { processAppActionMetadata, deleteChannel, encodeAssets, parseContentActor } from './utils'
 import { Flat } from '../../utils/overlay'
 import { DecodedMetadataObject } from '@joystream/metadata-protobuf/types'
 import { generateAppActionCommitment } from '@joystream/js/utils'
@@ -207,3 +213,109 @@ export async function processChannelAgentRemarkedEvent({
     }),
   })
 }
+
+export async function processChannelPayoutsUpdatedEvent({
+  overlay,
+  block,
+  indexInBlock,
+  extrinsicHash,
+  event: {
+    // Was impossible to emit before v2001
+    asV2001: [updateChannelPayoutParameters, dataObjectId],
+  },
+}: EventHandlerContext<'Content.ChannelPayoutsUpdated'>): Promise<void> {
+  const payloadDataObject =
+    dataObjectId !== undefined
+      ? await overlay.getRepository(StorageDataObject).getByIdOrFail(dataObjectId.toString())
+      : undefined
+
+  if (payloadDataObject) {
+    payloadDataObject.type = new DataObjectTypeChannelPayoutsPayload()
+  }
+
+  const { minCashoutAllowed, maxCashoutAllowed, channelCashoutsEnabled, commitment } =
+    updateChannelPayoutParameters
+
+  overlay.getRepository(Event).new({
+    ...genericEventFields(overlay, block, indexInBlock, extrinsicHash),
+    data: new ChannelPayoutsUpdatedEventData({
+      commitment: commitment && `0x${Buffer.from(commitment).toString('hex')}`,
+      minCashoutAllowed,
+      maxCashoutAllowed,
+      channelCashoutsEnabled,
+      payloadDataObject: payloadDataObject?.id,
+    }),
+  })
+}
+
+export async function processChannelRewardUpdatedEvent({
+  overlay,
+  block,
+  indexInBlock,
+  extrinsicHash,
+  event: {
+    // Was impossible to emit before v2001
+    asV2001: [, claimedAmount, channelId],
+  },
+}: EventHandlerContext<'Content.ChannelRewardUpdated'>): Promise<void> {
+  // load channel
+  const channel = await overlay.getRepository(Channel).getByIdOrFail(channelId.toString())
+
+  overlay.getRepository(Event).new({
+    ...genericEventFields(overlay, block, indexInBlock, extrinsicHash),
+    data: new ChannelRewardClaimedEventData({
+      amount: claimedAmount,
+      channel: channel.id,
+    }),
+  })
+
+  channel.cumulativeRewardClaimed = (channel.cumulativeRewardClaimed || 0n) + claimedAmount
+}
+
+export async function processChannelRewardClaimedAndWithdrawnEvent({
+  overlay,
+  block,
+  indexInBlock,
+  extrinsicHash,
+  event: {
+    asV1000: [actor, channelId, claimedAmount, destination],
+  },
+}: EventHandlerContext<'Content.ChannelRewardClaimedAndWithdrawn'>): Promise<void> {
+  // load channel
+  const channel = await overlay.getRepository(Channel).getByIdOrFail(channelId.toString())
+
+  overlay.getRepository(Event).new({
+    ...genericEventFields(overlay, block, indexInBlock, extrinsicHash),
+    data: new ChannelRewardClaimedAndWithdrawnEventData({
+      amount: claimedAmount,
+      channel: channel.id,
+      account: destination.__kind === 'AccountId' ? toAddress(destination.value) : undefined,
+      actor: parseContentActor(actor),
+    }),
+  })
+
+  channel.cumulativeRewardClaimed = (channel.cumulativeRewardClaimed || 0n) + claimedAmount
+}
+
+export async function processChannelFundsWithdrawnEvent({
+  overlay,
+  block,
+  indexInBlock,
+  extrinsicHash,
+  event: {
+    asV1000: [actor, channelId, amount, destination],
+  },
+}: EventHandlerContext<'Content.ChannelFundsWithdrawn'>): Promise<void> {
+  // load channel
+  const channel = await overlay.getRepository(Channel).getByIdOrFail(channelId.toString())
+
+  overlay.getRepository(Event).new({
+    ...genericEventFields(overlay, block, indexInBlock, extrinsicHash),
+    data: new ChannelFundsWithdrawnEventData({
+      amount,
+      channel: channel.id,
+      account: destination.__kind === 'AccountId' ? toAddress(destination.value) : undefined,
+      actor: parseContentActor(actor),
+    }),
+  })
+}

+ 63 - 0
src/mappings/content/metadata.ts

@@ -6,6 +6,7 @@ import {
   IChannelModeratorRemarked,
   IChannelOwnerRemarked,
   ILicense,
+  IMakeChannelPayment,
   IMediaType,
   IModerateComment,
   IPinOrUnpinComment,
@@ -13,6 +14,7 @@ import {
   ISubtitleMetadata,
   IVideoMetadata,
   IVideoReactionsPreference,
+  MakeChannelPayment,
   ModerateComment,
   PinOrUnpinComment,
   PublishedBeforeJoystream,
@@ -33,13 +35,18 @@ import { assertNotNull, SubstrateBlock } from '@subsquid/substrate-processor'
 import {
   BannedMember,
   Channel,
+  ChannelPaymentMadeEventData,
   Comment,
   CommentStatus,
   License,
   MetaprotocolTransactionResult,
+  MetaprotocolTransactionResultChannelPaid,
   MetaprotocolTransactionResultCommentModerated,
   MetaprotocolTransactionResultFailed,
   MetaprotocolTransactionResultOK,
+  PaymentContext,
+  PaymentContextChannel,
+  PaymentContextVideo,
   StorageDataObject,
   Video,
   VideoCategory,
@@ -586,3 +593,59 @@ export async function processModeratorRemark(
     { decodedMessage }
   )
 }
+
+export async function processChannelPaymentFromMember(
+  overlay: EntityManagerOverlay,
+  block: SubstrateBlock,
+  indexInBlock: number,
+  txHash: string | undefined,
+  message: DecodedMetadataObject<IMakeChannelPayment>,
+  memberId: string,
+  [payeeAccount, amount]: [string, bigint]
+): Promise<MetaprotocolTransactionResult> {
+  const member = await overlay.getRepository(Membership).getByIdOrFail(memberId)
+
+  // Only channel reward accounts are being checked right now as payment destination.
+  // Transfers to any other destination will be ignored by the query node.
+  const channel = await overlay.getRepository(Channel).getOneBy({ rewardAccount: payeeAccount })
+
+  if (!channel) {
+    return metaprotocolTransactionFailure(
+      MakeChannelPayment,
+      `Payment made to unknown channel reward account: ${payeeAccount}`,
+      { payeeAccount }
+    )
+  }
+
+  let paymentContext: PaymentContext | undefined
+  if (message.videoId) {
+    const video = await overlay.getRepository(Video).getById(message.videoId.toString())
+    if (video && video.channelId === channel.id) {
+      paymentContext = new PaymentContextVideo({ video: video.id })
+    } else {
+      invalidMetadata(
+        MakeChannelPayment,
+        `payment context video not found in channel that was queried based on reward (or payee) account.`,
+        { channelId: channel.id, videoChannelId: video?.channelId }
+      )
+    }
+  } else {
+    paymentContext = new PaymentContextChannel()
+    paymentContext.channel = channel.id
+  }
+
+  overlay.getRepository(Event).new({
+    ...genericEventFields(overlay, block, indexInBlock, txHash),
+    data: new ChannelPaymentMadeEventData({
+      payer: member.id,
+      payeeChannel: channel.id,
+      paymentContext,
+      rationale: message.rationale || undefined,
+      amount,
+    }),
+  })
+
+  return new MetaprotocolTransactionResultChannelPaid({
+    channelPaid: channel.id,
+  })
+}

+ 6 - 7
src/mappings/membership/index.ts

@@ -12,15 +12,14 @@ import { processMembershipMetadata, processMemberRemark } from './metadata'
 export async function processNewMember({
   overlay,
   block,
-  event: {
-    asV1000: [memberId, params],
-  },
+  event,
 }: EventHandlerContext<
   | 'Members.MemberCreated'
   | 'Members.MemberInvited'
   | 'Members.MembershipBought'
   | 'Members.MembershipGifted'
 >) {
+  const [memberId, params] = 'isV2001' in event && event.isV2001 ? event.asV2001 : event.asV1000
   const { controllerAccount, handle, metadata: metadataBytes } = params
   const metadata = deserializeMetadata(MembershipMetadata, metadataBytes)
 
@@ -74,10 +73,9 @@ export async function processMemberRemarkedEvent({
   block,
   indexInBlock,
   extrinsicHash,
-  event: {
-    asV1000: [memberId, message],
-  },
+  event,
 }: EventHandlerContext<'Members.MemberRemarked'>) {
+  const [memberId, message, payment] = event.isV2001 ? event.asV2001 : event.asV1000
   const metadata = deserializeMetadata(MemberRemarked, message)
   const result = metadata
     ? await processMemberRemark(
@@ -86,7 +84,8 @@ export async function processMemberRemarkedEvent({
         indexInBlock,
         extrinsicHash,
         memberId.toString(),
-        metadata
+        metadata,
+        payment && [toAddress(payment[0]), payment[1]]
       )
     : new MetaprotocolTransactionResultFailed({
         errorMessage: 'Could not decode the metadata',

+ 25 - 1
src/mappings/membership/metadata.ts

@@ -14,6 +14,7 @@ import {
 } from '../content/commentsAndReactions'
 import { SubstrateBlock } from '@subsquid/substrate-processor'
 import { processCreateAppMessage, processUpdateAppMessage } from '../content/app'
+import { processChannelPaymentFromMember } from '../content/metadata'
 
 export async function processMembershipMetadata(
   overlay: EntityManagerOverlay,
@@ -48,7 +49,8 @@ export async function processMemberRemark(
   indexInBlock: number,
   txHash: string | undefined,
   memberId: string,
-  decodedMessage: DecodedMetadataObject<IMemberRemarked>
+  decodedMessage: DecodedMetadataObject<IMemberRemarked>,
+  payment?: [string, bigint]
 ): Promise<MetaprotocolTransactionResult> {
   if (decodedMessage.createApp) {
     return processCreateAppMessage(
@@ -98,6 +100,28 @@ export async function processMemberRemark(
     return processDeleteCommentMessage(overlay, memberId, decodedMessage.deleteComment)
   }
 
+  // Though the payments can be sent along with any arbitrary metadata message type,
+  // however they will only be processed if the message type is 'makeChannelPayment'
+  if (decodedMessage.makeChannelPayment) {
+    if (!payment) {
+      return metaprotocolTransactionFailure(
+        MemberRemarked,
+        `payment info should be set when sending remark with 'makeChannelPayment' message type`,
+        { decodedMessage }
+      )
+    }
+
+    return processChannelPaymentFromMember(
+      overlay,
+      block,
+      indexInBlock,
+      txHash,
+      decodedMessage.makeChannelPayment,
+      memberId,
+      payment
+    )
+  }
+
   if (decodedMessage.createVideoCategory) {
     return processCreateVideoCategoryMessage(
       overlay,

+ 12 - 0
src/processor.ts

@@ -47,6 +47,10 @@ import {
   processChannelVisibilitySetByModeratorEvent,
   processChannelOwnerRemarkedEvent,
   processChannelAgentRemarkedEvent,
+  processChannelPayoutsUpdatedEvent,
+  processChannelRewardUpdatedEvent,
+  processChannelFundsWithdrawnEvent,
+  processChannelRewardClaimedAndWithdrawnEvent,
 } from './mappings/content/channel'
 import {
   processVideoCreatedEvent,
@@ -133,6 +137,10 @@ const processor = new SubstrateBatchProcessor()
   .addEvent('Content.BuyNowCanceled', defaultEventOptions)
   .addEvent('Content.BuyNowPriceUpdated', defaultEventOptions)
   .addEvent('Content.NftSlingedBackToTheOriginalArtist', defaultEventOptions)
+  .addEvent('Content.ChannelPayoutsUpdated', defaultEventOptions)
+  .addEvent('Content.ChannelRewardUpdated', defaultEventOptions)
+  .addEvent('Content.ChannelFundsWithdrawn', defaultEventOptions)
+  .addEvent('Content.ChannelRewardClaimedAndWithdrawn', defaultEventOptions)
   .addEvent('Storage.StorageBucketCreated', defaultEventOptions)
   .addEvent('Storage.StorageBucketInvitationAccepted', defaultEventOptions)
   .addEvent('Storage.StorageBucketsUpdatedForBag', defaultEventOptions)
@@ -207,6 +215,10 @@ const eventHandlers: { [E in EventNames]: EventHandler<E> } = {
   'Content.BuyNowCanceled': processBuyNowCanceledEvent,
   'Content.BuyNowPriceUpdated': processBuyNowPriceUpdatedEvent,
   'Content.NftSlingedBackToTheOriginalArtist': processNftSlingedBackToTheOriginalArtistEvent,
+  'Content.ChannelPayoutsUpdated': processChannelPayoutsUpdatedEvent,
+  'Content.ChannelRewardUpdated': processChannelRewardUpdatedEvent,
+  'Content.ChannelFundsWithdrawn': processChannelFundsWithdrawnEvent,
+  'Content.ChannelRewardClaimedAndWithdrawn': processChannelRewardClaimedAndWithdrawnEvent,
   'Storage.StorageBucketCreated': processStorageBucketCreatedEvent,
   'Storage.StorageBucketInvitationAccepted': processStorageBucketInvitationAcceptedEvent,
   'Storage.StorageBucketsUpdatedForBag': processStorageBucketsUpdatedForBagEvent,

+ 175 - 0
src/tests/v1/generated/queries.ts

@@ -347,6 +347,7 @@ export type StorageDataObjectFieldsFragment = {
   type:
     | { __typename: 'DataObjectTypeChannelAvatar' }
     | { __typename: 'DataObjectTypeChannelCoverPhoto' }
+    | { __typename: 'DataObjectTypeChannelPayoutsPayload' }
     | { __typename: 'DataObjectTypeUnknown' }
     | { __typename: 'DataObjectTypeVideoMedia' }
     | { __typename: 'DataObjectTypeVideoSubtitle' }
@@ -1237,6 +1238,7 @@ export type StateQueryV1Query = {
     createdInBlock: number
     rewardAccount: string
     channelStateBloatBond: string
+    cumulativeRewardClaimed?: Types.Maybe<string>
     totalVideosCreated: number
     ownerMember?: Types.Maybe<{ id: string }>
     coverPhoto?: Types.Maybe<{ id: string }>
@@ -1456,6 +1458,80 @@ export type StateQueryV1Query = {
           videoCategoryDeleted?: Types.Maybe<{ id: string }>
         }
   }>
+  channelRewardClaimedEvents: Array<{
+    id: string
+    inBlock: number
+    inExtrinsic?: Types.Maybe<string>
+    indexInBlock: number
+    createdAt: any
+    amount: string
+    channel: { id: string }
+  }>
+  channelRewardClaimedAndWithdrawnEvents: Array<{
+    id: string
+    inBlock: number
+    inExtrinsic?: Types.Maybe<string>
+    indexInBlock: number
+    createdAt: any
+    amount: string
+    account?: Types.Maybe<string>
+    channel: { id: string }
+    actor:
+      | ActorFields_ContentActorCurator_Fragment
+      | ActorFields_ContentActorLead_Fragment
+      | ActorFields_ContentActorMember_Fragment
+  }>
+  channelFundsWithdrawnEvents: Array<{
+    id: string
+    inBlock: number
+    inExtrinsic?: Types.Maybe<string>
+    indexInBlock: number
+    createdAt: any
+    amount: string
+    account?: Types.Maybe<string>
+    channel: { id: string }
+    actor:
+      | ActorFields_ContentActorCurator_Fragment
+      | ActorFields_ContentActorLead_Fragment
+      | ActorFields_ContentActorMember_Fragment
+  }>
+  channelPayoutsUpdatedEvents: Array<{
+    id: string
+    inBlock: number
+    inExtrinsic?: Types.Maybe<string>
+    indexInBlock: number
+    createdAt: any
+    commitment?: Types.Maybe<string>
+    minCashoutAllowed?: Types.Maybe<string>
+    maxCashoutAllowed?: Types.Maybe<string>
+    channelCashoutsEnabled?: Types.Maybe<boolean>
+    payloadDataObject?: Types.Maybe<{ id: string }>
+  }>
+  channelPaymentMadeEvents: Array<{
+    id: string
+    inBlock: number
+    inExtrinsic?: Types.Maybe<string>
+    indexInBlock: number
+    createdAt: any
+    amount: string
+    rationale?: Types.Maybe<string>
+    payer: { id: string }
+    payeeChannel?: Types.Maybe<{ id: string }>
+    paymentContext?: Types.Maybe<
+      | { __typename: 'PaymentContextChannel'; channel?: Types.Maybe<{ id: string }> }
+      | { __typename: 'PaymentContextVideo'; video?: Types.Maybe<{ id: string }> }
+    >
+  }>
+  memberBannedFromChannelEvents: Array<{
+    id: string
+    inBlock: number
+    inExtrinsic?: Types.Maybe<string>
+    indexInBlock: number
+    createdAt: any
+    action: boolean
+    channel: { id: string }
+    member: { id: string }
+  }>
   memberships: Array<{
     id: string
     createdAt: any
@@ -1555,6 +1631,7 @@ export type StateQueryV1Query = {
     type:
       | { __typename: 'DataObjectTypeChannelAvatar'; channel?: Types.Maybe<{ id: string }> }
       | { __typename: 'DataObjectTypeChannelCoverPhoto'; channel?: Types.Maybe<{ id: string }> }
+      | { __typename: 'DataObjectTypeChannelPayoutsPayload' }
       | { __typename: 'DataObjectTypeUnknown' }
       | { __typename: 'DataObjectTypeVideoMedia'; video?: Types.Maybe<{ id: string }> }
       | {
@@ -3577,6 +3654,7 @@ export const StateQueryV1 = gql`
       bannedMembers {
         id
       }
+      cumulativeRewardClaimed
       entryApp {
         id
       }
@@ -3897,6 +3975,103 @@ export const StateQueryV1 = gql`
         }
       }
     }
+    channelRewardClaimedEvents(limit: 9999) {
+      id
+      inBlock
+      inExtrinsic
+      indexInBlock
+      createdAt
+      channel {
+        id
+      }
+      amount
+    }
+    channelRewardClaimedAndWithdrawnEvents(limit: 9999) {
+      id
+      inBlock
+      inExtrinsic
+      indexInBlock
+      createdAt
+      channel {
+        id
+      }
+      amount
+      account
+      actor {
+        ...ActorFields
+      }
+    }
+    channelFundsWithdrawnEvents(limit: 9999) {
+      id
+      inBlock
+      inExtrinsic
+      indexInBlock
+      createdAt
+      channel {
+        id
+      }
+      amount
+      account
+      actor {
+        ...ActorFields
+      }
+    }
+    channelPayoutsUpdatedEvents(limit: 9999) {
+      id
+      inBlock
+      inExtrinsic
+      indexInBlock
+      createdAt
+      commitment
+      payloadDataObject {
+        id
+      }
+      minCashoutAllowed
+      maxCashoutAllowed
+      channelCashoutsEnabled
+    }
+    channelPaymentMadeEvents(limit: 9999) {
+      id
+      inBlock
+      inExtrinsic
+      indexInBlock
+      createdAt
+      payer {
+        id
+      }
+      amount
+      payeeChannel {
+        id
+      }
+      paymentContext {
+        __typename
+        ... on PaymentContextVideo {
+          video {
+            id
+          }
+        }
+        ... on PaymentContextChannel {
+          channel {
+            id
+          }
+        }
+      }
+      rationale
+    }
+    memberBannedFromChannelEvents(limit: 9999) {
+      id
+      inBlock
+      inExtrinsic
+      indexInBlock
+      createdAt
+      channel {
+        id
+      }
+      member {
+        id
+      }
+      action
+    }
     memberships(limit: 9999) {
       id
       createdAt

Разница между файлами не показана из-за своего большого размера
+ 932 - 17
src/tests/v1/generated/schema.ts


+ 98 - 0
src/tests/v1/queries/stateQuery.graphql

@@ -94,6 +94,7 @@ query StateQueryV1 {
     bannedMembers {
       id
     }
+    cumulativeRewardClaimed
     entryApp {
       id
     }
@@ -414,6 +415,103 @@ query StateQueryV1 {
       }
     }
   }
+  channelRewardClaimedEvents(limit: 9999) {
+    id
+    inBlock
+    inExtrinsic
+    indexInBlock
+    createdAt
+    channel {
+      id
+    }
+    amount
+  }
+  channelRewardClaimedAndWithdrawnEvents(limit: 9999) {
+    id
+    inBlock
+    inExtrinsic
+    indexInBlock
+    createdAt
+    channel {
+      id
+    }
+    amount
+    account
+    actor {
+      ...ActorFields
+    }
+  }
+  channelFundsWithdrawnEvents(limit: 9999) {
+    id
+    inBlock
+    inExtrinsic
+    indexInBlock
+    createdAt
+    channel {
+      id
+    }
+    amount
+    account
+    actor {
+      ...ActorFields
+    }
+  }
+  channelPayoutsUpdatedEvents(limit: 9999) {
+    id
+    inBlock
+    inExtrinsic
+    indexInBlock
+    createdAt
+    commitment
+    payloadDataObject {
+      id
+    }
+    minCashoutAllowed
+    maxCashoutAllowed
+    channelCashoutsEnabled
+  }
+  channelPaymentMadeEvents(limit: 9999) {
+    id
+    inBlock
+    inExtrinsic
+    indexInBlock
+    createdAt
+    payer {
+      id
+    }
+    amount
+    payeeChannel {
+      id
+    }
+    paymentContext {
+      __typename
+      ... on PaymentContextVideo {
+        video {
+          id
+        }
+      }
+      ... on PaymentContextChannel {
+        channel {
+          id
+        }
+      }
+    }
+    rationale
+  }
+  memberBannedFromChannelEvents(limit: 9999) {
+    id
+    inBlock
+    inExtrinsic
+    indexInBlock
+    createdAt
+    channel {
+      id
+    }
+    member {
+      id
+    }
+    action
+  }
   memberships(limit: 9999) {
     id
     createdAt

Разница между файлами не показана из-за своего большого размера
+ 838 - 62
src/tests/v1/schema.graphql


+ 299 - 0
src/tests/v2/generated/queries.ts

@@ -127,6 +127,16 @@ export type GetChannelNftCollectorsQuery = {
   channelNftCollectors: Array<{ amount: number; member: BasicMembershipFieldsFragment }>
 }
 
+export type GetPayloadDataObjectIdByCommitmentQueryVariables = Types.Exact<{
+  commitment: Types.Scalars['String']
+}>
+
+export type GetPayloadDataObjectIdByCommitmentQuery = {
+  events: Array<{
+    data: { payloadDataObject?: Types.Maybe<{ id: string; storageBag: { id: string } }> }
+  }>
+}
+
 export type ReportChannelMutationVariables = Types.Exact<{
   channelId: Types.Scalars['String']
   rationale: Types.Scalars['String']
@@ -134,6 +144,41 @@ export type ReportChannelMutationVariables = Types.Exact<{
 
 export type ReportChannelMutation = { reportChannel: { id: string; channelId: string } }
 
+export type GetChannelPaymentEventsQueryVariables = Types.Exact<{
+  ownerMemberId: Types.Scalars['String']
+  channelId: Types.Scalars['String']
+}>
+
+export type GetChannelPaymentEventsQuery = {
+  events: Array<{
+    inBlock: number
+    timestamp: any
+    data:
+      | { __typename: 'AuctionBidCanceledEventData' }
+      | { __typename: 'AuctionBidMadeEventData' }
+      | { __typename: 'AuctionCanceledEventData' }
+      | { __typename: 'BidMadeCompletingAuctionEventData'; winningBid: { amount: string } }
+      | { __typename: 'BuyNowCanceledEventData' }
+      | { __typename: 'BuyNowPriceUpdatedEventData' }
+      | { __typename: 'ChannelFundsWithdrawnEventData' }
+      | { __typename: 'ChannelPaymentMadeEventData' }
+      | { __typename: 'ChannelPayoutsUpdatedEventData' }
+      | { __typename: 'ChannelRewardClaimedAndWithdrawnEventData' }
+      | { __typename: 'ChannelRewardClaimedEventData' }
+      | { __typename: 'CommentCreatedEventData' }
+      | { __typename: 'CommentTextUpdatedEventData' }
+      | { __typename: 'EnglishAuctionSettledEventData'; winningBid: { amount: string } }
+      | { __typename: 'EnglishAuctionStartedEventData' }
+      | { __typename: 'MemberBannedFromChannelEventData' }
+      | { __typename: 'MetaprotocolTransactionStatusEventData' }
+      | { __typename: 'NftBoughtEventData'; price: string }
+      | { __typename: 'NftIssuedEventData' }
+      | { __typename: 'NftSellOrderMadeEventData' }
+      | { __typename: 'OpenAuctionBidAcceptedEventData'; winningBid: { amount: string } }
+      | { __typename: 'OpenAuctionStartedEventData' }
+  }>
+}
+
 export type GetCommentQueryVariables = Types.Exact<{
   commentId: Types.Scalars['String']
 }>
@@ -251,6 +296,7 @@ export type FullChannelFieldsFragment = {
   description?: Types.Maybe<string>
   isPublic?: Types.Maybe<boolean>
   isCensored: boolean
+  cumulativeRewardClaimed?: Types.Maybe<string>
   language?: Types.Maybe<string>
   ownerMember?: Types.Maybe<BasicMembershipFieldsFragment>
   coverPhoto?: Types.Maybe<StorageDataObjectFieldsFragment>
@@ -296,6 +342,7 @@ export type StorageDataObjectFieldsFragment = {
   type?: Types.Maybe<
     | { __typename: 'DataObjectTypeChannelAvatar' }
     | { __typename: 'DataObjectTypeChannelCoverPhoto' }
+    | { __typename: 'DataObjectTypeChannelPayoutsPayload' }
     | { __typename: 'DataObjectTypeVideoMedia' }
     | { __typename: 'DataObjectTypeVideoSubtitle' }
     | { __typename: 'DataObjectTypeVideoThumbnail' }
@@ -452,6 +499,10 @@ export type CommentFieldsFragment = {
   parentComment?: Types.Maybe<{ id: string }>
 }
 
+type MetaprotocolTransactionResultFields_MetaprotocolTransactionResultChannelPaid_Fragment = {
+  __typename: 'MetaprotocolTransactionResultChannelPaid'
+}
+
 type MetaprotocolTransactionResultFields_MetaprotocolTransactionResultCommentCreated_Fragment = {
   __typename: 'MetaprotocolTransactionResultCommentCreated'
   commentCreated?: Types.Maybe<CommentFieldsFragment>
@@ -482,6 +533,7 @@ type MetaprotocolTransactionResultFields_MetaprotocolTransactionResultOk_Fragmen
 }
 
 export type MetaprotocolTransactionResultFieldsFragment =
+  | MetaprotocolTransactionResultFields_MetaprotocolTransactionResultChannelPaid_Fragment
   | MetaprotocolTransactionResultFields_MetaprotocolTransactionResultCommentCreated_Fragment
   | MetaprotocolTransactionResultFields_MetaprotocolTransactionResultCommentDeleted_Fragment
   | MetaprotocolTransactionResultFields_MetaprotocolTransactionResultCommentEdited_Fragment
@@ -932,6 +984,7 @@ export type GetMetaprotocolTransactionStatusEventsQuery = {
     inBlock: number
     data: {
       result:
+        | MetaprotocolTransactionResultFields_MetaprotocolTransactionResultChannelPaid_Fragment
         | MetaprotocolTransactionResultFields_MetaprotocolTransactionResultCommentCreated_Fragment
         | MetaprotocolTransactionResultFields_MetaprotocolTransactionResultCommentDeleted_Fragment
         | MetaprotocolTransactionResultFields_MetaprotocolTransactionResultCommentEdited_Fragment
@@ -1126,6 +1179,12 @@ export type StateQueryBidRefFieldsFragment = {
   auction: StateQueryAuctionRefFieldsFragment
 }
 
+type StateQueryMetaprotocolTransactionResultFields_MetaprotocolTransactionResultChannelPaid_Fragment =
+  {
+    __typename: 'MetaprotocolTransactionResultChannelPaid'
+    channelPaid?: Types.Maybe<{ id: string }>
+  }
+
 type StateQueryMetaprotocolTransactionResultFields_MetaprotocolTransactionResultCommentCreated_Fragment =
   {
     __typename: 'MetaprotocolTransactionResultCommentCreated'
@@ -1160,6 +1219,7 @@ type StateQueryMetaprotocolTransactionResultFields_MetaprotocolTransactionResult
 }
 
 export type StateQueryMetaprotocolTransactionResultFieldsFragment =
+  | StateQueryMetaprotocolTransactionResultFields_MetaprotocolTransactionResultChannelPaid_Fragment
   | StateQueryMetaprotocolTransactionResultFields_MetaprotocolTransactionResultCommentCreated_Fragment
   | StateQueryMetaprotocolTransactionResultFields_MetaprotocolTransactionResultCommentDeleted_Fragment
   | StateQueryMetaprotocolTransactionResultFields_MetaprotocolTransactionResultCommentEdited_Fragment
@@ -1224,6 +1284,42 @@ export type StateQueryEventFieldsFragment = {
           | StateQueryNftOwnerFields_NftOwnerChannel_Fragment
           | StateQueryNftOwnerFields_NftOwnerMember_Fragment
       }
+    | {
+        amount: string
+        account?: Types.Maybe<string>
+        channel: { id: string }
+        actor:
+          | StateQueryActorFields_ContentActorCurator_Fragment
+          | StateQueryActorFields_ContentActorLead_Fragment
+          | StateQueryActorFields_ContentActorMember_Fragment
+      }
+    | {
+        amount: string
+        rationale?: Types.Maybe<string>
+        payer: { id: string }
+        payeeChannel?: Types.Maybe<{ id: string }>
+        paymentContext?: Types.Maybe<
+          | { __typename: 'PaymentContextChannel'; channel: { id: string } }
+          | { __typename: 'PaymentContextVideo'; video: { id: string } }
+        >
+      }
+    | {
+        commitment?: Types.Maybe<string>
+        minCashoutAllowed?: Types.Maybe<string>
+        maxCashoutAllowed?: Types.Maybe<string>
+        channelCashoutsEnabled?: Types.Maybe<boolean>
+        payloadDataObject?: Types.Maybe<{ id: string }>
+      }
+    | {
+        amount: string
+        account?: Types.Maybe<string>
+        channel: { id: string }
+        actor:
+          | StateQueryActorFields_ContentActorCurator_Fragment
+          | StateQueryActorFields_ContentActorLead_Fragment
+          | StateQueryActorFields_ContentActorMember_Fragment
+      }
+    | { amount: string; channel: { id: string } }
     | { text: string; comment: { id: string } }
     | { newText: string; comment: { id: string } }
     | {
@@ -1242,8 +1338,10 @@ export type StateQueryEventFieldsFragment = {
           | StateQueryNftOwnerFields_NftOwnerMember_Fragment
         auction: { id: string }
       }
+    | { action: boolean; channel: { id: string }; member: { id: string } }
     | {
         result:
+          | StateQueryMetaprotocolTransactionResultFields_MetaprotocolTransactionResultChannelPaid_Fragment
           | StateQueryMetaprotocolTransactionResultFields_MetaprotocolTransactionResultCommentCreated_Fragment
           | StateQueryMetaprotocolTransactionResultFields_MetaprotocolTransactionResultCommentDeleted_Fragment
           | StateQueryMetaprotocolTransactionResultFields_MetaprotocolTransactionResultCommentEdited_Fragment
@@ -1331,6 +1429,7 @@ export type StateQueryV2Query = {
     createdInBlock: number
     rewardAccount: string
     channelStateBloatBond: string
+    cumulativeRewardClaimed?: Types.Maybe<string>
     totalVideosCreated: number
     ownerMember?: Types.Maybe<{ id: string }>
     coverPhoto?: Types.Maybe<{ id: string }>
@@ -1355,6 +1454,12 @@ export type StateQueryV2Query = {
   buyNowCanceledEvents: Array<StateQueryEventFieldsFragment>
   buyNowPriceUpdatedEvents: Array<StateQueryEventFieldsFragment>
   metaprotocolTransactionStatusEvents: Array<StateQueryEventFieldsFragment>
+  channelRewardClaimedEvents: Array<StateQueryEventFieldsFragment>
+  channelRewardClaimedAndWithdrawnEvents: Array<StateQueryEventFieldsFragment>
+  channelFundsWithdrawnEvents: Array<StateQueryEventFieldsFragment>
+  channelPayoutsUpdatedEvents: Array<StateQueryEventFieldsFragment>
+  channelPaymentMadeEvents: Array<StateQueryEventFieldsFragment>
+  memberBannedFromChannelEvents: Array<StateQueryEventFieldsFragment>
   memberships: Array<{
     id: string
     createdAt: any
@@ -1461,6 +1566,7 @@ export type StateQueryV2Query = {
     type?: Types.Maybe<
       | { __typename: 'DataObjectTypeChannelAvatar'; channel: { id: string } }
       | { __typename: 'DataObjectTypeChannelCoverPhoto'; channel: { id: string } }
+      | { __typename: 'DataObjectTypeChannelPayoutsPayload' }
       | { __typename: 'DataObjectTypeVideoMedia'; video: { id: string } }
       | {
           __typename: 'DataObjectTypeVideoSubtitle'
@@ -1670,6 +1776,7 @@ export const FullChannelFields = gql`
     description
     isPublic
     isCensored
+    cumulativeRewardClaimed
     language
     ownerMember {
       ...BasicMembershipFields
@@ -2129,6 +2236,11 @@ export const StateQueryMetaprotocolTransactionResultFields = gql`
         id
       }
     }
+    ... on MetaprotocolTransactionResultChannelPaid {
+      channelPaid {
+        id
+      }
+    }
     ... on MetaprotocolTransactionResultCommentModerated {
       commentModerated {
         id
@@ -2303,6 +2415,73 @@ export const StateQueryEventFields = gql`
           ...StateQueryMetaprotocolTransactionResultFields
         }
       }
+      ... on ChannelRewardClaimedEventData {
+        channel {
+          id
+        }
+        amount
+      }
+      ... on ChannelRewardClaimedAndWithdrawnEventData {
+        channel {
+          id
+        }
+        amount
+        account
+        actor {
+          ...StateQueryActorFields
+        }
+      }
+      ... on ChannelFundsWithdrawnEventData {
+        channel {
+          id
+        }
+        amount
+        account
+        actor {
+          ...StateQueryActorFields
+        }
+      }
+      ... on ChannelPayoutsUpdatedEventData {
+        commitment
+        payloadDataObject {
+          id
+        }
+        minCashoutAllowed
+        maxCashoutAllowed
+        channelCashoutsEnabled
+      }
+      ... on ChannelPaymentMadeEventData {
+        payer {
+          id
+        }
+        amount
+        payeeChannel {
+          id
+        }
+        paymentContext {
+          __typename
+          ... on PaymentContextVideo {
+            video {
+              id
+            }
+          }
+          ... on PaymentContextChannel {
+            channel {
+              id
+            }
+          }
+        }
+        rationale
+      }
+      ... on MemberBannedFromChannelEventData {
+        channel {
+          id
+        }
+        member {
+          id
+        }
+        action
+      }
     }
   }
   ${StateQueryActorFields}
@@ -2484,6 +2663,25 @@ export const GetChannelNftCollectors = gql`
   }
   ${BasicMembershipFields}
 `
+export const GetPayloadDataObjectIdByCommitment = gql`
+  query GetPayloadDataObjectIdByCommitment($commitment: String!) {
+    events(
+      where: { data: { isTypeOf_eq: "ChannelPayoutsUpdatedEventData", commitment_eq: $commitment } }
+      limit: 1
+    ) {
+      data {
+        ... on ChannelPayoutsUpdatedEventData {
+          payloadDataObject {
+            id
+            storageBag {
+              id
+            }
+          }
+        }
+      }
+    }
+  }
+`
 export const ReportChannel = gql`
   mutation ReportChannel($channelId: String!, $rationale: String!) {
     reportChannel(channelId: $channelId, rationale: $rationale) {
@@ -2492,6 +2690,70 @@ export const ReportChannel = gql`
     }
   }
 `
+export const GetChannelPaymentEvents = gql`
+  query GetChannelPaymentEvents($ownerMemberId: String!, $channelId: String!) {
+    events(
+      where: {
+        OR: [
+          {
+            AND: [
+              {
+                data: {
+                  isTypeOf_in: [
+                    "NftBoughtEventData"
+                    "BidMadeCompletingAuctionEventData"
+                    "EnglishAuctionSettledEventData"
+                    "OpenAuctionBidAcceptedEventData"
+                  ]
+                }
+              }
+              {
+                OR: [
+                  { data: { previousNftOwner: { member: { id_eq: $ownerMemberId } } } }
+                  {
+                    data: {
+                      previousNftOwner: { channel: { ownerMember: { id_eq: $ownerMemberId } } }
+                    }
+                  }
+                ]
+              }
+            ]
+          }
+          {
+            data: {
+              isTypeOf_in: ["ChannelRewardClaimedEventData", "ChannelFundsWithdrawnEventData"]
+              channel: { id_eq: $channelId }
+            }
+          }
+        ]
+      }
+    ) {
+      inBlock
+      timestamp
+      data {
+        __typename
+        ... on NftBoughtEventData {
+          price
+        }
+        ... on BidMadeCompletingAuctionEventData {
+          winningBid {
+            amount
+          }
+        }
+        ... on EnglishAuctionSettledEventData {
+          winningBid {
+            amount
+          }
+        }
+        ... on OpenAuctionBidAcceptedEventData {
+          winningBid {
+            amount
+          }
+        }
+      }
+    }
+  }
+`
 export const GetComment = gql`
   query GetComment($commentId: String!) {
     commentById(id: $commentId) {
@@ -3472,6 +3734,7 @@ export const StateQueryV2 = gql`
           id
         }
       }
+      cumulativeRewardClaimed
       entryApp {
         id
       }
@@ -3567,6 +3830,42 @@ export const StateQueryV2 = gql`
     ) {
       ...StateQueryEventFields
     }
+    channelRewardClaimedEvents: events(
+      limit: 9999
+      where: { data: { isTypeOf_eq: "ChannelRewardClaimedEventData" } }
+    ) {
+      ...StateQueryEventFields
+    }
+    channelRewardClaimedAndWithdrawnEvents: events(
+      limit: 9999
+      where: { data: { isTypeOf_eq: "ChannelRewardClaimedAndWithdrawnEventData" } }
+    ) {
+      ...StateQueryEventFields
+    }
+    channelFundsWithdrawnEvents: events(
+      limit: 9999
+      where: { data: { isTypeOf_eq: "ChannelFundsWithdrawnEventData" } }
+    ) {
+      ...StateQueryEventFields
+    }
+    channelPayoutsUpdatedEvents: events(
+      limit: 9999
+      where: { data: { isTypeOf_eq: "ChannelPayoutsUpdatedEventData" } }
+    ) {
+      ...StateQueryEventFields
+    }
+    channelPaymentMadeEvents: events(
+      limit: 9999
+      where: { data: { isTypeOf_eq: "ChannelPaymentMadeEventData" } }
+    ) {
+      ...StateQueryEventFields
+    }
+    memberBannedFromChannelEvents: events(
+      limit: 9999
+      where: { data: { isTypeOf_eq: "MemberBannedFromChannelEventData" } }
+    ) {
+      ...StateQueryEventFields
+    }
     memberships(limit: 9999) {
       id
       createdAt

+ 414 - 31
src/tests/v2/generated/schema.ts

@@ -408,6 +408,8 @@ export enum AuctionOrderByInput {
   NftCreatorRoyaltyDesc = 'nft_creatorRoyalty_DESC',
   NftIdAsc = 'nft_id_ASC',
   NftIdDesc = 'nft_id_DESC',
+  NftIsFeaturedAsc = 'nft_isFeatured_ASC',
+  NftIsFeaturedDesc = 'nft_isFeatured_DESC',
   NftLastSaleDateAsc = 'nft_lastSaleDate_ASC',
   NftLastSaleDateDesc = 'nft_lastSaleDate_DESC',
   NftLastSalePriceAsc = 'nft_lastSalePrice_ASC',
@@ -741,6 +743,8 @@ export enum BannedMemberOrderByInput {
   ChannelCreatedAtDesc = 'channel_createdAt_DESC',
   ChannelCreatedInBlockAsc = 'channel_createdInBlock_ASC',
   ChannelCreatedInBlockDesc = 'channel_createdInBlock_DESC',
+  ChannelCumulativeRewardClaimedAsc = 'channel_cumulativeRewardClaimed_ASC',
+  ChannelCumulativeRewardClaimedDesc = 'channel_cumulativeRewardClaimed_DESC',
   ChannelDescriptionAsc = 'channel_description_ASC',
   ChannelDescriptionDesc = 'channel_description_DESC',
   ChannelFollowsNumAsc = 'channel_followsNum_ASC',
@@ -875,6 +879,8 @@ export enum BidOrderByInput {
   NftCreatorRoyaltyDesc = 'nft_creatorRoyalty_DESC',
   NftIdAsc = 'nft_id_ASC',
   NftIdDesc = 'nft_id_DESC',
+  NftIsFeaturedAsc = 'nft_isFeatured_ASC',
+  NftIsFeaturedDesc = 'nft_isFeatured_DESC',
   NftLastSaleDateAsc = 'nft_lastSaleDate_ASC',
   NftLastSaleDateDesc = 'nft_lastSaleDate_DESC',
   NftLastSalePriceAsc = 'nft_lastSalePrice_ASC',
@@ -988,6 +994,7 @@ export type Channel = {
   coverPhoto?: Maybe<StorageDataObject>
   createdAt: Scalars['DateTime']
   createdInBlock: Scalars['Int']
+  cumulativeRewardClaimed?: Maybe<Scalars['BigInt']>
   description?: Maybe<Scalars['String']>
   entryApp?: Maybe<App>
   followsNum: Scalars['Int']
@@ -1124,6 +1131,13 @@ export type ChannelFollowsConnection = {
   totalCount: Scalars['Int']
 }
 
+export type ChannelFundsWithdrawnEventData = {
+  account?: Maybe<Scalars['String']>
+  actor: ContentActor
+  amount: Scalars['BigInt']
+  channel: Channel
+}
+
 export type ChannelNftCollector = {
   amount: Scalars['Int']
   member: Membership
@@ -1143,8 +1157,6 @@ export enum ChannelOrderByInput {
   AvatarPhotoIpfsHashDesc = 'avatarPhoto_ipfsHash_DESC',
   AvatarPhotoIsAcceptedAsc = 'avatarPhoto_isAccepted_ASC',
   AvatarPhotoIsAcceptedDesc = 'avatarPhoto_isAccepted_DESC',
-  AvatarPhotoResolvedUrlAsc = 'avatarPhoto_resolvedUrl_ASC',
-  AvatarPhotoResolvedUrlDesc = 'avatarPhoto_resolvedUrl_DESC',
   AvatarPhotoSizeAsc = 'avatarPhoto_size_ASC',
   AvatarPhotoSizeDesc = 'avatarPhoto_size_DESC',
   AvatarPhotoStateBloatBondAsc = 'avatarPhoto_stateBloatBond_ASC',
@@ -1161,8 +1173,6 @@ export enum ChannelOrderByInput {
   CoverPhotoIpfsHashDesc = 'coverPhoto_ipfsHash_DESC',
   CoverPhotoIsAcceptedAsc = 'coverPhoto_isAccepted_ASC',
   CoverPhotoIsAcceptedDesc = 'coverPhoto_isAccepted_DESC',
-  CoverPhotoResolvedUrlAsc = 'coverPhoto_resolvedUrl_ASC',
-  CoverPhotoResolvedUrlDesc = 'coverPhoto_resolvedUrl_DESC',
   CoverPhotoSizeAsc = 'coverPhoto_size_ASC',
   CoverPhotoSizeDesc = 'coverPhoto_size_DESC',
   CoverPhotoStateBloatBondAsc = 'coverPhoto_stateBloatBond_ASC',
@@ -1173,6 +1183,8 @@ export enum ChannelOrderByInput {
   CreatedAtDesc = 'createdAt_DESC',
   CreatedInBlockAsc = 'createdInBlock_ASC',
   CreatedInBlockDesc = 'createdInBlock_DESC',
+  CumulativeRewardClaimedAsc = 'cumulativeRewardClaimed_ASC',
+  CumulativeRewardClaimedDesc = 'cumulativeRewardClaimed_DESC',
   DescriptionAsc = 'description_ASC',
   DescriptionDesc = 'description_DESC',
   EntryAppAuthKeyAsc = 'entryApp_authKey_ASC',
@@ -1231,6 +1243,22 @@ export enum ChannelOrderByInput {
   VideoViewsNumDesc = 'videoViewsNum_DESC',
 }
 
+export type ChannelPaymentMadeEventData = {
+  amount: Scalars['BigInt']
+  payeeChannel?: Maybe<Channel>
+  payer: Membership
+  paymentContext?: Maybe<PaymentContext>
+  rationale?: Maybe<Scalars['String']>
+}
+
+export type ChannelPayoutsUpdatedEventData = {
+  channelCashoutsEnabled?: Maybe<Scalars['Boolean']>
+  commitment?: Maybe<Scalars['String']>
+  maxCashoutAllowed?: Maybe<Scalars['BigInt']>
+  minCashoutAllowed?: Maybe<Scalars['BigInt']>
+  payloadDataObject?: Maybe<StorageDataObject>
+}
+
 export type ChannelReportInfo = {
   channelId: Scalars['String']
   created: Scalars['Boolean']
@@ -1240,6 +1268,18 @@ export type ChannelReportInfo = {
   reporterIp: Scalars['String']
 }
 
+export type ChannelRewardClaimedAndWithdrawnEventData = {
+  account?: Maybe<Scalars['String']>
+  actor: ContentActor
+  amount: Scalars['BigInt']
+  channel: Channel
+}
+
+export type ChannelRewardClaimedEventData = {
+  amount: Scalars['BigInt']
+  channel: Channel
+}
+
 export type ChannelUnfollowResult = {
   channelId: Scalars['String']
   follows: Scalars['Int']
@@ -1283,6 +1323,15 @@ export type ChannelWhereInput = {
   createdInBlock_lte?: Maybe<Scalars['Int']>
   createdInBlock_not_eq?: Maybe<Scalars['Int']>
   createdInBlock_not_in?: Maybe<Array<Scalars['Int']>>
+  cumulativeRewardClaimed_eq?: Maybe<Scalars['BigInt']>
+  cumulativeRewardClaimed_gt?: Maybe<Scalars['BigInt']>
+  cumulativeRewardClaimed_gte?: Maybe<Scalars['BigInt']>
+  cumulativeRewardClaimed_in?: Maybe<Array<Scalars['BigInt']>>
+  cumulativeRewardClaimed_isNull?: Maybe<Scalars['Boolean']>
+  cumulativeRewardClaimed_lt?: Maybe<Scalars['BigInt']>
+  cumulativeRewardClaimed_lte?: Maybe<Scalars['BigInt']>
+  cumulativeRewardClaimed_not_eq?: Maybe<Scalars['BigInt']>
+  cumulativeRewardClaimed_not_in?: Maybe<Array<Scalars['BigInt']>>
   description_contains?: Maybe<Scalars['String']>
   description_containsInsensitive?: Maybe<Scalars['String']>
   description_endsWith?: Maybe<Scalars['String']>
@@ -1946,6 +1995,7 @@ export type CuratorsConnection = {
 export type DataObjectType =
   | DataObjectTypeChannelAvatar
   | DataObjectTypeChannelCoverPhoto
+  | DataObjectTypeChannelPayoutsPayload
   | DataObjectTypeVideoMedia
   | DataObjectTypeVideoSubtitle
   | DataObjectTypeVideoThumbnail
@@ -1958,6 +2008,10 @@ export type DataObjectTypeChannelCoverPhoto = {
   channel: Channel
 }
 
+export type DataObjectTypeChannelPayoutsPayload = {
+  phantom?: Maybe<Scalars['Int']>
+}
+
 export type DataObjectTypeVideoMedia = {
   video: Video
 }
@@ -1991,6 +2045,15 @@ export type DataObjectTypeWhereInput = {
   isTypeOf_not_in?: Maybe<Array<Scalars['String']>>
   isTypeOf_not_startsWith?: Maybe<Scalars['String']>
   isTypeOf_startsWith?: Maybe<Scalars['String']>
+  phantom_eq?: Maybe<Scalars['Int']>
+  phantom_gt?: Maybe<Scalars['Int']>
+  phantom_gte?: Maybe<Scalars['Int']>
+  phantom_in?: Maybe<Array<Scalars['Int']>>
+  phantom_isNull?: Maybe<Scalars['Boolean']>
+  phantom_lt?: Maybe<Scalars['Int']>
+  phantom_lte?: Maybe<Scalars['Int']>
+  phantom_not_eq?: Maybe<Scalars['Int']>
+  phantom_not_in?: Maybe<Array<Scalars['Int']>>
   subtitle?: Maybe<VideoSubtitleWhereInput>
   subtitle_isNull?: Maybe<Scalars['Boolean']>
   video?: Maybe<VideoWhereInput>
@@ -2524,6 +2587,11 @@ export type EventData =
   | BidMadeCompletingAuctionEventData
   | BuyNowCanceledEventData
   | BuyNowPriceUpdatedEventData
+  | ChannelFundsWithdrawnEventData
+  | ChannelPaymentMadeEventData
+  | ChannelPayoutsUpdatedEventData
+  | ChannelRewardClaimedAndWithdrawnEventData
+  | ChannelRewardClaimedEventData
   | CommentCreatedEventData
   | CommentTextUpdatedEventData
   | EnglishAuctionSettledEventData
@@ -2537,11 +2605,37 @@ export type EventData =
   | OpenAuctionStartedEventData
 
 export type EventDataWhereInput = {
+  account_contains?: Maybe<Scalars['String']>
+  account_containsInsensitive?: Maybe<Scalars['String']>
+  account_endsWith?: Maybe<Scalars['String']>
+  account_eq?: Maybe<Scalars['String']>
+  account_gt?: Maybe<Scalars['String']>
+  account_gte?: Maybe<Scalars['String']>
+  account_in?: Maybe<Array<Scalars['String']>>
+  account_isNull?: Maybe<Scalars['Boolean']>
+  account_lt?: Maybe<Scalars['String']>
+  account_lte?: Maybe<Scalars['String']>
+  account_not_contains?: Maybe<Scalars['String']>
+  account_not_containsInsensitive?: Maybe<Scalars['String']>
+  account_not_endsWith?: Maybe<Scalars['String']>
+  account_not_eq?: Maybe<Scalars['String']>
+  account_not_in?: Maybe<Array<Scalars['String']>>
+  account_not_startsWith?: Maybe<Scalars['String']>
+  account_startsWith?: Maybe<Scalars['String']>
   action_eq?: Maybe<Scalars['Boolean']>
   action_isNull?: Maybe<Scalars['Boolean']>
   action_not_eq?: Maybe<Scalars['Boolean']>
   actor?: Maybe<ContentActorWhereInput>
   actor_isNull?: Maybe<Scalars['Boolean']>
+  amount_eq?: Maybe<Scalars['BigInt']>
+  amount_gt?: Maybe<Scalars['BigInt']>
+  amount_gte?: Maybe<Scalars['BigInt']>
+  amount_in?: Maybe<Array<Scalars['BigInt']>>
+  amount_isNull?: Maybe<Scalars['Boolean']>
+  amount_lt?: Maybe<Scalars['BigInt']>
+  amount_lte?: Maybe<Scalars['BigInt']>
+  amount_not_eq?: Maybe<Scalars['BigInt']>
+  amount_not_in?: Maybe<Array<Scalars['BigInt']>>
   auction?: Maybe<AuctionWhereInput>
   auction_isNull?: Maybe<Scalars['Boolean']>
   bid?: Maybe<BidWhereInput>
@@ -2549,9 +2643,29 @@ export type EventDataWhereInput = {
   buyer?: Maybe<MembershipWhereInput>
   buyer_isNull?: Maybe<Scalars['Boolean']>
   channel?: Maybe<ChannelWhereInput>
+  channelCashoutsEnabled_eq?: Maybe<Scalars['Boolean']>
+  channelCashoutsEnabled_isNull?: Maybe<Scalars['Boolean']>
+  channelCashoutsEnabled_not_eq?: Maybe<Scalars['Boolean']>
   channel_isNull?: Maybe<Scalars['Boolean']>
   comment?: Maybe<CommentWhereInput>
   comment_isNull?: Maybe<Scalars['Boolean']>
+  commitment_contains?: Maybe<Scalars['String']>
+  commitment_containsInsensitive?: Maybe<Scalars['String']>
+  commitment_endsWith?: Maybe<Scalars['String']>
+  commitment_eq?: Maybe<Scalars['String']>
+  commitment_gt?: Maybe<Scalars['String']>
+  commitment_gte?: Maybe<Scalars['String']>
+  commitment_in?: Maybe<Array<Scalars['String']>>
+  commitment_isNull?: Maybe<Scalars['Boolean']>
+  commitment_lt?: Maybe<Scalars['String']>
+  commitment_lte?: Maybe<Scalars['String']>
+  commitment_not_contains?: Maybe<Scalars['String']>
+  commitment_not_containsInsensitive?: Maybe<Scalars['String']>
+  commitment_not_endsWith?: Maybe<Scalars['String']>
+  commitment_not_eq?: Maybe<Scalars['String']>
+  commitment_not_in?: Maybe<Array<Scalars['String']>>
+  commitment_not_startsWith?: Maybe<Scalars['String']>
+  commitment_startsWith?: Maybe<Scalars['String']>
   isTypeOf_contains?: Maybe<Scalars['String']>
   isTypeOf_containsInsensitive?: Maybe<Scalars['String']>
   isTypeOf_endsWith?: Maybe<Scalars['String']>
@@ -2569,8 +2683,26 @@ export type EventDataWhereInput = {
   isTypeOf_not_in?: Maybe<Array<Scalars['String']>>
   isTypeOf_not_startsWith?: Maybe<Scalars['String']>
   isTypeOf_startsWith?: Maybe<Scalars['String']>
+  maxCashoutAllowed_eq?: Maybe<Scalars['BigInt']>
+  maxCashoutAllowed_gt?: Maybe<Scalars['BigInt']>
+  maxCashoutAllowed_gte?: Maybe<Scalars['BigInt']>
+  maxCashoutAllowed_in?: Maybe<Array<Scalars['BigInt']>>
+  maxCashoutAllowed_isNull?: Maybe<Scalars['Boolean']>
+  maxCashoutAllowed_lt?: Maybe<Scalars['BigInt']>
+  maxCashoutAllowed_lte?: Maybe<Scalars['BigInt']>
+  maxCashoutAllowed_not_eq?: Maybe<Scalars['BigInt']>
+  maxCashoutAllowed_not_in?: Maybe<Array<Scalars['BigInt']>>
   member?: Maybe<MembershipWhereInput>
   member_isNull?: Maybe<Scalars['Boolean']>
+  minCashoutAllowed_eq?: Maybe<Scalars['BigInt']>
+  minCashoutAllowed_gt?: Maybe<Scalars['BigInt']>
+  minCashoutAllowed_gte?: Maybe<Scalars['BigInt']>
+  minCashoutAllowed_in?: Maybe<Array<Scalars['BigInt']>>
+  minCashoutAllowed_isNull?: Maybe<Scalars['Boolean']>
+  minCashoutAllowed_lt?: Maybe<Scalars['BigInt']>
+  minCashoutAllowed_lte?: Maybe<Scalars['BigInt']>
+  minCashoutAllowed_not_eq?: Maybe<Scalars['BigInt']>
+  minCashoutAllowed_not_in?: Maybe<Array<Scalars['BigInt']>>
   newPrice_eq?: Maybe<Scalars['BigInt']>
   newPrice_gt?: Maybe<Scalars['BigInt']>
   newPrice_gte?: Maybe<Scalars['BigInt']>
@@ -2601,6 +2733,14 @@ export type EventDataWhereInput = {
   nftOwner?: Maybe<NftOwnerWhereInput>
   nftOwner_isNull?: Maybe<Scalars['Boolean']>
   nft_isNull?: Maybe<Scalars['Boolean']>
+  payeeChannel?: Maybe<ChannelWhereInput>
+  payeeChannel_isNull?: Maybe<Scalars['Boolean']>
+  payer?: Maybe<MembershipWhereInput>
+  payer_isNull?: Maybe<Scalars['Boolean']>
+  payloadDataObject?: Maybe<StorageDataObjectWhereInput>
+  payloadDataObject_isNull?: Maybe<Scalars['Boolean']>
+  paymentContext?: Maybe<PaymentContextWhereInput>
+  paymentContext_isNull?: Maybe<Scalars['Boolean']>
   previousNftOwner?: Maybe<NftOwnerWhereInput>
   previousNftOwner_isNull?: Maybe<Scalars['Boolean']>
   price_eq?: Maybe<Scalars['BigInt']>
@@ -2612,6 +2752,23 @@ export type EventDataWhereInput = {
   price_lte?: Maybe<Scalars['BigInt']>
   price_not_eq?: Maybe<Scalars['BigInt']>
   price_not_in?: Maybe<Array<Scalars['BigInt']>>
+  rationale_contains?: Maybe<Scalars['String']>
+  rationale_containsInsensitive?: Maybe<Scalars['String']>
+  rationale_endsWith?: Maybe<Scalars['String']>
+  rationale_eq?: Maybe<Scalars['String']>
+  rationale_gt?: Maybe<Scalars['String']>
+  rationale_gte?: Maybe<Scalars['String']>
+  rationale_in?: Maybe<Array<Scalars['String']>>
+  rationale_isNull?: Maybe<Scalars['Boolean']>
+  rationale_lt?: Maybe<Scalars['String']>
+  rationale_lte?: Maybe<Scalars['String']>
+  rationale_not_contains?: Maybe<Scalars['String']>
+  rationale_not_containsInsensitive?: Maybe<Scalars['String']>
+  rationale_not_endsWith?: Maybe<Scalars['String']>
+  rationale_not_eq?: Maybe<Scalars['String']>
+  rationale_not_in?: Maybe<Array<Scalars['String']>>
+  rationale_not_startsWith?: Maybe<Scalars['String']>
+  rationale_startsWith?: Maybe<Scalars['String']>
   result?: Maybe<MetaprotocolTransactionResultWhereInput>
   result_isNull?: Maybe<Scalars['Boolean']>
   text_contains?: Maybe<Scalars['String']>
@@ -2641,16 +2798,30 @@ export type EventEdge = {
 }
 
 export enum EventOrderByInput {
+  DataAccountAsc = 'data_account_ASC',
+  DataAccountDesc = 'data_account_DESC',
   DataActionAsc = 'data_action_ASC',
   DataActionDesc = 'data_action_DESC',
+  DataAmountAsc = 'data_amount_ASC',
+  DataAmountDesc = 'data_amount_DESC',
+  DataChannelCashoutsEnabledAsc = 'data_channelCashoutsEnabled_ASC',
+  DataChannelCashoutsEnabledDesc = 'data_channelCashoutsEnabled_DESC',
+  DataCommitmentAsc = 'data_commitment_ASC',
+  DataCommitmentDesc = 'data_commitment_DESC',
   DataIsTypeOfAsc = 'data_isTypeOf_ASC',
   DataIsTypeOfDesc = 'data_isTypeOf_DESC',
+  DataMaxCashoutAllowedAsc = 'data_maxCashoutAllowed_ASC',
+  DataMaxCashoutAllowedDesc = 'data_maxCashoutAllowed_DESC',
+  DataMinCashoutAllowedAsc = 'data_minCashoutAllowed_ASC',
+  DataMinCashoutAllowedDesc = 'data_minCashoutAllowed_DESC',
   DataNewPriceAsc = 'data_newPrice_ASC',
   DataNewPriceDesc = 'data_newPrice_DESC',
   DataNewTextAsc = 'data_newText_ASC',
   DataNewTextDesc = 'data_newText_DESC',
   DataPriceAsc = 'data_price_ASC',
   DataPriceDesc = 'data_price_DESC',
+  DataRationaleAsc = 'data_rationale_ASC',
+  DataRationaleDesc = 'data_rationale_DESC',
   DataTextAsc = 'data_text_ASC',
   DataTextDesc = 'data_text_DESC',
   IdAsc = 'id_ASC',
@@ -3171,6 +3342,7 @@ export type MembershipsConnection = {
 }
 
 export type MetaprotocolTransactionResult =
+  | MetaprotocolTransactionResultChannelPaid
   | MetaprotocolTransactionResultCommentCreated
   | MetaprotocolTransactionResultCommentDeleted
   | MetaprotocolTransactionResultCommentEdited
@@ -3178,6 +3350,10 @@ export type MetaprotocolTransactionResult =
   | MetaprotocolTransactionResultFailed
   | MetaprotocolTransactionResultOk
 
+export type MetaprotocolTransactionResultChannelPaid = {
+  channelPaid?: Maybe<Channel>
+}
+
 export type MetaprotocolTransactionResultCommentCreated = {
   commentCreated?: Maybe<Comment>
 }
@@ -3203,6 +3379,8 @@ export type MetaprotocolTransactionResultOk = {
 }
 
 export type MetaprotocolTransactionResultWhereInput = {
+  channelPaid?: Maybe<ChannelWhereInput>
+  channelPaid_isNull?: Maybe<Scalars['Boolean']>
   commentCreated?: Maybe<CommentWhereInput>
   commentCreated_isNull?: Maybe<Scalars['Boolean']>
   commentDeleted?: Maybe<CommentWhereInput>
@@ -3266,8 +3444,10 @@ export type Mutation = {
   followChannel: ChannelFollowResult
   reportChannel: ChannelReportInfo
   reportVideo: VideoReportInfo
+  requestNftFeatured: NftFeaturedRequstInfo
   restoreContent: RestoreContentResult
   setCategoryFeaturedVideos: SetCategoryFeaturedVideosResult
+  setFeaturedNfts: SetFeaturedNftsResult
   setKillSwitch: KillSwitch
   setSupportedCategories: SetSupportedCategoriesResult
   setVideoHero: SetVideoHeroResult
@@ -3299,6 +3479,11 @@ export type MutationReportVideoArgs = {
   videoId: Scalars['String']
 }
 
+export type MutationRequestNftFeaturedArgs = {
+  nftId: Scalars['String']
+  rationale: Scalars['String']
+}
+
 export type MutationRestoreContentArgs = {
   ids: Array<Scalars['String']>
   type: ExcludableContentType
@@ -3309,6 +3494,10 @@ export type MutationSetCategoryFeaturedVideosArgs = {
   videos: Array<FeaturedVideoInput>
 }
 
+export type MutationSetFeaturedNftsArgs = {
+  featuredNftsIds: Array<Scalars['String']>
+}
+
 export type MutationSetKillSwitchArgs = {
   isKilled: Scalars['Boolean']
 }
@@ -3418,6 +3607,129 @@ export type NftBoughtEventData = {
   price: Scalars['BigInt']
 }
 
+export type NftFeaturedRequstInfo = {
+  created: Scalars['Boolean']
+  createdAt: Scalars['DateTime']
+  id: Scalars['String']
+  nftId: Scalars['String']
+  rationale: Scalars['String']
+  reporterIp: Scalars['String']
+}
+
+export type NftFeaturingRequest = {
+  id: Scalars['String']
+  ip: Scalars['String']
+  nftId: Scalars['String']
+  rationale: Scalars['String']
+  timestamp: Scalars['DateTime']
+}
+
+export type NftFeaturingRequestEdge = {
+  cursor: Scalars['String']
+  node: NftFeaturingRequest
+}
+
+export enum NftFeaturingRequestOrderByInput {
+  IdAsc = 'id_ASC',
+  IdDesc = 'id_DESC',
+  IpAsc = 'ip_ASC',
+  IpDesc = 'ip_DESC',
+  NftIdAsc = 'nftId_ASC',
+  NftIdDesc = 'nftId_DESC',
+  RationaleAsc = 'rationale_ASC',
+  RationaleDesc = 'rationale_DESC',
+  TimestampAsc = 'timestamp_ASC',
+  TimestampDesc = 'timestamp_DESC',
+}
+
+export type NftFeaturingRequestWhereInput = {
+  AND?: Maybe<Array<NftFeaturingRequestWhereInput>>
+  OR?: Maybe<Array<NftFeaturingRequestWhereInput>>
+  id_contains?: Maybe<Scalars['String']>
+  id_containsInsensitive?: Maybe<Scalars['String']>
+  id_endsWith?: Maybe<Scalars['String']>
+  id_eq?: Maybe<Scalars['String']>
+  id_gt?: Maybe<Scalars['String']>
+  id_gte?: Maybe<Scalars['String']>
+  id_in?: Maybe<Array<Scalars['String']>>
+  id_isNull?: Maybe<Scalars['Boolean']>
+  id_lt?: Maybe<Scalars['String']>
+  id_lte?: Maybe<Scalars['String']>
+  id_not_contains?: Maybe<Scalars['String']>
+  id_not_containsInsensitive?: Maybe<Scalars['String']>
+  id_not_endsWith?: Maybe<Scalars['String']>
+  id_not_eq?: Maybe<Scalars['String']>
+  id_not_in?: Maybe<Array<Scalars['String']>>
+  id_not_startsWith?: Maybe<Scalars['String']>
+  id_startsWith?: Maybe<Scalars['String']>
+  ip_contains?: Maybe<Scalars['String']>
+  ip_containsInsensitive?: Maybe<Scalars['String']>
+  ip_endsWith?: Maybe<Scalars['String']>
+  ip_eq?: Maybe<Scalars['String']>
+  ip_gt?: Maybe<Scalars['String']>
+  ip_gte?: Maybe<Scalars['String']>
+  ip_in?: Maybe<Array<Scalars['String']>>
+  ip_isNull?: Maybe<Scalars['Boolean']>
+  ip_lt?: Maybe<Scalars['String']>
+  ip_lte?: Maybe<Scalars['String']>
+  ip_not_contains?: Maybe<Scalars['String']>
+  ip_not_containsInsensitive?: Maybe<Scalars['String']>
+  ip_not_endsWith?: Maybe<Scalars['String']>
+  ip_not_eq?: Maybe<Scalars['String']>
+  ip_not_in?: Maybe<Array<Scalars['String']>>
+  ip_not_startsWith?: Maybe<Scalars['String']>
+  ip_startsWith?: Maybe<Scalars['String']>
+  nftId_contains?: Maybe<Scalars['String']>
+  nftId_containsInsensitive?: Maybe<Scalars['String']>
+  nftId_endsWith?: Maybe<Scalars['String']>
+  nftId_eq?: Maybe<Scalars['String']>
+  nftId_gt?: Maybe<Scalars['String']>
+  nftId_gte?: Maybe<Scalars['String']>
+  nftId_in?: Maybe<Array<Scalars['String']>>
+  nftId_isNull?: Maybe<Scalars['Boolean']>
+  nftId_lt?: Maybe<Scalars['String']>
+  nftId_lte?: Maybe<Scalars['String']>
+  nftId_not_contains?: Maybe<Scalars['String']>
+  nftId_not_containsInsensitive?: Maybe<Scalars['String']>
+  nftId_not_endsWith?: Maybe<Scalars['String']>
+  nftId_not_eq?: Maybe<Scalars['String']>
+  nftId_not_in?: Maybe<Array<Scalars['String']>>
+  nftId_not_startsWith?: Maybe<Scalars['String']>
+  nftId_startsWith?: Maybe<Scalars['String']>
+  rationale_contains?: Maybe<Scalars['String']>
+  rationale_containsInsensitive?: Maybe<Scalars['String']>
+  rationale_endsWith?: Maybe<Scalars['String']>
+  rationale_eq?: Maybe<Scalars['String']>
+  rationale_gt?: Maybe<Scalars['String']>
+  rationale_gte?: Maybe<Scalars['String']>
+  rationale_in?: Maybe<Array<Scalars['String']>>
+  rationale_isNull?: Maybe<Scalars['Boolean']>
+  rationale_lt?: Maybe<Scalars['String']>
+  rationale_lte?: Maybe<Scalars['String']>
+  rationale_not_contains?: Maybe<Scalars['String']>
+  rationale_not_containsInsensitive?: Maybe<Scalars['String']>
+  rationale_not_endsWith?: Maybe<Scalars['String']>
+  rationale_not_eq?: Maybe<Scalars['String']>
+  rationale_not_in?: Maybe<Array<Scalars['String']>>
+  rationale_not_startsWith?: Maybe<Scalars['String']>
+  rationale_startsWith?: Maybe<Scalars['String']>
+  timestamp_eq?: Maybe<Scalars['DateTime']>
+  timestamp_gt?: Maybe<Scalars['DateTime']>
+  timestamp_gte?: Maybe<Scalars['DateTime']>
+  timestamp_in?: Maybe<Array<Scalars['DateTime']>>
+  timestamp_isNull?: Maybe<Scalars['Boolean']>
+  timestamp_lt?: Maybe<Scalars['DateTime']>
+  timestamp_lte?: Maybe<Scalars['DateTime']>
+  timestamp_not_eq?: Maybe<Scalars['DateTime']>
+  timestamp_not_in?: Maybe<Array<Scalars['DateTime']>>
+}
+
+export type NftFeaturingRequestsConnection = {
+  edges: Array<NftFeaturingRequestEdge>
+  pageInfo: PageInfo
+  totalCount: Scalars['Int']
+}
+
 export type NftHistoryEntriesConnection = {
   edges: Array<NftHistoryEntryEdge>
   pageInfo: PageInfo
@@ -3454,6 +3766,8 @@ export enum NftHistoryEntryOrderByInput {
   NftCreatorRoyaltyDesc = 'nft_creatorRoyalty_DESC',
   NftIdAsc = 'nft_id_ASC',
   NftIdDesc = 'nft_id_DESC',
+  NftIsFeaturedAsc = 'nft_isFeatured_ASC',
+  NftIsFeaturedDesc = 'nft_isFeatured_DESC',
   NftLastSaleDateAsc = 'nft_lastSaleDate_ASC',
   NftLastSaleDateDesc = 'nft_lastSaleDate_DESC',
   NftLastSalePriceAsc = 'nft_lastSalePrice_ASC',
@@ -3664,6 +3978,7 @@ export type OwnedNft = {
   createdAt: Scalars['DateTime']
   creatorRoyalty?: Maybe<Scalars['Float']>
   id: Scalars['String']
+  isFeatured: Scalars['Boolean']
   lastSaleDate?: Maybe<Scalars['DateTime']>
   lastSalePrice?: Maybe<Scalars['BigInt']>
   owner: NftOwner
@@ -3697,6 +4012,8 @@ export enum OwnedNftOrderByInput {
   CreatorRoyaltyDesc = 'creatorRoyalty_DESC',
   IdAsc = 'id_ASC',
   IdDesc = 'id_DESC',
+  IsFeaturedAsc = 'isFeatured_ASC',
+  IsFeaturedDesc = 'isFeatured_DESC',
   LastSaleDateAsc = 'lastSaleDate_ASC',
   LastSaleDateDesc = 'lastSaleDate_DESC',
   LastSalePriceAsc = 'lastSalePrice_ASC',
@@ -3795,6 +4112,9 @@ export type OwnedNftWhereInput = {
   id_not_in?: Maybe<Array<Scalars['String']>>
   id_not_startsWith?: Maybe<Scalars['String']>
   id_startsWith?: Maybe<Scalars['String']>
+  isFeatured_eq?: Maybe<Scalars['Boolean']>
+  isFeatured_isNull?: Maybe<Scalars['Boolean']>
+  isFeatured_not_eq?: Maybe<Scalars['Boolean']>
   lastSaleDate_eq?: Maybe<Scalars['DateTime']>
   lastSaleDate_gt?: Maybe<Scalars['DateTime']>
   lastSaleDate_gte?: Maybe<Scalars['DateTime']>
@@ -3834,6 +4154,40 @@ export type PageInfo = {
   startCursor: Scalars['String']
 }
 
+export type PaymentContext = PaymentContextChannel | PaymentContextVideo
+
+export type PaymentContextChannel = {
+  channel: Channel
+}
+
+export type PaymentContextVideo = {
+  video: Video
+}
+
+export type PaymentContextWhereInput = {
+  channel?: Maybe<ChannelWhereInput>
+  channel_isNull?: Maybe<Scalars['Boolean']>
+  isTypeOf_contains?: Maybe<Scalars['String']>
+  isTypeOf_containsInsensitive?: Maybe<Scalars['String']>
+  isTypeOf_endsWith?: Maybe<Scalars['String']>
+  isTypeOf_eq?: Maybe<Scalars['String']>
+  isTypeOf_gt?: Maybe<Scalars['String']>
+  isTypeOf_gte?: Maybe<Scalars['String']>
+  isTypeOf_in?: Maybe<Array<Scalars['String']>>
+  isTypeOf_isNull?: Maybe<Scalars['Boolean']>
+  isTypeOf_lt?: Maybe<Scalars['String']>
+  isTypeOf_lte?: Maybe<Scalars['String']>
+  isTypeOf_not_contains?: Maybe<Scalars['String']>
+  isTypeOf_not_containsInsensitive?: Maybe<Scalars['String']>
+  isTypeOf_not_endsWith?: Maybe<Scalars['String']>
+  isTypeOf_not_eq?: Maybe<Scalars['String']>
+  isTypeOf_not_in?: Maybe<Array<Scalars['String']>>
+  isTypeOf_not_startsWith?: Maybe<Scalars['String']>
+  isTypeOf_startsWith?: Maybe<Scalars['String']>
+  video?: Maybe<VideoWhereInput>
+  video_isNull?: Maybe<Scalars['Boolean']>
+}
+
 export type ProcessorState = {
   lastProcessedBlock: Scalars['Int']
 }
@@ -3956,6 +4310,11 @@ export type Query = {
   nftActivityById?: Maybe<NftActivity>
   /** @deprecated Use nftActivityById */
   nftActivityByUniqueInput?: Maybe<NftActivity>
+  nftFeaturingRequestById?: Maybe<NftFeaturingRequest>
+  /** @deprecated Use nftFeaturingRequestById */
+  nftFeaturingRequestByUniqueInput?: Maybe<NftFeaturingRequest>
+  nftFeaturingRequests: Array<NftFeaturingRequest>
+  nftFeaturingRequestsConnection: NftFeaturingRequestsConnection
   nftHistoryEntries: Array<NftHistoryEntry>
   nftHistoryEntriesConnection: NftHistoryEntriesConnection
   nftHistoryEntryById?: Maybe<NftHistoryEntry>
@@ -4562,6 +4921,28 @@ export type QueryNftActivityByUniqueInputArgs = {
   where: WhereIdInput
 }
 
+export type QueryNftFeaturingRequestByIdArgs = {
+  id: Scalars['String']
+}
+
+export type QueryNftFeaturingRequestByUniqueInputArgs = {
+  where: WhereIdInput
+}
+
+export type QueryNftFeaturingRequestsArgs = {
+  limit?: Maybe<Scalars['Int']>
+  offset?: Maybe<Scalars['Int']>
+  orderBy?: Maybe<Array<NftFeaturingRequestOrderByInput>>
+  where?: Maybe<NftFeaturingRequestWhereInput>
+}
+
+export type QueryNftFeaturingRequestsConnectionArgs = {
+  after?: Maybe<Scalars['String']>
+  first?: Maybe<Scalars['Int']>
+  orderBy: Array<NftFeaturingRequestOrderByInput>
+  where?: Maybe<NftFeaturingRequestWhereInput>
+}
+
 export type QueryNftHistoryEntriesArgs = {
   limit?: Maybe<Scalars['Int']>
   offset?: Maybe<Scalars['Int']>
@@ -4959,7 +5340,7 @@ export type QueryVideosConnectionArgs = {
 }
 
 export type Report = {
-  channelId: Scalars['String']
+  channelId?: Maybe<Scalars['String']>
   id: Scalars['String']
   ip: Scalars['String']
   rationale: Scalars['String']
@@ -5102,6 +5483,10 @@ export type SetCategoryFeaturedVideosResult = {
   numberOfFeaturedVideosUnset: Scalars['Int']
 }
 
+export type SetFeaturedNftsResult = {
+  newNumberOfNftsFeatured?: Maybe<Scalars['Int']>
+}
+
 export type SetSupportedCategoriesResult = {
   newNumberOfCategoriesSupported?: Maybe<Scalars['Int']>
   newlyCreatedCategoriesSupported: Scalars['Boolean']
@@ -5693,7 +6078,7 @@ export type StorageDataObject = {
   id: Scalars['String']
   ipfsHash: Scalars['String']
   isAccepted: Scalars['Boolean']
-  resolvedUrl?: Maybe<Scalars['String']>
+  resolvedUrls: Array<Scalars['String']>
   size: Scalars['BigInt']
   stateBloatBond: Scalars['BigInt']
   storageBag: StorageBag
@@ -5715,8 +6100,6 @@ export enum StorageDataObjectOrderByInput {
   IpfsHashDesc = 'ipfsHash_DESC',
   IsAcceptedAsc = 'isAccepted_ASC',
   IsAcceptedDesc = 'isAccepted_DESC',
-  ResolvedUrlAsc = 'resolvedUrl_ASC',
-  ResolvedUrlDesc = 'resolvedUrl_DESC',
   SizeAsc = 'size_ASC',
   SizeDesc = 'size_DESC',
   StateBloatBondAsc = 'stateBloatBond_ASC',
@@ -5725,6 +6108,8 @@ export enum StorageDataObjectOrderByInput {
   StorageBagIdDesc = 'storageBag_id_DESC',
   TypeIsTypeOfAsc = 'type_isTypeOf_ASC',
   TypeIsTypeOfDesc = 'type_isTypeOf_DESC',
+  TypePhantomAsc = 'type_phantom_ASC',
+  TypePhantomDesc = 'type_phantom_DESC',
   UnsetAtAsc = 'unsetAt_ASC',
   UnsetAtDesc = 'unsetAt_DESC',
 }
@@ -5778,23 +6163,10 @@ export type StorageDataObjectWhereInput = {
   isAccepted_eq?: Maybe<Scalars['Boolean']>
   isAccepted_isNull?: Maybe<Scalars['Boolean']>
   isAccepted_not_eq?: Maybe<Scalars['Boolean']>
-  resolvedUrl_contains?: Maybe<Scalars['String']>
-  resolvedUrl_containsInsensitive?: Maybe<Scalars['String']>
-  resolvedUrl_endsWith?: Maybe<Scalars['String']>
-  resolvedUrl_eq?: Maybe<Scalars['String']>
-  resolvedUrl_gt?: Maybe<Scalars['String']>
-  resolvedUrl_gte?: Maybe<Scalars['String']>
-  resolvedUrl_in?: Maybe<Array<Scalars['String']>>
-  resolvedUrl_isNull?: Maybe<Scalars['Boolean']>
-  resolvedUrl_lt?: Maybe<Scalars['String']>
-  resolvedUrl_lte?: Maybe<Scalars['String']>
-  resolvedUrl_not_contains?: Maybe<Scalars['String']>
-  resolvedUrl_not_containsInsensitive?: Maybe<Scalars['String']>
-  resolvedUrl_not_endsWith?: Maybe<Scalars['String']>
-  resolvedUrl_not_eq?: Maybe<Scalars['String']>
-  resolvedUrl_not_in?: Maybe<Array<Scalars['String']>>
-  resolvedUrl_not_startsWith?: Maybe<Scalars['String']>
-  resolvedUrl_startsWith?: Maybe<Scalars['String']>
+  resolvedUrls_containsAll?: Maybe<Array<Scalars['String']>>
+  resolvedUrls_containsAny?: Maybe<Array<Scalars['String']>>
+  resolvedUrls_containsNone?: Maybe<Array<Scalars['String']>>
+  resolvedUrls_isNull?: Maybe<Scalars['Boolean']>
   size_eq?: Maybe<Scalars['BigInt']>
   size_gt?: Maybe<Scalars['BigInt']>
   size_gte?: Maybe<Scalars['BigInt']>
@@ -5879,6 +6251,8 @@ export type Subscription = {
   memberships: Array<Membership>
   nftActivities: Array<NftActivity>
   nftActivityById?: Maybe<NftActivity>
+  nftFeaturingRequestById?: Maybe<NftFeaturingRequest>
+  nftFeaturingRequests: Array<NftFeaturingRequest>
   nftHistoryEntries: Array<NftHistoryEntry>
   nftHistoryEntryById?: Maybe<NftHistoryEntry>
   notificationById?: Maybe<Notification>
@@ -6160,6 +6534,17 @@ export type SubscriptionNftActivityByIdArgs = {
   id: Scalars['String']
 }
 
+export type SubscriptionNftFeaturingRequestByIdArgs = {
+  id: Scalars['String']
+}
+
+export type SubscriptionNftFeaturingRequestsArgs = {
+  limit?: Maybe<Scalars['Int']>
+  offset?: Maybe<Scalars['Int']>
+  orderBy?: Maybe<Array<NftFeaturingRequestOrderByInput>>
+  where?: Maybe<NftFeaturingRequestWhereInput>
+}
+
 export type SubscriptionNftHistoryEntriesArgs = {
   limit?: Maybe<Scalars['Int']>
   offset?: Maybe<Scalars['Int']>
@@ -7158,6 +7543,8 @@ export enum VideoOrderByInput {
   ChannelCreatedAtDesc = 'channel_createdAt_DESC',
   ChannelCreatedInBlockAsc = 'channel_createdInBlock_ASC',
   ChannelCreatedInBlockDesc = 'channel_createdInBlock_DESC',
+  ChannelCumulativeRewardClaimedAsc = 'channel_cumulativeRewardClaimed_ASC',
+  ChannelCumulativeRewardClaimedDesc = 'channel_cumulativeRewardClaimed_DESC',
   ChannelDescriptionAsc = 'channel_description_ASC',
   ChannelDescriptionDesc = 'channel_description_DESC',
   ChannelFollowsNumAsc = 'channel_followsNum_ASC',
@@ -7258,8 +7645,6 @@ export enum VideoOrderByInput {
   MediaIpfsHashDesc = 'media_ipfsHash_DESC',
   MediaIsAcceptedAsc = 'media_isAccepted_ASC',
   MediaIsAcceptedDesc = 'media_isAccepted_DESC',
-  MediaResolvedUrlAsc = 'media_resolvedUrl_ASC',
-  MediaResolvedUrlDesc = 'media_resolvedUrl_DESC',
   MediaSizeAsc = 'media_size_ASC',
   MediaSizeDesc = 'media_size_DESC',
   MediaStateBloatBondAsc = 'media_stateBloatBond_ASC',
@@ -7272,6 +7657,8 @@ export enum VideoOrderByInput {
   NftCreatorRoyaltyDesc = 'nft_creatorRoyalty_DESC',
   NftIdAsc = 'nft_id_ASC',
   NftIdDesc = 'nft_id_DESC',
+  NftIsFeaturedAsc = 'nft_isFeatured_ASC',
+  NftIsFeaturedDesc = 'nft_isFeatured_DESC',
   NftLastSaleDateAsc = 'nft_lastSaleDate_ASC',
   NftLastSaleDateDesc = 'nft_lastSaleDate_DESC',
   NftLastSalePriceAsc = 'nft_lastSalePrice_ASC',
@@ -7306,8 +7693,6 @@ export enum VideoOrderByInput {
   ThumbnailPhotoIpfsHashDesc = 'thumbnailPhoto_ipfsHash_DESC',
   ThumbnailPhotoIsAcceptedAsc = 'thumbnailPhoto_isAccepted_ASC',
   ThumbnailPhotoIsAcceptedDesc = 'thumbnailPhoto_isAccepted_DESC',
-  ThumbnailPhotoResolvedUrlAsc = 'thumbnailPhoto_resolvedUrl_ASC',
-  ThumbnailPhotoResolvedUrlDesc = 'thumbnailPhoto_resolvedUrl_DESC',
   ThumbnailPhotoSizeAsc = 'thumbnailPhoto_size_ASC',
   ThumbnailPhotoSizeDesc = 'thumbnailPhoto_size_DESC',
   ThumbnailPhotoStateBloatBondAsc = 'thumbnailPhoto_stateBloatBond_ASC',
@@ -7484,8 +7869,6 @@ export enum VideoSubtitleOrderByInput {
   AssetIpfsHashDesc = 'asset_ipfsHash_DESC',
   AssetIsAcceptedAsc = 'asset_isAccepted_ASC',
   AssetIsAcceptedDesc = 'asset_isAccepted_DESC',
-  AssetResolvedUrlAsc = 'asset_resolvedUrl_ASC',
-  AssetResolvedUrlDesc = 'asset_resolvedUrl_DESC',
   AssetSizeAsc = 'asset_size_ASC',
   AssetSizeDesc = 'asset_size_DESC',
   AssetStateBloatBondAsc = 'asset_stateBloatBond_ASC',

+ 84 - 0
src/tests/v2/queries/atlasQueries/channels.graphql

@@ -139,6 +139,25 @@ query GetChannelNftCollectors(
   }
 }
 
+query GetPayloadDataObjectIdByCommitment($commitment: String!) {
+  # CHANGE: `channelPayoutsUpdatedEvents` replaced with the new `events` query
+  events(
+    where: { data: { isTypeOf_eq: "ChannelPayoutsUpdatedEventData", commitment_eq: $commitment } }
+    limit: 1
+  ) {
+    data {
+      ... on ChannelPayoutsUpdatedEventData {
+        payloadDataObject {
+          id
+          storageBag {
+            id
+          }
+        }
+      }
+    }
+  }
+}
+
 # CHANGE: `ID` is now `String`
 mutation ReportChannel($channelId: String!, $rationale: String!) {
   reportChannel(channelId: $channelId, rationale: $rationale) {
@@ -146,3 +165,68 @@ mutation ReportChannel($channelId: String!, $rationale: String!) {
     channelId
   }
 }
+
+# CHANGE: ID is now `String`
+# CHANGE: Specific event queries replaced with a generic `events` query
+query GetChannelPaymentEvents($ownerMemberId: String!, $channelId: String!) {
+  events(
+    where: {
+      OR: [
+        {
+          AND: [
+            {
+              data: {
+                isTypeOf_in: [
+                  "NftBoughtEventData"
+                  "BidMadeCompletingAuctionEventData"
+                  "EnglishAuctionSettledEventData"
+                  "OpenAuctionBidAcceptedEventData"
+                ]
+              }
+            }
+            {
+              OR: [
+                { data: { previousNftOwner: { member: { id_eq: $ownerMemberId } } } }
+                {
+                  data: {
+                    previousNftOwner: { channel: { ownerMember: { id_eq: $ownerMemberId } } }
+                  }
+                }
+              ]
+            }
+          ]
+        }
+        {
+          data: {
+            isTypeOf_in: ["ChannelRewardClaimedEventData", "ChannelFundsWithdrawnEventData"]
+            channel: { id_eq: $channelId }
+          }
+        }
+      ]
+    }
+  ) {
+    inBlock
+    timestamp
+    data {
+      __typename
+      ... on NftBoughtEventData {
+        price
+      }
+      ... on BidMadeCompletingAuctionEventData {
+        winningBid {
+          amount
+        }
+      }
+      ... on EnglishAuctionSettledEventData {
+        winningBid {
+          amount
+        }
+      }
+      ... on OpenAuctionBidAcceptedEventData {
+        winningBid {
+          amount
+        }
+      }
+    }
+  }
+}

+ 1 - 0
src/tests/v2/queries/atlasQueries/fragments.graphql

@@ -26,6 +26,7 @@ fragment FullChannelFields on Channel {
   description
   isPublic
   isCensored
+  cumulativeRewardClaimed
   language # CHANGE: Language is no longer a separate entity
   ownerMember {
     ...BasicMembershipFields

+ 109 - 61
src/tests/v2/queries/stateQuery.graphql

@@ -99,10 +99,11 @@ fragment StateQueryMetaprotocolTransactionResultFields on MetaprotocolTransactio
       id
     }
   }
-  # TODO: Ephesus
-  # ...on MetaprotocolTransactionResultChannelPaid {
-  #   channelPaid { id }
-  # }
+  ... on MetaprotocolTransactionResultChannelPaid {
+    channelPaid {
+      id
+    }
+  }
   ... on MetaprotocolTransactionResultCommentModerated {
     commentModerated {
       id
@@ -276,45 +277,73 @@ fragment StateQueryEventFields on Event {
         ...StateQueryMetaprotocolTransactionResultFields
       }
     }
-    # TODO: Ephesus
-    # ...on ChannelRewardClaimedEventData {
-    #   channel { id }
-    #   amount
-    # }
-    # 	...on ChannelRewardClaimedAndWithdrawnEventData {
-    #   channel { id }
-    #   amount
-    #   account
-    #   actor { ...StateQueryActorFields }
-    # }
-    # 	...on ChannelFundsWithdrawnEventData {
-    #   channel { id }
-    #   amount
-    #   account
-    #   actor { ...StateQueryActorFields }
-    # }
-    # ...on ChannelPayoutsUpdatedEventData {
-    #   commitment
-    #   payloadDataObject { id }
-    #   minCashoutAllowed
-    #   maxCashoutAllowed
-    #   channelCashoutsEnabled
-    # }
-    # ...on ChannelPaymentMadeEventData {
-    #   payer { id }
-    #   amount
-    #   payeeChannel { id }
-    #   paymentContext {
-    #     __typename
-    #     ...on PaymentContextVideo {
-    #       video { id }
-    #     }
-    #     ...on PaymentContextChannel {
-    #       channel { id }
-    #     }
-    #   }
-    #   rationale
-    # }
+    ... on ChannelRewardClaimedEventData {
+      channel {
+        id
+      }
+      amount
+    }
+    ... on ChannelRewardClaimedAndWithdrawnEventData {
+      channel {
+        id
+      }
+      amount
+      account
+      actor {
+        ...StateQueryActorFields
+      }
+    }
+    ... on ChannelFundsWithdrawnEventData {
+      channel {
+        id
+      }
+      amount
+      account
+      actor {
+        ...StateQueryActorFields
+      }
+    }
+    ... on ChannelPayoutsUpdatedEventData {
+      commitment
+      payloadDataObject {
+        id
+      }
+      minCashoutAllowed
+      maxCashoutAllowed
+      channelCashoutsEnabled
+    }
+    ... on ChannelPaymentMadeEventData {
+      payer {
+        id
+      }
+      amount
+      payeeChannel {
+        id
+      }
+      paymentContext {
+        __typename
+        ... on PaymentContextVideo {
+          video {
+            id
+          }
+        }
+        ... on PaymentContextChannel {
+          channel {
+            id
+          }
+        }
+      }
+      rationale
+    }
+    ... on MemberBannedFromChannelEventData {
+      channel {
+        id
+      }
+      member {
+        id
+      }
+      action
+    }
   }
 }
 
@@ -362,8 +391,7 @@ query StateQueryV2 {
         id
       }
     }
-    # TODO: Ephesus
-    # cumulativeRewardClaimed
+    cumulativeRewardClaimed
     entryApp {
       id
     }
@@ -459,22 +487,42 @@ query StateQueryV2 {
   ) {
     ...StateQueryEventFields
   }
-  # TODO: Ephesus
-  # channelRewardClaimedEvents: events(limit: 9999, where: { data: { isTypeOf_eq: "ChannelRewardClaimedEventData" } }) {
-  #   ...StateQueryEventFields
-  # }
-  # channelRewardClaimedAndWithdrawnEvents: events(limit: 9999, where: { data: { isTypeOf_eq: "ChannelRewardClaimedAndWithdrawnEventData" } }) {
-  #   ...StateQueryEventFields
-  # }
-  # channelFundsWithdrawnEvents: events(limit: 9999, where: { data: { isTypeOf_eq: "ChannelFundsWithdrawnEventData" } }) {
-  #   ...StateQueryEventFields
-  # }
-  # channelPayoutsUpdatedEvents: events(limit: 9999, where: { data: { isTypeOf_eq: "ChannelPayoutsUpdatedEventData" } }) {
-  #   ...StateQueryEventFields
-  # }
-  # channelPaymentMadeEvents: events(limit: 9999, where: { data: { isTypeOf_eq: "ChannelPaymentMadeEventData" } }) {
-  #   ...StateQueryEventFields
-  # }
+  channelRewardClaimedEvents: events(
+    limit: 9999
+    where: { data: { isTypeOf_eq: "ChannelRewardClaimedEventData" } }
+  ) {
+    ...StateQueryEventFields
+  }
+  channelRewardClaimedAndWithdrawnEvents: events(
+    limit: 9999
+    where: { data: { isTypeOf_eq: "ChannelRewardClaimedAndWithdrawnEventData" } }
+  ) {
+    ...StateQueryEventFields
+  }
+  channelFundsWithdrawnEvents: events(
+    limit: 9999
+    where: { data: { isTypeOf_eq: "ChannelFundsWithdrawnEventData" } }
+  ) {
+    ...StateQueryEventFields
+  }
+  channelPayoutsUpdatedEvents: events(
+    limit: 9999
+    where: { data: { isTypeOf_eq: "ChannelPayoutsUpdatedEventData" } }
+  ) {
+    ...StateQueryEventFields
+  }
+  channelPaymentMadeEvents: events(
+    limit: 9999
+    where: { data: { isTypeOf_eq: "ChannelPaymentMadeEventData" } }
+  ) {
+    ...StateQueryEventFields
+  }
+  memberBannedFromChannelEvents: events(
+    limit: 9999
+    where: { data: { isTypeOf_eq: "MemberBannedFromChannelEventData" } }
+  ) {
+    ...StateQueryEventFields
+  }
   memberships(limit: 9999) {
     id
     createdAt

Разница между файлами не показана из-за своего большого размера
+ 466 - 427
src/tests/v2/schema.graphql


+ 129 - 0
src/types/events.ts

@@ -1,6 +1,7 @@
 import assert from 'assert'
 import {Chain, ChainContext, EventContext, Event, Result, Option} from './support'
 import * as v1000 from './v1000'
+import * as v2001 from './v2001'
 
 export class ContentAuctionBidCanceledEvent {
     private readonly _chain: Chain
@@ -232,6 +233,29 @@ export class ContentChannelDeletedByModeratorEvent {
     }
 }
 
+export class ContentChannelFundsWithdrawnEvent {
+    private readonly _chain: Chain
+    private readonly event: Event
+
+    constructor(ctx: EventContext)
+    constructor(ctx: ChainContext, event: Event)
+    constructor(ctx: EventContext, event?: Event) {
+        event = event || ctx.event
+        assert(event.name === 'Content.ChannelFundsWithdrawn')
+        this._chain = ctx._chain
+        this.event = event
+    }
+
+    get isV1000(): boolean {
+        return this._chain.getEventHash('Content.ChannelFundsWithdrawn') === '7dca80457bf01f2cc037aae08e74e23bbe427f74ec7529d9dbd569314f36d7a3'
+    }
+
+    get asV1000(): [v1000.ContentActor, bigint, bigint, v1000.ChannelFundsDestination] {
+        assert(this.isV1000)
+        return this._chain.decodeEvent(this.event)
+    }
+}
+
 export class ContentChannelOwnerRemarkedEvent {
     private readonly _chain: Chain
     private readonly event: Event
@@ -261,6 +285,93 @@ export class ContentChannelOwnerRemarkedEvent {
     }
 }
 
+export class ContentChannelPayoutsUpdatedEvent {
+    private readonly _chain: Chain
+    private readonly event: Event
+
+    constructor(ctx: EventContext)
+    constructor(ctx: ChainContext, event: Event)
+    constructor(ctx: EventContext, event?: Event) {
+        event = event || ctx.event
+        assert(event.name === 'Content.ChannelPayoutsUpdated')
+        this._chain = ctx._chain
+        this.event = event
+    }
+
+    get isV1000(): boolean {
+        return this._chain.getEventHash('Content.ChannelPayoutsUpdated') === '43f24894d83a34bdba24e7c8b702850c31fdfd305d0c16c1422595219a8036ad'
+    }
+
+    get asV1000(): [v1000.UpdateChannelPayoutsParametersRecord, (bigint | undefined)] {
+        assert(this.isV1000)
+        return this._chain.decodeEvent(this.event)
+    }
+
+    get isV2001(): boolean {
+        return this._chain.getEventHash('Content.ChannelPayoutsUpdated') === '6567c63f09efa37dc8a93882508851cb70d29e50fe45f52683626235bf1ca4b7'
+    }
+
+    get asV2001(): [v2001.UpdateChannelPayoutsParametersRecord, (bigint | undefined), Uint8Array] {
+        assert(this.isV2001)
+        return this._chain.decodeEvent(this.event)
+    }
+}
+
+export class ContentChannelRewardClaimedAndWithdrawnEvent {
+    private readonly _chain: Chain
+    private readonly event: Event
+
+    constructor(ctx: EventContext)
+    constructor(ctx: ChainContext, event: Event)
+    constructor(ctx: EventContext, event?: Event) {
+        event = event || ctx.event
+        assert(event.name === 'Content.ChannelRewardClaimedAndWithdrawn')
+        this._chain = ctx._chain
+        this.event = event
+    }
+
+    get isV1000(): boolean {
+        return this._chain.getEventHash('Content.ChannelRewardClaimedAndWithdrawn') === '7dca80457bf01f2cc037aae08e74e23bbe427f74ec7529d9dbd569314f36d7a3'
+    }
+
+    get asV1000(): [v1000.ContentActor, bigint, bigint, v1000.ChannelFundsDestination] {
+        assert(this.isV1000)
+        return this._chain.decodeEvent(this.event)
+    }
+}
+
+export class ContentChannelRewardUpdatedEvent {
+    private readonly _chain: Chain
+    private readonly event: Event
+
+    constructor(ctx: EventContext)
+    constructor(ctx: ChainContext, event: Event)
+    constructor(ctx: EventContext, event?: Event) {
+        event = event || ctx.event
+        assert(event.name === 'Content.ChannelRewardUpdated')
+        this._chain = ctx._chain
+        this.event = event
+    }
+
+    get isV1000(): boolean {
+        return this._chain.getEventHash('Content.ChannelRewardUpdated') === '2bd477437892e2d50fa06bf72436226e2c75b8369c9a637d70237478ef09abe2'
+    }
+
+    get asV1000(): [bigint, bigint] {
+        assert(this.isV1000)
+        return this._chain.decodeEvent(this.event)
+    }
+
+    get isV2001(): boolean {
+        return this._chain.getEventHash('Content.ChannelRewardUpdated') === '2cb4802d5a072bd911a6f8ed2359f802db328fdf5e5f157925b0871831b3193c'
+    }
+
+    get asV2001(): [bigint, bigint, bigint] {
+        assert(this.isV2001)
+        return this._chain.decodeEvent(this.event)
+    }
+}
+
 export class ContentChannelUpdatedEvent {
     private readonly _chain: Chain
     private readonly event: Event
@@ -742,6 +853,15 @@ export class MembersMemberInvitedEvent {
         assert(this.isV1000)
         return this._chain.decodeEvent(this.event)
     }
+
+    get isV2001(): boolean {
+        return this._chain.getEventHash('Members.MemberInvited') === '2f40067e3af4b48461e4507b5e8d3f2cda085bea2ea03ea8114789c0589accfe'
+    }
+
+    get asV2001(): [bigint, v2001.InviteMembershipParameters, bigint] {
+        assert(this.isV2001)
+        return this._chain.decodeEvent(this.event)
+    }
 }
 
 export class MembersMemberProfileUpdatedEvent {
@@ -788,6 +908,15 @@ export class MembersMemberRemarkedEvent {
         assert(this.isV1000)
         return this._chain.decodeEvent(this.event)
     }
+
+    get isV2001(): boolean {
+        return this._chain.getEventHash('Members.MemberRemarked') === '800e11437fa752c6c57a4245f54183c0c5c445b438324a6d5c2f2272b4bd0e2a'
+    }
+
+    get asV2001(): [bigint, Uint8Array, ([Uint8Array, bigint] | undefined)] {
+        assert(this.isV2001)
+        return this._chain.decodeEvent(this.event)
+    }
 }
 
 export class MembersMembershipBoughtEvent {

+ 26 - 0
src/types/v1000.ts

@@ -43,6 +43,25 @@ export interface ChannelCreationParametersRecord {
     expectedDataObjectStateBloatBond: bigint
 }
 
+export type ChannelFundsDestination = ChannelFundsDestination_AccountId | ChannelFundsDestination_CouncilBudget
+
+export interface ChannelFundsDestination_AccountId {
+    __kind: 'AccountId'
+    value: Uint8Array
+}
+
+export interface ChannelFundsDestination_CouncilBudget {
+    __kind: 'CouncilBudget'
+}
+
+export interface UpdateChannelPayoutsParametersRecord {
+    commitment: (Uint8Array | undefined)
+    payload: (ChannelPayoutsPayloadParametersRecord | undefined)
+    minCashoutAllowed: (bigint | undefined)
+    maxCashoutAllowed: (bigint | undefined)
+    channelCashoutsEnabled: (boolean | undefined)
+}
+
 export interface ChannelUpdateParametersRecord {
     assetsToUpload: (StorageAssetsRecord | undefined)
     newMeta: (Uint8Array | undefined)
@@ -343,6 +362,13 @@ export interface StorageAssetsRecord {
     expectedDataSizeFee: bigint
 }
 
+export interface ChannelPayoutsPayloadParametersRecord {
+    uploaderAccount: Uint8Array
+    objectCreationParams: DataObjectCreationParameters
+    expectedDataSizeFee: bigint
+    expectedDataObjectStateBloatBond: bigint
+}
+
 export type InitTransactionalStatusRecord = InitTransactionalStatusRecord_Idle | InitTransactionalStatusRecord_BuyNow | InitTransactionalStatusRecord_InitiatedOfferToMember | InitTransactionalStatusRecord_EnglishAuction | InitTransactionalStatusRecord_OpenAuction
 
 export interface InitTransactionalStatusRecord_Idle {

+ 28 - 0
src/types/v2001.ts

@@ -0,0 +1,28 @@
+import type {Result, Option} from './support'
+
+export interface UpdateChannelPayoutsParametersRecord {
+    commitment: (Uint8Array | undefined)
+    payload: (ChannelPayoutsPayloadParametersRecord | undefined)
+    minCashoutAllowed: (bigint | undefined)
+    maxCashoutAllowed: (bigint | undefined)
+    channelCashoutsEnabled: (boolean | undefined)
+}
+
+export interface InviteMembershipParameters {
+    invitingMemberId: bigint
+    rootAccount: Uint8Array
+    controllerAccount: Uint8Array
+    handle: (Uint8Array | undefined)
+    metadata: Uint8Array
+}
+
+export interface ChannelPayoutsPayloadParametersRecord {
+    objectCreationParams: DataObjectCreationParameters
+    expectedDataSizeFee: bigint
+    expectedDataObjectStateBloatBond: bigint
+}
+
+export interface DataObjectCreationParameters {
+    size: bigint
+    ipfsContentId: Uint8Array
+}

+ 8 - 0
src/utils/events.ts

@@ -29,6 +29,10 @@ import {
   ContentBuyNowCanceledEvent,
   ContentBuyNowPriceUpdatedEvent,
   ContentNftSlingedBackToTheOriginalArtistEvent,
+  ContentChannelPayoutsUpdatedEvent,
+  ContentChannelRewardUpdatedEvent,
+  ContentChannelFundsWithdrawnEvent,
+  ContentChannelRewardClaimedAndWithdrawnEvent,
   StorageStorageBucketCreatedEvent,
   StorageDynamicBagCreatedEvent,
   StorageDataObjectsUploadedEvent,
@@ -100,6 +104,10 @@ export const eventConstructors = {
   'Content.BuyNowCanceled': ContentBuyNowCanceledEvent,
   'Content.BuyNowPriceUpdated': ContentBuyNowPriceUpdatedEvent,
   'Content.NftSlingedBackToTheOriginalArtist': ContentNftSlingedBackToTheOriginalArtistEvent,
+  'Content.ChannelPayoutsUpdated': ContentChannelPayoutsUpdatedEvent,
+  'Content.ChannelRewardUpdated': ContentChannelRewardUpdatedEvent,
+  'Content.ChannelFundsWithdrawn': ContentChannelFundsWithdrawnEvent,
+  'Content.ChannelRewardClaimedAndWithdrawn': ContentChannelRewardClaimedAndWithdrawnEvent,
   'Storage.StorageBucketCreated': StorageStorageBucketCreatedEvent,
   'Storage.StorageBucketInvitationAccepted': StorageStorageBucketInvitationAcceptedEvent,
   'Storage.StorageBucketsUpdatedForBag': StorageStorageBucketsUpdatedForBagEvent,

+ 4 - 0
typegen.json

@@ -31,6 +31,10 @@
     "Content.BuyNowCanceled",
     "Content.BuyNowPriceUpdated",
     "Content.NftSlingedBackToTheOriginalArtist",
+    "Content.ChannelPayoutsUpdated",
+    "Content.ChannelRewardUpdated",
+    "Content.ChannelFundsWithdrawn",
+    "Content.ChannelRewardClaimedAndWithdrawn",
     "Storage.StorageBucketCreated",
     "Storage.StorageBucketInvitationAccepted",
     "Storage.StorageBucketsUpdatedForBag",

Некоторые файлы не были показаны из-за большого количества измененных файлов