From 461a293d2bfe861bc76d4f0ad5f5bcfe8b78797f Mon Sep 17 00:00:00 2001 From: Cesare Naldi Date: Fri, 22 Mar 2024 13:36:19 +0100 Subject: [PATCH 1/8] Support Unknown Reference Module --- .../use-cases/publications/CreateComment.ts | 30 ++++------------- .../use-cases/publications/CreateMirror.ts | 7 +++- .../src/use-cases/publications/CreateQuote.ts | 32 ++++--------------- .../src/use-cases/publications/OpenAction.ts | 4 +-- .../publications/ReferencePolicyConfig.ts | 20 +++++++++++- .../src/use-cases/publications/Referrers.ts | 3 ++ .../src/use-cases/publications/index.ts | 1 + .../adapters/OpenActionGateway.ts | 24 +++----------- .../CreateOnChainCommentGateway.ts | 5 ++- .../CreateOnChainMirrorGateway.ts | 3 ++ .../publications/CreateOnChainQuoteGateway.ts | 3 ++ .../resolveReferenceModuleInput.ts | 8 +++++ .../src/transactions/adapters/referrals.ts | 17 ++++++++++ .../adapters/schemas/publications.ts | 21 ++++++++++-- .../publications/useCreateComment.ts | 14 ++++++++ .../publications/useCreateMirror.ts | 14 ++++++++ .../publications/useCreateQuote.ts | 14 ++++++++ 17 files changed, 142 insertions(+), 78 deletions(-) create mode 100644 packages/domain/src/use-cases/publications/Referrers.ts create mode 100644 packages/react/src/transactions/adapters/referrals.ts diff --git a/packages/domain/src/use-cases/publications/CreateComment.ts b/packages/domain/src/use-cases/publications/CreateComment.ts index 6b2bd3d41b..4e18032f80 100644 --- a/packages/domain/src/use-cases/publications/CreateComment.ts +++ b/packages/domain/src/use-cases/publications/CreateComment.ts @@ -1,4 +1,4 @@ -import { URI } from '@lens-protocol/shared-kernel'; +import { Data, URI } from '@lens-protocol/shared-kernel'; import { isMomokaPublicationId, PublicationId, TransactionKind } from '../../entities'; import { DelegableSigning } from '../transactions/DelegableSigning'; @@ -6,35 +6,17 @@ import { PaidTransaction } from '../transactions/PaidTransaction'; import { SponsorshipReady } from '../transactions/SponsorshipReady'; import { OpenActionConfig } from './OpenActionConfig'; import { ReferencePolicyConfig, ReferencePolicyType } from './ReferencePolicyConfig'; +import { Referrers } from './Referrers'; export type CreateCommentRequest = { - /** - * The discriminator for the transaction kind. - */ kind: TransactionKind.CREATE_COMMENT; - /** - * Whether is possible to delegate the publication signing to the profile's chosen profile manager. - */ - signless: boolean; - /** - * The publication ID to comment on. - */ + actions: OpenActionConfig[]; commentOn: PublicationId; - /** - * The metadata URI. - */ + commentOnReferenceData?: Data; metadata: URI; - /** - * The Open Actions associated with the publication. - */ - actions: OpenActionConfig[]; - /** - * The post reference policy. - */ reference: ReferencePolicyConfig; - /** - * Whether the transaction costs should be sponsored by the Lens API or not. - */ + referrers?: Referrers; + signless: boolean; sponsored: boolean; }; diff --git a/packages/domain/src/use-cases/publications/CreateMirror.ts b/packages/domain/src/use-cases/publications/CreateMirror.ts index 0a64152f12..2c88f95dd5 100644 --- a/packages/domain/src/use-cases/publications/CreateMirror.ts +++ b/packages/domain/src/use-cases/publications/CreateMirror.ts @@ -1,11 +1,16 @@ +import { Data } from '@lens-protocol/shared-kernel'; + import { isMomokaPublicationId, PublicationId, TransactionKind } from '../../entities'; import { DelegableSigning } from '../transactions/DelegableSigning'; import { PaidTransaction } from '../transactions/PaidTransaction'; import { SponsorshipReady } from '../transactions/SponsorshipReady'; +import { Referrers } from './Referrers'; export type CreateMirrorRequest = { - mirrorOn: PublicationId; kind: TransactionKind.MIRROR_PUBLICATION; + mirrorOn: PublicationId; + mirrorOnReferenceData?: Data; + referrers?: Referrers; signless: boolean; sponsored: boolean; }; diff --git a/packages/domain/src/use-cases/publications/CreateQuote.ts b/packages/domain/src/use-cases/publications/CreateQuote.ts index 2590dcaaeb..bdb5a4b0e5 100644 --- a/packages/domain/src/use-cases/publications/CreateQuote.ts +++ b/packages/domain/src/use-cases/publications/CreateQuote.ts @@ -1,4 +1,4 @@ -import { URI } from '@lens-protocol/shared-kernel'; +import { Data, URI } from '@lens-protocol/shared-kernel'; import { PublicationId, TransactionKind, isMomokaPublicationId } from '../../entities'; import { DelegableSigning } from '../transactions/DelegableSigning'; @@ -6,35 +6,17 @@ import { PaidTransaction } from '../transactions/PaidTransaction'; import { SponsorshipReady } from '../transactions/SponsorshipReady'; import { OpenActionConfig } from './OpenActionConfig'; import { ReferencePolicyConfig, ReferencePolicyType } from './ReferencePolicyConfig'; +import { Referrers } from './Referrers'; export type CreateQuoteRequest = { - /** - * The discriminator for the transaction kind. - */ kind: TransactionKind.CREATE_QUOTE; - /** - * Whether is possible to delegate the publication signing to the profile's chosen profile manager. - */ - signless: boolean; - /** - * The publication ID that is being quoted. - */ - quoteOn: PublicationId; - /** - * The metadata URI. - */ - metadata: URI; - /** - * The Open Actions associated with the publication. - */ actions: OpenActionConfig[]; - /** - * The post reference policy. - */ + metadata: URI; + quoteOn: PublicationId; + quoteOnReferenceData?: Data; + referrers?: Referrers; reference: ReferencePolicyConfig; - /** - * Whether the transaction costs should be sponsored by the Lens API or not. - */ + signless: boolean; sponsored: boolean; }; diff --git a/packages/domain/src/use-cases/publications/OpenAction.ts b/packages/domain/src/use-cases/publications/OpenAction.ts index 8a7f9fafc6..b715782f1b 100644 --- a/packages/domain/src/use-cases/publications/OpenAction.ts +++ b/packages/domain/src/use-cases/publications/OpenAction.ts @@ -5,7 +5,6 @@ import { PendingSigningRequestError, UserRejectedError, WalletConnectionError, - ProfileId, PublicationId, } from '../../entities'; import { DelegableSigning } from '../transactions/DelegableSigning'; @@ -18,6 +17,7 @@ import { InsufficientFundsError, TokenAvailability, } from '../wallets/TokenAvailability'; +import { Referrers } from './Referrers'; export enum AllOpenActionType { LEGACY_COLLECT = 'LEGACY_COLLECT', @@ -42,8 +42,6 @@ export type LegacyCollectRequest = { fee?: CollectFee; }; -export type Referrers = ReadonlyArray; - export type MultirecipientCollectRequest = { kind: TransactionKind.ACT_ON_PUBLICATION; type: AllOpenActionType.MULTIRECIPIENT_COLLECT; diff --git a/packages/domain/src/use-cases/publications/ReferencePolicyConfig.ts b/packages/domain/src/use-cases/publications/ReferencePolicyConfig.ts index 516580e091..b7cafc1eb8 100644 --- a/packages/domain/src/use-cases/publications/ReferencePolicyConfig.ts +++ b/packages/domain/src/use-cases/publications/ReferencePolicyConfig.ts @@ -1,3 +1,5 @@ +import { Data, EvmAddress } from '@lens-protocol/shared-kernel'; + import { ProfileId } from '../../entities'; export enum ReferencePolicyType { @@ -48,8 +50,24 @@ export type AnyoneReferencePolicyConfig = { type: ReferencePolicyType.ANYONE; }; +export type UnknownReferencePolicyConfig = { + type: ReferencePolicyType.UNKNOWN; + /** + * The address of the Unknown Reference module contract. + */ + address: EvmAddress; + /** + * The data to initialize the Unknown Reference module contract logic + * for the given publication. + * + * It's consumer responsibility to encode it correctly. + */ + data: Data; +}; + export type ReferencePolicyConfig = | FollowersOnlyReferencePolicyConfig | DegreesOfSeparationReferencePolicyConfig | NoReferencePolicyConfig - | AnyoneReferencePolicyConfig; + | AnyoneReferencePolicyConfig + | UnknownReferencePolicyConfig; diff --git a/packages/domain/src/use-cases/publications/Referrers.ts b/packages/domain/src/use-cases/publications/Referrers.ts new file mode 100644 index 0000000000..e1a3460fa1 --- /dev/null +++ b/packages/domain/src/use-cases/publications/Referrers.ts @@ -0,0 +1,3 @@ +import { ProfileId, PublicationId } from '../../entities'; + +export type Referrers = ReadonlyArray; diff --git a/packages/domain/src/use-cases/publications/index.ts b/packages/domain/src/use-cases/publications/index.ts index 7d38695ed8..888f843e92 100644 --- a/packages/domain/src/use-cases/publications/index.ts +++ b/packages/domain/src/use-cases/publications/index.ts @@ -6,5 +6,6 @@ export * from './HidePublication'; export * from './OpenAction'; export * from './OpenActionConfig'; export * from './ReferencePolicyConfig'; +export * from './Referrers'; export * from './ReportPublication'; export * from './TogglePublicationProperty'; diff --git a/packages/react/src/transactions/adapters/OpenActionGateway.ts b/packages/react/src/transactions/adapters/OpenActionGateway.ts index f82346b079..dc0b4bb736 100644 --- a/packages/react/src/transactions/adapters/OpenActionGateway.ts +++ b/packages/react/src/transactions/adapters/OpenActionGateway.ts @@ -8,7 +8,6 @@ import { LegacyCollectVariables, RelaySuccess, SafeApolloClient, - isPublicationId, omitTypename, } from '@lens-protocol/api-bindings'; import { lensHub, publicActProxy } from '@lens-protocol/blockchain-bindings'; @@ -19,7 +18,6 @@ import { LegacyCollectRequest, MultirecipientCollectRequest, OpenActionRequest, - Referrers, SimpleCollectRequest, UnknownActionRequest, } from '@lens-protocol/domain/use-cases/publications'; @@ -36,6 +34,7 @@ import { UnsignedProtocolCall } from '../../wallet/adapters/ConcreteWallet'; import { IProviderFactory } from '../../wallet/adapters/IProviderFactory'; import { AbstractContractCallGateway, ContractCallDetails } from './AbstractContractCallGateway'; import { ITransactionFactory } from './ITransactionFactory'; +import { resolveOnchainReferrers } from './referrals'; import { handleRelayError } from './relayer'; type NewOpenActionRequest = @@ -196,7 +195,7 @@ export class OpenActionGateway actOn: { simpleCollectOpenAction: true, }, - referrers: this.resolveOnchainReferrers(request.referrers), + referrers: resolveOnchainReferrers(request.referrers), }; case AllOpenActionType.MULTIRECIPIENT_COLLECT: return { @@ -204,7 +203,7 @@ export class OpenActionGateway actOn: { multirecipientCollectOpenAction: true, }, - referrers: this.resolveOnchainReferrers(request.referrers), + referrers: resolveOnchainReferrers(request.referrers), }; case AllOpenActionType.UNKNOWN_OPEN_ACTION: return { @@ -215,26 +214,11 @@ export class OpenActionGateway data: request.data, }, }, - referrers: this.resolveOnchainReferrers(request.referrers), + referrers: resolveOnchainReferrers(request.referrers), }; } } - private resolveOnchainReferrers( - referrers: Referrers | undefined, - ): gql.OnchainReferrer[] | undefined { - return referrers?.map((value) => { - if (isPublicationId(value)) { - return { - publicationId: value, - }; - } - return { - profileId: value, - }; - }); - } - private async createLegacyCollectTypedData( request: gql.LegacyCollectRequest, nonce?: Nonce, diff --git a/packages/react/src/transactions/adapters/publications/CreateOnChainCommentGateway.ts b/packages/react/src/transactions/adapters/publications/CreateOnChainCommentGateway.ts index 9875e569dd..b3d7ad12fd 100644 --- a/packages/react/src/transactions/adapters/publications/CreateOnChainCommentGateway.ts +++ b/packages/react/src/transactions/adapters/publications/CreateOnChainCommentGateway.ts @@ -27,6 +27,7 @@ import { UnsignedProtocolCall } from '../../../wallet/adapters/ConcreteWallet'; import { IProviderFactory } from '../../../wallet/adapters/IProviderFactory'; import { AbstractContractCallGateway, ContractCallDetails } from '../AbstractContractCallGateway'; import { ITransactionFactory } from '../ITransactionFactory'; +import { resolveOnchainReferrers } from '../referrals'; import { handleRelayError } from '../relayer'; import { resolveOpenActionModuleInput } from './resolveOpenActionModuleInput'; import { resolveReferenceModuleInput } from './resolveReferenceModuleInput'; @@ -149,10 +150,12 @@ export class CreateOnChainCommentGateway private resolveOnchainCommentRequest(request: CreateCommentRequest): OnchainCommentRequest { return { - contentURI: request.metadata, commentOn: request.commentOn, + commentOnReferenceModuleData: request.commentOnReferenceData, + contentURI: request.metadata, openActionModules: request.actions?.map(resolveOpenActionModuleInput), referenceModule: request.reference && resolveReferenceModuleInput(request.reference), + referrers: resolveOnchainReferrers(request.referrers), }; } } diff --git a/packages/react/src/transactions/adapters/publications/CreateOnChainMirrorGateway.ts b/packages/react/src/transactions/adapters/publications/CreateOnChainMirrorGateway.ts index 64a566ff7f..2356a3778b 100644 --- a/packages/react/src/transactions/adapters/publications/CreateOnChainMirrorGateway.ts +++ b/packages/react/src/transactions/adapters/publications/CreateOnChainMirrorGateway.ts @@ -27,6 +27,7 @@ import { UnsignedProtocolCall } from '../../../wallet/adapters/ConcreteWallet'; import { IProviderFactory } from '../../../wallet/adapters/IProviderFactory'; import { AbstractContractCallGateway, ContractCallDetails } from '../AbstractContractCallGateway'; import { ITransactionFactory } from '../ITransactionFactory'; +import { resolveOnchainReferrers } from '../referrals'; import { handleRelayError } from '../relayer'; export class CreateOnChainMirrorGateway @@ -144,6 +145,8 @@ export class CreateOnChainMirrorGateway private resolveOnchainMirrorRequest(request: CreateMirrorRequest): OnchainMirrorRequest { return { mirrorOn: request.mirrorOn, + mirrorReferenceModuleData: request.mirrorOnReferenceData, + referrers: resolveOnchainReferrers(request.referrers), }; } } diff --git a/packages/react/src/transactions/adapters/publications/CreateOnChainQuoteGateway.ts b/packages/react/src/transactions/adapters/publications/CreateOnChainQuoteGateway.ts index 6a23ea5032..76d624888c 100644 --- a/packages/react/src/transactions/adapters/publications/CreateOnChainQuoteGateway.ts +++ b/packages/react/src/transactions/adapters/publications/CreateOnChainQuoteGateway.ts @@ -27,6 +27,7 @@ import { UnsignedProtocolCall } from '../../../wallet/adapters/ConcreteWallet'; import { IProviderFactory } from '../../../wallet/adapters/IProviderFactory'; import { AbstractContractCallGateway, ContractCallDetails } from '../AbstractContractCallGateway'; import { ITransactionFactory } from '../ITransactionFactory'; +import { resolveOnchainReferrers } from '../referrals'; import { handleRelayError } from '../relayer'; import { resolveOpenActionModuleInput } from './resolveOpenActionModuleInput'; import { resolveReferenceModuleInput } from './resolveReferenceModuleInput'; @@ -151,8 +152,10 @@ export class CreateOnChainQuoteGateway return { contentURI: request.metadata, quoteOn: request.quoteOn, + quoteOnReferenceModuleData: request.quoteOnReferenceData, openActionModules: request.actions?.map(resolveOpenActionModuleInput), referenceModule: request.reference && resolveReferenceModuleInput(request.reference), + referrers: resolveOnchainReferrers(request.referrers), }; } } diff --git a/packages/react/src/transactions/adapters/publications/resolveReferenceModuleInput.ts b/packages/react/src/transactions/adapters/publications/resolveReferenceModuleInput.ts index d8a92943d2..44b9920181 100644 --- a/packages/react/src/transactions/adapters/publications/resolveReferenceModuleInput.ts +++ b/packages/react/src/transactions/adapters/publications/resolveReferenceModuleInput.ts @@ -27,6 +27,14 @@ export function resolveReferenceModuleInput( quotesRestricted: false, }, }; + + case ReferencePolicyType.UNKNOWN: + return { + unknownReferenceModule: { + address: config.address, + data: config.data, + }, + }; } return undefined; diff --git a/packages/react/src/transactions/adapters/referrals.ts b/packages/react/src/transactions/adapters/referrals.ts new file mode 100644 index 0000000000..f485b118e3 --- /dev/null +++ b/packages/react/src/transactions/adapters/referrals.ts @@ -0,0 +1,17 @@ +import { OnchainReferrer, isPublicationId } from '@lens-protocol/api-bindings'; +import { Referrers } from '@lens-protocol/domain/use-cases/publications'; + +export function resolveOnchainReferrers( + referrers: Referrers | undefined, +): OnchainReferrer[] | undefined { + return referrers?.map((value) => { + if (isPublicationId(value)) { + return { + publicationId: value, + }; + } + return { + profileId: value, + }; + }); +} diff --git a/packages/react/src/transactions/adapters/schemas/publications.ts b/packages/react/src/transactions/adapters/schemas/publications.ts index 91f6609f14..f102d813f0 100644 --- a/packages/react/src/transactions/adapters/schemas/publications.ts +++ b/packages/react/src/transactions/adapters/schemas/publications.ts @@ -23,6 +23,8 @@ import { DataSchema, } from './common'; +const ReferrersSchema = z.union([PublicationIdSchema, ProfileIdSchema]).array().min(1); + const RecipientWithSplitSchema: z.ZodType = z.object({ recipient: EvmAddressSchema, @@ -96,11 +98,18 @@ const NoReferencePolicyConfigSchema = z.object({ type: z.literal(ReferencePolicyType.NO_ONE), }); +const UnknownReferencePolicyConfigSchema = z.object({ + type: z.literal(ReferencePolicyType.UNKNOWN), + address: EvmAddressSchema, + data: DataSchema, +}); + const ReferencePolicyConfigSchema = z.discriminatedUnion('type', [ AnyoneReferencePolicyConfigSchema, DegreesOfSeparationReferencePolicyConfigSchema, FollowersOnlyReferencePolicyConfigSchema, NoReferencePolicyConfigSchema, + UnknownReferencePolicyConfigSchema, ]); export const CreatePostRequestSchema: z.ZodType = @@ -123,6 +132,8 @@ export const CreateCommentRequestSchema: z.ZodType< sponsored: z.boolean(), metadata: UriSchema, commentOn: PublicationIdSchema, + commentOnReferenceData: DataSchema.optional(), + referrers: ReferrersSchema.optional(), reference: ReferencePolicyConfigSchema.default({ type: ReferencePolicyType.ANYONE }), actions: OpenActionConfigSchema.array().default([]), }); @@ -134,6 +145,8 @@ export const CreateQuoteRequestSchema: z.ZodType = z.object({ mirrorOn: PublicationIdSchema, + mirrorOnReferenceData: DataSchema.optional(), + referrers: ReferrersSchema.optional(), kind: z.literal(TransactionKind.MIRROR_PUBLICATION), signless: z.boolean(), sponsored: z.boolean(), @@ -172,7 +187,7 @@ export const LegacyCollectRequestSchema = BaseCollectRequestSchema.extend({ export const SimpleCollectRequestSchema = BaseCollectRequestSchema.extend({ type: z.literal(AllOpenActionType.SIMPLE_COLLECT), publicationId: PublicationIdSchema, - referrers: z.union([PublicationIdSchema, ProfileIdSchema]).array().min(1).optional(), + referrers: ReferrersSchema.optional(), fee: CollectFeeSchema.optional(), public: z.boolean(), signless: z.boolean(), @@ -182,7 +197,7 @@ export const SimpleCollectRequestSchema = BaseCollectRequestSchema.extend({ export const MultirecipientCollectRequestSchema = BaseCollectRequestSchema.extend({ type: z.literal(AllOpenActionType.MULTIRECIPIENT_COLLECT), publicationId: PublicationIdSchema, - referrers: z.union([PublicationIdSchema, ProfileIdSchema]).array().min(1).optional(), + referrers: ReferrersSchema.optional(), fee: CollectFeeSchema, public: z.boolean(), signless: z.boolean(), @@ -194,7 +209,7 @@ export const UnknownActionRequestSchema = BaseCollectRequestSchema.extend({ publicationId: PublicationIdSchema, address: EvmAddressSchema, data: DataSchema, - referrers: z.union([PublicationIdSchema, ProfileIdSchema]).array().min(1).optional(), + referrers: ReferrersSchema.optional(), public: z.boolean(), signless: z.boolean(), sponsored: z.boolean(), diff --git a/packages/react/src/transactions/publications/useCreateComment.ts b/packages/react/src/transactions/publications/useCreateComment.ts index 7033e23c4d..dea5db3c2c 100644 --- a/packages/react/src/transactions/publications/useCreateComment.ts +++ b/packages/react/src/transactions/publications/useCreateComment.ts @@ -9,6 +9,7 @@ import { import { OpenActionConfig, ReferencePolicyConfig, + Referrers, } from '@lens-protocol/domain/use-cases/publications'; import { BroadcastingError } from '@lens-protocol/domain/use-cases/transactions'; import { invariant } from '@lens-protocol/shared-kernel'; @@ -35,6 +36,19 @@ export type CreateCommentArgs = { * The publication ID to comment on. */ commentOn: PublicationId; + /** + * Use this if the target publication is configured with an Unknown Reference Module + * that requires a calldata to process the reference logic. + * + * It's consumer responsibility to encode it correctly. + */ + commentOnReferenceCalldata?: string; + /** + * The referrers list for any Unknown Reference Module logic. + * + * It can be a list of Publication IDs or Profile IDs. + */ + referrers?: Referrers; /** * The metadata URI. */ diff --git a/packages/react/src/transactions/publications/useCreateMirror.ts b/packages/react/src/transactions/publications/useCreateMirror.ts index e059606c94..9cae3d98c6 100644 --- a/packages/react/src/transactions/publications/useCreateMirror.ts +++ b/packages/react/src/transactions/publications/useCreateMirror.ts @@ -6,6 +6,7 @@ import { UserRejectedError, WalletConnectionError, } from '@lens-protocol/domain/entities'; +import { Referrers } from '@lens-protocol/domain/use-cases/publications'; import { BroadcastingError } from '@lens-protocol/domain/use-cases/transactions'; import { invariant } from '@lens-protocol/shared-kernel'; @@ -31,6 +32,19 @@ export type CreateMirrorArgs = { * The publication ID to mirror. */ mirrorOn: PublicationId; + /** + * Use this if the mirrored publication is configured with an Unknown Reference Module + * that requires a calldata to process the reference logic. + * + * It's consumer responsibility to encode it correctly. + */ + mirrorOnReferenceData?: string; + /** + * The referrers list for any Unknown Reference Module logic. + * + * It can be a list of Publication IDs or Profile IDs. + */ + referrers?: Referrers; /** * Whether the transaction costs should be sponsored by the Lens API or * should be paid by the authenticated wallet. diff --git a/packages/react/src/transactions/publications/useCreateQuote.ts b/packages/react/src/transactions/publications/useCreateQuote.ts index fa80a2f1f3..02f80c9924 100644 --- a/packages/react/src/transactions/publications/useCreateQuote.ts +++ b/packages/react/src/transactions/publications/useCreateQuote.ts @@ -9,6 +9,7 @@ import { import { OpenActionConfig, ReferencePolicyConfig, + Referrers, } from '@lens-protocol/domain/use-cases/publications'; import { BroadcastingError } from '@lens-protocol/domain/use-cases/transactions'; import { invariant } from '@lens-protocol/shared-kernel'; @@ -35,6 +36,19 @@ export type CreateQuoteArgs = { * The publication ID to quote on. */ quoteOn: PublicationId; + /** + * Use this if the target publication is configured with an Unknown Reference Module + * that requires a calldata to process the reference logic. + * + * It's consumer responsibility to encode it correctly. + */ + quoteOnReferenceData?: string; + /** + * The referrers list for any Unknown Reference Module logic. + * + * It can be a list of Publication IDs or Profile IDs. + */ + referrers?: Referrers; /** * The metadata URI. */ From 2bc6e28959ff23a6aa292c3521cc8d0d61db1f75 Mon Sep 17 00:00:00 2001 From: Cesare Naldi Date: Fri, 22 Mar 2024 16:10:03 +0100 Subject: [PATCH 2/8] Fix tsdoc --- .../react/src/transactions/publications/useCreateComment.ts | 4 ++-- .../react/src/transactions/publications/useCreateMirror.ts | 4 ++-- packages/react/src/transactions/publications/useCreatePost.ts | 4 ++-- .../react/src/transactions/publications/useCreateQuote.ts | 4 ++-- .../src/transactions/publications/useOptimisticCreatePost.ts | 4 ++-- packages/react/src/transactions/useBlockProfiles.ts | 4 ++-- packages/react/src/transactions/useFollow.ts | 4 ++-- packages/react/src/transactions/useLinkHandle.ts | 4 ++-- packages/react/src/transactions/useOpenAction/types.ts | 4 ++-- packages/react/src/transactions/useSetProfileMetadata.ts | 4 ++-- packages/react/src/transactions/useUnblockProfiles.ts | 4 ++-- packages/react/src/transactions/useUnfollow.ts | 4 ++-- packages/react/src/transactions/useUnlinkHandle.ts | 4 ++-- packages/react/src/transactions/useUpdateFollowPolicy.ts | 4 ++-- packages/react/src/transactions/useUpdateProfileManagers.ts | 4 ++-- 15 files changed, 30 insertions(+), 30 deletions(-) diff --git a/packages/react/src/transactions/publications/useCreateComment.ts b/packages/react/src/transactions/publications/useCreateComment.ts index dea5db3c2c..f1276ee701 100644 --- a/packages/react/src/transactions/publications/useCreateComment.ts +++ b/packages/react/src/transactions/publications/useCreateComment.ts @@ -77,8 +77,8 @@ export type CreateCommentArgs = { * - {@link BroadcastingErrorReason.RATE_LIMITED} - the profile reached the rate limit * - {@link BroadcastingErrorReason.APP_NOT_ALLOWED} - the app is not whitelisted for gasless transactions * - * If not specified, or `true`, the hook will attempt a Signless Experience when possible; - * otherwise, it will fall back to a signed experience. + * If not specified, or `true`, the hook will attempt a Sponsored Transaction. + * Set it to `false` to force it to use a Self-Funded Transaction. */ sponsored?: boolean; }; diff --git a/packages/react/src/transactions/publications/useCreateMirror.ts b/packages/react/src/transactions/publications/useCreateMirror.ts index 9cae3d98c6..acf6482df6 100644 --- a/packages/react/src/transactions/publications/useCreateMirror.ts +++ b/packages/react/src/transactions/publications/useCreateMirror.ts @@ -55,8 +55,8 @@ export type CreateMirrorArgs = { * - {@link BroadcastingErrorReason.RATE_LIMITED} - the profile reached the rate limit * - {@link BroadcastingErrorReason.APP_NOT_ALLOWED} - the app is not whitelisted for gasless transactions * - * If not specified, or `true`, the hook will attempt a Signless Experience when possible; - * otherwise, it will fall back to a signed experience. + * If not specified, or `true`, the hook will attempt a Sponsored Transaction. + * Set it to `false` to force it to use a Self-Funded Transaction. */ sponsored?: boolean; }; diff --git a/packages/react/src/transactions/publications/useCreatePost.ts b/packages/react/src/transactions/publications/useCreatePost.ts index 4da35e9212..69c4a3423d 100644 --- a/packages/react/src/transactions/publications/useCreatePost.ts +++ b/packages/react/src/transactions/publications/useCreatePost.ts @@ -58,8 +58,8 @@ export type CreatePostArgs = { * - {@link BroadcastingErrorReason.RATE_LIMITED} - the profile reached the rate limit * - {@link BroadcastingErrorReason.APP_NOT_ALLOWED} - the app is not whitelisted for gasless transactions * - * If not specified, or `true`, the hook will attempt a Signless Experience when possible; - * otherwise, it will fall back to a signed experience. + * If not specified, or `true`, the hook will attempt a Sponsored Transaction. + * Set it to `false` to force it to use a Self-Funded Transaction. */ sponsored?: boolean; }; diff --git a/packages/react/src/transactions/publications/useCreateQuote.ts b/packages/react/src/transactions/publications/useCreateQuote.ts index 02f80c9924..45f2fe5f08 100644 --- a/packages/react/src/transactions/publications/useCreateQuote.ts +++ b/packages/react/src/transactions/publications/useCreateQuote.ts @@ -77,8 +77,8 @@ export type CreateQuoteArgs = { * - {@link BroadcastingErrorReason.RATE_LIMITED} - the profile reached the rate limit * - {@link BroadcastingErrorReason.APP_NOT_ALLOWED} - the app is not whitelisted for gasless transactions * - * If not specified, or `true`, the hook will attempt a Signless Experience when possible; - * otherwise, it will fall back to a signed experience. + * If not specified, or `true`, the hook will attempt a Sponsored Transaction. + * Set it to `false` to force it to use a Self-Funded Transaction. */ sponsored?: boolean; }; diff --git a/packages/react/src/transactions/publications/useOptimisticCreatePost.ts b/packages/react/src/transactions/publications/useOptimisticCreatePost.ts index 79cbd2b2a8..e38003c09d 100644 --- a/packages/react/src/transactions/publications/useOptimisticCreatePost.ts +++ b/packages/react/src/transactions/publications/useOptimisticCreatePost.ts @@ -60,8 +60,8 @@ export type OptimisticCreatePostArgs = { * - {@link BroadcastingErrorReason.RATE_LIMITED} - the profile reached the rate limit * - {@link BroadcastingErrorReason.APP_NOT_ALLOWED} - the app is not whitelisted for gasless transactions * - * If not specified, or `true`, the hook will attempt a Signless Experience when possible; - * otherwise, it will fall back to a signed experience. + * If not specified, or `true`, the hook will attempt a Sponsored Transaction. + * Set it to `false` to force it to use a Self-Funded Transaction. */ sponsored?: boolean; }; diff --git a/packages/react/src/transactions/useBlockProfiles.ts b/packages/react/src/transactions/useBlockProfiles.ts index 0ed993efad..e886118935 100644 --- a/packages/react/src/transactions/useBlockProfiles.ts +++ b/packages/react/src/transactions/useBlockProfiles.ts @@ -35,8 +35,8 @@ export type BlockProfileArgs = { * - {@link BroadcastingErrorReason.RATE_LIMITED} - the profile reached the rate limit * - {@link BroadcastingErrorReason.APP_NOT_ALLOWED} - the app is not whitelisted for gasless transactions * - * If not specified, or `true`, the hook will attempt a Signless Experience when possible; - * otherwise, it will fall back to a signed experience. + * If not specified, or `true`, the hook will attempt a Sponsored Transaction. + * Set it to `false` to force it to use a Self-Funded Transaction. */ sponsored?: boolean; }; diff --git a/packages/react/src/transactions/useFollow.ts b/packages/react/src/transactions/useFollow.ts index 40153066be..2b4bd4b72c 100644 --- a/packages/react/src/transactions/useFollow.ts +++ b/packages/react/src/transactions/useFollow.ts @@ -109,8 +109,8 @@ export type FollowArgs = { * - {@link BroadcastingErrorReason.RATE_LIMITED} - the profile reached the rate limit * - {@link BroadcastingErrorReason.APP_NOT_ALLOWED} - the app is not whitelisted for gasless transactions * - * If not specified, or `true`, the hook will attempt a Signless Experience when possible; - * otherwise, it will fall back to a signed experience. + * If not specified, or `true`, the hook will attempt a Sponsored Transaction. + * Set it to `false` to force it to use a Self-Funded Transaction. */ sponsored?: boolean; /** diff --git a/packages/react/src/transactions/useLinkHandle.ts b/packages/react/src/transactions/useLinkHandle.ts index 5ae289932e..a5dbed113f 100644 --- a/packages/react/src/transactions/useLinkHandle.ts +++ b/packages/react/src/transactions/useLinkHandle.ts @@ -30,8 +30,8 @@ export type LinkHandleArgs = { * - {@link BroadcastingErrorReason.RATE_LIMITED} - the profile reached the rate limit * - {@link BroadcastingErrorReason.APP_NOT_ALLOWED} - the app is not whitelisted for gasless transactions * - * If not specified, or `true`, the hook will attempt a Signless Experience when possible; - * otherwise, it will fall back to a signed experience. + * If not specified, or `true`, the hook will attempt a Sponsored Transaction. + * Set it to `false` to force it to use a Self-Funded Transaction. */ sponsored?: boolean; }; diff --git a/packages/react/src/transactions/useOpenAction/types.ts b/packages/react/src/transactions/useOpenAction/types.ts index 40cfa28ce1..9d6badfb84 100644 --- a/packages/react/src/transactions/useOpenAction/types.ts +++ b/packages/react/src/transactions/useOpenAction/types.ts @@ -87,8 +87,8 @@ export type OpenActionArgs = { * - {@link BroadcastingErrorReason.RATE_LIMITED} - the profile reached the rate limit * - {@link BroadcastingErrorReason.APP_NOT_ALLOWED} - the app is not whitelisted for gasless transactions * - * If not specified, or `true`, the hook will attempt a Signless Experience when possible; - * otherwise, it will fall back to a signed experience. + * If not specified, or `true`, the hook will attempt a Sponsored Transaction. + * Set it to `false` to force it to use a Self-Funded Transaction. */ sponsored?: boolean; }; diff --git a/packages/react/src/transactions/useSetProfileMetadata.ts b/packages/react/src/transactions/useSetProfileMetadata.ts index e0bf38d983..ef3f357778 100644 --- a/packages/react/src/transactions/useSetProfileMetadata.ts +++ b/packages/react/src/transactions/useSetProfileMetadata.ts @@ -30,8 +30,8 @@ export type UseSetProfileMetadataArgs = { * - {@link BroadcastingErrorReason.RATE_LIMITED} - the profile reached the rate limit * - {@link BroadcastingErrorReason.APP_NOT_ALLOWED} - the app is not whitelisted for gasless transactions * - * If not specified, or `true`, the hook will attempt a Signless Experience when possible; - * otherwise, it will fall back to a signed experience. + * If not specified, or `true`, the hook will attempt a Sponsored Transaction. + * Set it to `false` to force it to use a Self-Funded Transaction. */ sponsored?: boolean; }; diff --git a/packages/react/src/transactions/useUnblockProfiles.ts b/packages/react/src/transactions/useUnblockProfiles.ts index 774757513c..cdd8056fcd 100644 --- a/packages/react/src/transactions/useUnblockProfiles.ts +++ b/packages/react/src/transactions/useUnblockProfiles.ts @@ -34,8 +34,8 @@ export type UnblockProfileArgs = { * - {@link BroadcastingErrorReason.RATE_LIMITED} - the profile reached the rate limit * - {@link BroadcastingErrorReason.APP_NOT_ALLOWED} - the app is not whitelisted for gasless transactions * - * If not specified, or `true`, the hook will attempt a Signless Experience when possible; - * otherwise, it will fall back to a signed experience. + * If not specified, or `true`, the hook will attempt a Sponsored Transaction. + * Set it to `false` to force it to use a Self-Funded Transaction. */ sponsored?: boolean; }; diff --git a/packages/react/src/transactions/useUnfollow.ts b/packages/react/src/transactions/useUnfollow.ts index 2855f338a9..6b9903e614 100644 --- a/packages/react/src/transactions/useUnfollow.ts +++ b/packages/react/src/transactions/useUnfollow.ts @@ -37,8 +37,8 @@ export type UnfollowArgs = { * - {@link BroadcastingErrorReason.RATE_LIMITED} - the profile reached the rate limit * - {@link BroadcastingErrorReason.APP_NOT_ALLOWED} - the app is not whitelisted for gasless transactions * - * If not specified, or `true`, the hook will attempt a Signless Experience when possible; - * otherwise, it will fall back to a signed experience. + * If not specified, or `true`, the hook will attempt a Sponsored Transaction. + * Set it to `false` to force it to use a Self-Funded Transaction. */ sponsored?: boolean; }; diff --git a/packages/react/src/transactions/useUnlinkHandle.ts b/packages/react/src/transactions/useUnlinkHandle.ts index 12093ca9cb..140b4ebccd 100644 --- a/packages/react/src/transactions/useUnlinkHandle.ts +++ b/packages/react/src/transactions/useUnlinkHandle.ts @@ -30,8 +30,8 @@ export type UnlinkHandleArgs = { * - {@link BroadcastingErrorReason.RATE_LIMITED} - the profile reached the rate limit * - {@link BroadcastingErrorReason.APP_NOT_ALLOWED} - the app is not whitelisted for gasless transactions * - * If not specified, or `true`, the hook will attempt a Signless Experience when possible; - * otherwise, it will fall back to a signed experience. + * If not specified, or `true`, the hook will attempt a Sponsored Transaction. + * Set it to `false` to force it to use a Self-Funded Transaction. */ sponsored?: boolean; }; diff --git a/packages/react/src/transactions/useUpdateFollowPolicy.ts b/packages/react/src/transactions/useUpdateFollowPolicy.ts index e20c521d34..fb5b0f9fb0 100644 --- a/packages/react/src/transactions/useUpdateFollowPolicy.ts +++ b/packages/react/src/transactions/useUpdateFollowPolicy.ts @@ -34,8 +34,8 @@ export type UpdateFollowPolicyArgs = { * - {@link BroadcastingErrorReason.RATE_LIMITED} - the profile reached the rate limit * - {@link BroadcastingErrorReason.APP_NOT_ALLOWED} - the app is not whitelisted for gasless transactions * - * If not specified, or `true`, the hook will attempt a Signless Experience when possible; - * otherwise, it will fall back to a signed experience. + * If not specified, or `true`, the hook will attempt a Sponsored Transaction. + * Set it to `false` to force it to use a Self-Funded Transaction. */ sponsored?: boolean; }; diff --git a/packages/react/src/transactions/useUpdateProfileManagers.ts b/packages/react/src/transactions/useUpdateProfileManagers.ts index 47bb5c2320..0744b9e4fb 100644 --- a/packages/react/src/transactions/useUpdateProfileManagers.ts +++ b/packages/react/src/transactions/useUpdateProfileManagers.ts @@ -38,8 +38,8 @@ export type UpdateProfileManagersArgs = AtLeastOneOf<{ * - {@link BroadcastingErrorReason.RATE_LIMITED} - the profile reached the rate limit * - {@link BroadcastingErrorReason.APP_NOT_ALLOWED} - the app is not whitelisted for gasless transactions * - * If not specified, or `true`, the hook will attempt a Signless Experience when possible; - * otherwise, it will fall back to a signed experience. + * If not specified, or `true`, the hook will attempt a Sponsored Transaction. + * Set it to `false` to force it to use a Self-Funded Transaction. */ sponsored?: boolean; }; From e2527bc99d3cf924e527025d200645d40bfbd594 Mon Sep 17 00:00:00 2001 From: Cesare Naldi Date: Tue, 26 Mar 2024 11:16:40 +0100 Subject: [PATCH 3/8] Support Unknown Reference/Open-Action module across mirror/comment/quote --- .../src/lens/__helpers__/fragments.ts | 15 ++ .../domain/src/entities/__helpers__/mocks.ts | 6 + .../use-cases/publications/CreateComment.ts | 8 +- .../src/use-cases/publications/CreateQuote.ts | 8 +- .../publications/__helpers__/mocks.ts | 24 +- .../src/__helpers__/setupHookTestScenario.ts | 5 +- .../useCreatePostExecutionMode.spec.ts | 113 ++++++--- .../__test__/useExecutionMode.spec.ts | 71 ++++++ .../useReferenceExecutionMode.spec.ts | 217 ++++++++++++++++++ .../src/transactions/publications/modules.ts | 41 ++++ .../publications/useCreateComment.ts | 31 +-- .../publications/useCreateMirror.ts | 29 ++- .../publications/useCreatePost.ts | 1 + .../useCreatePostExecutionMode.ts | 94 ++------ .../publications/useCreateQuote.ts | 31 +-- .../publications/useExecutionMode.ts | 75 ++++++ .../publications/useOptimisticCreatePost.ts | 1 + .../publications/useReferenceExecutionMode.ts | 72 ++++++ 18 files changed, 674 insertions(+), 168 deletions(-) create mode 100644 packages/react/src/transactions/publications/__test__/useExecutionMode.spec.ts create mode 100644 packages/react/src/transactions/publications/__test__/useReferenceExecutionMode.spec.ts create mode 100644 packages/react/src/transactions/publications/modules.ts create mode 100644 packages/react/src/transactions/publications/useExecutionMode.ts create mode 100644 packages/react/src/transactions/publications/useReferenceExecutionMode.ts diff --git a/packages/api-bindings/src/lens/__helpers__/fragments.ts b/packages/api-bindings/src/lens/__helpers__/fragments.ts index 509db098b6..b334e52f65 100644 --- a/packages/api-bindings/src/lens/__helpers__/fragments.ts +++ b/packages/api-bindings/src/lens/__helpers__/fragments.ts @@ -215,6 +215,21 @@ export function mockQuoteFragment(overrides?: Partial, +): gql.UnknownReferenceModuleSettings { + return { + contract: mockNetworkAddressFragment(), + signlessApproved: true, + sponsoredApproved: true, + initializeCalldata: null, + initializeResultData: null, + verified: false, + ...overrides, + __typename: 'UnknownReferenceModuleSettings', + }; +} + export function mockMirrorFragment( overrides?: Partial>, ): gql.Mirror { diff --git a/packages/domain/src/entities/__helpers__/mocks.ts b/packages/domain/src/entities/__helpers__/mocks.ts index 0fd4688923..e7c10bf58d 100644 --- a/packages/domain/src/entities/__helpers__/mocks.ts +++ b/packages/domain/src/entities/__helpers__/mocks.ts @@ -40,6 +40,12 @@ export function mockPublicationId(profileId: ProfileId = mockProfileId()): Publi return `${profileId}-${faker.datatype.hexadecimal({ length: 2 })}` as PublicationId; } +export function mockMomokaPublicationId(): PublicationId { + return `${mockProfileId()}-${faker.datatype.hexadecimal({ + length: 2, + })}-DA-${faker.datatype.hexadecimal({ length: 2 })}` as PublicationId; +} + export function mockWallet({ address = mockEvmAddress() }: { address?: EvmAddress } = {}) { return mock({ address }); } diff --git a/packages/domain/src/use-cases/publications/CreateComment.ts b/packages/domain/src/use-cases/publications/CreateComment.ts index 4e18032f80..9c78d3b0f2 100644 --- a/packages/domain/src/use-cases/publications/CreateComment.ts +++ b/packages/domain/src/use-cases/publications/CreateComment.ts @@ -5,7 +5,7 @@ import { DelegableSigning } from '../transactions/DelegableSigning'; import { PaidTransaction } from '../transactions/PaidTransaction'; import { SponsorshipReady } from '../transactions/SponsorshipReady'; import { OpenActionConfig } from './OpenActionConfig'; -import { ReferencePolicyConfig, ReferencePolicyType } from './ReferencePolicyConfig'; +import { ReferencePolicyConfig } from './ReferencePolicyConfig'; import { Referrers } from './Referrers'; export type CreateCommentRequest = { @@ -34,11 +34,7 @@ export class CreateComment extends SponsorshipReady { } protected override async sponsored(request: CreateCommentRequest): Promise { - if ( - request.reference.type === ReferencePolicyType.ANYONE && - request.actions.length === 0 && - isMomokaPublicationId(request.commentOn) - ) { + if (isMomokaPublicationId(request.commentOn)) { return this.sponsoredOnMomoka.execute(request); } return this.sponsoredOnChain.execute(request); diff --git a/packages/domain/src/use-cases/publications/CreateQuote.ts b/packages/domain/src/use-cases/publications/CreateQuote.ts index bdb5a4b0e5..e35a657102 100644 --- a/packages/domain/src/use-cases/publications/CreateQuote.ts +++ b/packages/domain/src/use-cases/publications/CreateQuote.ts @@ -5,7 +5,7 @@ import { DelegableSigning } from '../transactions/DelegableSigning'; import { PaidTransaction } from '../transactions/PaidTransaction'; import { SponsorshipReady } from '../transactions/SponsorshipReady'; import { OpenActionConfig } from './OpenActionConfig'; -import { ReferencePolicyConfig, ReferencePolicyType } from './ReferencePolicyConfig'; +import { ReferencePolicyConfig } from './ReferencePolicyConfig'; import { Referrers } from './Referrers'; export type CreateQuoteRequest = { @@ -34,11 +34,7 @@ export class CreateQuote extends SponsorshipReady { } protected override async sponsored(request: CreateQuoteRequest): Promise { - if ( - request.reference.type === ReferencePolicyType.ANYONE && - request.actions.length === 0 && - isMomokaPublicationId(request.quoteOn) - ) { + if (isMomokaPublicationId(request.quoteOn)) { return this.sponsoredOnMomoka.execute(request); } return this.sponsoredOnChain.execute(request); diff --git a/packages/domain/src/use-cases/publications/__helpers__/mocks.ts b/packages/domain/src/use-cases/publications/__helpers__/mocks.ts index 4db3188cf8..e559ec7f25 100644 --- a/packages/domain/src/use-cases/publications/__helpers__/mocks.ts +++ b/packages/domain/src/use-cases/publications/__helpers__/mocks.ts @@ -18,7 +18,11 @@ import { UnknownActionRequest, } from '../OpenAction'; import { OpenActionType, UnknownOpenActionConfig } from '../OpenActionConfig'; -import { AnyoneReferencePolicyConfig, ReferencePolicyType } from '../ReferencePolicyConfig'; +import { + AnyoneReferencePolicyConfig, + ReferencePolicyType, + UnknownReferencePolicyConfig, +} from '../ReferencePolicyConfig'; import { ReportPublicationRequest } from '../ReportPublication'; export function mockCreateMirrorRequest( @@ -95,11 +99,14 @@ export function mockReportPublicationRequest( }; } -export function mockUnknownOpenActionConfig(): UnknownOpenActionConfig { +export function mockUnknownOpenActionConfig( + overrides?: Partial, +): UnknownOpenActionConfig { return { - type: OpenActionType.UNKNOWN_OPEN_ACTION, address: mockEvmAddress(), data: '0x' as Data, + ...overrides, + type: OpenActionType.UNKNOWN_OPEN_ACTION, }; } @@ -109,6 +116,17 @@ export function mockAnyoneReferencePolicyConfig(): AnyoneReferencePolicyConfig { }; } +export function mockUnknownReferencePolicyConfig( + overrides?: Partial, +): UnknownReferencePolicyConfig { + return { + address: mockEvmAddress(), + data: '0x' as Data, + ...overrides, + type: ReferencePolicyType.UNKNOWN, + }; +} + export function mockCollectFee(overrides?: Partial): CollectFee { return { amount: mockDaiAmount(1, ChainType.POLYGON), diff --git a/packages/react/src/__helpers__/setupHookTestScenario.ts b/packages/react/src/__helpers__/setupHookTestScenario.ts index ab073e0532..d96ecc4d50 100644 --- a/packages/react/src/__helpers__/setupHookTestScenario.ts +++ b/packages/react/src/__helpers__/setupHookTestScenario.ts @@ -4,13 +4,13 @@ import { IStorageProvider } from '@lens-protocol/storage'; import { RenderHookResult } from '@testing-library/react'; import { mock } from 'jest-mock-extended'; -import { IBindings, resolveConfig } from '../config'; +import { BaseConfig, IBindings, resolveConfig } from '../config'; import { development } from '../environments'; import { ProfileCacheManager } from '../profile/infrastructure/ProfileCacheManager'; import { PublicationCacheManager } from '../publication/infrastructure/PublicationCacheManager'; import { renderHookWithMocks } from './testing-library'; -export function setupHookTestScenario(mocks: MockedResponse[]) { +export function setupHookTestScenario(mocks: MockedResponse[], overrides?: Partial) { const client = mockLensApolloClient(mocks); return { @@ -21,6 +21,7 @@ export function setupHookTestScenario(mocks: MockedResponse[]) { bindings: mock(), environment: development, storage: mock(), + ...overrides, }); return renderHookWithMocks(callback, { mocks: { diff --git a/packages/react/src/transactions/publications/__test__/useCreatePostExecutionMode.spec.ts b/packages/react/src/transactions/publications/__test__/useCreatePostExecutionMode.spec.ts index 991ca72c9e..1f9a050f8b 100644 --- a/packages/react/src/transactions/publications/__test__/useCreatePostExecutionMode.spec.ts +++ b/packages/react/src/transactions/publications/__test__/useCreatePostExecutionMode.spec.ts @@ -4,40 +4,77 @@ import { mockModuleMetadataResultFragment, mockProfileFragment, } from '@lens-protocol/api-bindings/mocks'; -import { OpenActionType } from '@lens-protocol/domain/use-cases/publications'; -import { mockEvmAddress } from '@lens-protocol/shared-kernel/mocks'; +import { + mockUnknownOpenActionConfig, + mockUnknownReferencePolicyConfig, +} from '@lens-protocol/domain/mocks'; import { act } from '@testing-library/react'; import { setupHookTestScenario } from '../../../__helpers__/setupHookTestScenario'; -import { data } from '../../../utils'; -import { - CreatePostExecutionModeArgs, - useCreatePostExecutionMode, -} from '../useCreatePostExecutionMode'; +import { useCreatePostExecutionMode } from '../useCreatePostExecutionMode'; describe(`Given the ${useCreatePostExecutionMode.name} hook`, () => { - describe('when evaluating a CreatePostRequest with Unknown Open Actions', () => { - const author = mockProfileFragment({ - sponsor: true, - signless: true, + const author = mockProfileFragment({ + sponsor: true, + signless: true, + }); + const unknownOpenActionConfig = mockUnknownOpenActionConfig(); + const unknownReferencePolicyConfig = mockUnknownReferencePolicyConfig(); + + describe('when executed with sponsored=false', () => { + it('should return a sponsored=false, signless=false', async () => { + const { renderHook } = setupHookTestScenario([ + /* empty */ + ]); + + const { result } = renderHook(useCreatePostExecutionMode); + + await act(async () => { + const request = await result.current({ + actions: undefined, + author, + reference: undefined, + sponsored: false, + }); + expect(request).toMatchObject({ + signless: false, + sponsored: false, + }); + }); + }); + }); + + describe('when executed while the global "sponsored" flag is false', () => { + it('should return a sponsored=false, signless=false', async () => { + const { renderHook } = setupHookTestScenario( + [ + /* empty */ + ], + { sponsored: false }, + ); + + const { result } = renderHook(useCreatePostExecutionMode); + + await act(async () => { + const request = await result.current({ + actions: undefined, + author, + reference: undefined, + sponsored: false, + }); + expect(request).toMatchObject({ + signless: false, + sponsored: false, + }); + }); }); - const openActionModuleAddress = mockEvmAddress(); - const desired: CreatePostExecutionModeArgs = { - author, - actions: [ - { - type: OpenActionType.UNKNOWN_OPEN_ACTION, - address: openActionModuleAddress, - data: data('0x'), - }, - ], - sponsored: true, - }; + }); - it('should take into account Unknown Open Action modules metadata to determine the "sponsored" and "signless" flags', async () => { + describe('when executed with an Unknown Open Action configuration', () => { + it('should take into account the corresponding module metadata', async () => { const { renderHook } = setupHookTestScenario([ mockModuleMetadataResponse({ - implementation: openActionModuleAddress, + implementation: unknownOpenActionConfig.address, result: mockModuleMetadataResultFragment({ signlessApproved: false, sponsoredApproved: false, @@ -49,26 +86,42 @@ describe(`Given the ${useCreatePostExecutionMode.name} hook`, () => { const { result } = renderHook(useCreatePostExecutionMode); await act(async () => { - const request = await result.current(desired); + const request = await result.current({ + author, + actions: [unknownOpenActionConfig], + reference: undefined, + sponsored: true, + }); expect(request).toMatchObject({ signless: false, sponsored: false, }); }); }); + }); - it('should opt for non-sponsored tx whenever the module is not registered', async () => { + describe('when executed with an Unknown Reference Policy configuration', () => { + it('should take into account the corresponding module metadata', async () => { const { renderHook } = setupHookTestScenario([ mockModuleMetadataResponse({ - implementation: openActionModuleAddress, - result: null, + implementation: unknownReferencePolicyConfig.address, + result: mockModuleMetadataResultFragment({ + signlessApproved: false, + sponsoredApproved: false, + moduleType: ModuleType.OpenAction, + }), }), ]); const { result } = renderHook(useCreatePostExecutionMode); await act(async () => { - const request = await result.current(desired); + const request = await result.current({ + actions: undefined, + author, + reference: unknownReferencePolicyConfig, + sponsored: true, + }); expect(request).toMatchObject({ signless: false, sponsored: false, diff --git a/packages/react/src/transactions/publications/__test__/useExecutionMode.spec.ts b/packages/react/src/transactions/publications/__test__/useExecutionMode.spec.ts new file mode 100644 index 0000000000..b08954889e --- /dev/null +++ b/packages/react/src/transactions/publications/__test__/useExecutionMode.spec.ts @@ -0,0 +1,71 @@ +import { ModuleType } from '@lens-protocol/api-bindings'; +import { + mockModuleMetadataResponse, + mockModuleMetadataResultFragment, + mockProfileFragment, +} from '@lens-protocol/api-bindings/mocks'; +import { mockEvmAddress } from '@lens-protocol/shared-kernel/mocks'; +import { act } from '@testing-library/react'; + +import { setupHookTestScenario } from '../../../__helpers__/setupHookTestScenario'; +import { useExecutionMode } from '../useExecutionMode'; + +describe(`Given the ${useExecutionMode.name} hook`, () => { + const moduleAddress = mockEvmAddress(); + const author = mockProfileFragment({ + sponsor: true, + signless: true, + }); + + describe('when executed with a registered Unknown Module', () => { + it('should take into account Unknown Open Action modules metadata to determine the "sponsored" and "signless" flags', async () => { + const { renderHook } = setupHookTestScenario([ + mockModuleMetadataResponse({ + implementation: moduleAddress, + result: mockModuleMetadataResultFragment({ + signlessApproved: false, + sponsoredApproved: false, + moduleType: ModuleType.OpenAction, + }), + }), + ]); + + const { result } = renderHook(useExecutionMode); + + await act(async () => { + const request = await result.current({ + author, + unknownModules: [moduleAddress], + }); + expect(request).toMatchObject({ + signless: false, + sponsored: false, + }); + }); + }); + }); + + describe('when executed with an unregistered Unknown Module', () => { + it('should opt for non-sponsored tx', async () => { + const { renderHook } = setupHookTestScenario([ + mockModuleMetadataResponse({ + implementation: moduleAddress, + result: null, + }), + ]); + + const { result } = renderHook(useExecutionMode); + + await act(async () => { + const request = await result.current({ + author, + unknownModules: [moduleAddress], + }); + expect(request).toMatchObject({ + signless: false, + sponsored: false, + }); + }); + }); + }); +}); diff --git a/packages/react/src/transactions/publications/__test__/useReferenceExecutionMode.spec.ts b/packages/react/src/transactions/publications/__test__/useReferenceExecutionMode.spec.ts new file mode 100644 index 0000000000..eb2144bb96 --- /dev/null +++ b/packages/react/src/transactions/publications/__test__/useReferenceExecutionMode.spec.ts @@ -0,0 +1,217 @@ +import { ModuleType } from '@lens-protocol/api-bindings'; +import { + mockModuleMetadataResponse, + mockModuleMetadataResultFragment, + mockPostFragment, + mockProfileFragment, + mockPublicationResponse, + mockUnknownReferenceModuleSettings, +} from '@lens-protocol/api-bindings/mocks'; +import { + mockMomokaPublicationId, + mockPublicationId, + mockUnknownOpenActionConfig, + mockUnknownReferencePolicyConfig, +} from '@lens-protocol/domain/mocks'; +import { act } from '@testing-library/react'; + +import { setupHookTestScenario } from '../../../__helpers__/setupHookTestScenario'; +import { useReferenceExecutionMode } from '../useReferenceExecutionMode'; + +describe(`Given the ${useReferenceExecutionMode.name} hook`, () => { + const unknownOpenActionConfig = mockUnknownOpenActionConfig(); + const unknownReferencePolicyConfig = mockUnknownReferencePolicyConfig(); + const author = mockProfileFragment({ + sponsor: true, + signless: true, + }); + + describe('when referencing a Momoka publication', () => { + it(`should return sponsored=true and signless according to author.signless value`, async () => { + const referencedPublication = mockPostFragment({ + id: mockMomokaPublicationId(), + }); + + const { renderHook } = setupHookTestScenario([ + /* empty */ + ]); + + const { result } = renderHook(useReferenceExecutionMode); + + await act(async () => { + const request = await result.current({ + author, + referencedPublicationId: referencedPublication.id, + }); + expect(request).toMatchObject({ + signless: author.signless, + sponsored: true, + }); + }); + }); + }); + + describe('and the referenced publication is an on-chain publication', () => { + describe('when executed with sponsored=false', () => { + it('should return a sponsored=false, signless=false', async () => { + const referencedPublication = mockPostFragment({ + id: mockPublicationId(), + }); + + const { renderHook } = setupHookTestScenario([ + /* empty */ + ]); + + const { result } = renderHook(useReferenceExecutionMode); + + await act(async () => { + const request = await result.current({ + author, + referencedPublicationId: referencedPublication.id, + sponsored: false, + }); + expect(request).toMatchObject({ + signless: false, + sponsored: false, + }); + }); + }); + }); + + describe('when executed while the global "sponsored" flag is false', () => { + it('should return a sponsored=false, signless=false', async () => { + const referencedPublication = mockPostFragment({ + id: mockPublicationId(), + }); + + const { renderHook } = setupHookTestScenario( + [ + /* empty */ + ], + { sponsored: false }, + ); + + const { result } = renderHook(useReferenceExecutionMode); + + await act(async () => { + const request = await result.current({ + author, + referencedPublicationId: referencedPublication.id, + }); + expect(request).toMatchObject({ + signless: false, + sponsored: false, + }); + }); + }); + }); + + describe('when the referenced publication is configured with an Unknown Reference Policy', () => { + it('should take into account the corresponding module metadata', async () => { + const referenceModule = mockUnknownReferenceModuleSettings({ + sponsoredApproved: false, + signlessApproved: false, + }); + const referencedPublication = mockPostFragment({ + referenceModule, + }); + + const { renderHook } = setupHookTestScenario([ + mockPublicationResponse({ + variables: { + request: { forId: referencedPublication.id }, + }, + result: referencedPublication, + }), + ]); + + const { result } = renderHook(useReferenceExecutionMode); + + await act(async () => { + const request = await result.current({ + author, + referencedPublicationId: referencedPublication.id, + }); + expect(request).toMatchObject({ + signless: false, + sponsored: false, + }); + }); + }); + }); + + describe('and the referenced publication is using a sponsored Unknown Reference Policy or a built-in one', () => { + const referencedPublication = mockPostFragment(); + + describe('when executed with an Unknown Open Action configuration', () => { + it('should take into account the corresponding module metadata', async () => { + const { renderHook } = setupHookTestScenario([ + mockPublicationResponse({ + variables: { + request: { forId: referencedPublication.id }, + }, + result: referencedPublication, + }), + mockModuleMetadataResponse({ + implementation: unknownOpenActionConfig.address, + result: mockModuleMetadataResultFragment({ + signlessApproved: false, + sponsoredApproved: false, + moduleType: ModuleType.OpenAction, + }), + }), + ]); + + const { result } = renderHook(useReferenceExecutionMode); + + await act(async () => { + const request = await result.current({ + author, + actions: [unknownOpenActionConfig], + referencedPublicationId: referencedPublication.id, + }); + expect(request).toMatchObject({ + signless: false, + sponsored: false, + }); + }); + }); + }); + + describe('when executed with an Unknown Reference Policy configuration', () => { + it('should take into account the corresponding module metadata', async () => { + const { renderHook } = setupHookTestScenario([ + mockPublicationResponse({ + variables: { + request: { forId: referencedPublication.id }, + }, + result: referencedPublication, + }), + mockModuleMetadataResponse({ + implementation: unknownReferencePolicyConfig.address, + result: mockModuleMetadataResultFragment({ + signlessApproved: false, + sponsoredApproved: false, + moduleType: ModuleType.OpenAction, + }), + }), + ]); + + const { result } = renderHook(useReferenceExecutionMode); + + await act(async () => { + const request = await result.current({ + author, + referencedPublicationId: referencedPublication.id, + reference: unknownReferencePolicyConfig, + }); + expect(request).toMatchObject({ + signless: false, + sponsored: false, + }); + }); + }); + }); + }); + }); +}); diff --git a/packages/react/src/transactions/publications/modules.ts b/packages/react/src/transactions/publications/modules.ts new file mode 100644 index 0000000000..23cceb9521 --- /dev/null +++ b/packages/react/src/transactions/publications/modules.ts @@ -0,0 +1,41 @@ +import { + OpenActionConfig, + OpenActionType, + ReferencePolicyConfig, + ReferencePolicyType, +} from '@lens-protocol/domain/use-cases/publications'; +import { EvmAddress } from '@lens-protocol/shared-kernel'; + +function extractUnknownOpenActionModuleAddresses(actions: OpenActionConfig[] = []): EvmAddress[] { + return actions.reduce((addresses, action) => { + if (action.type === OpenActionType.UNKNOWN_OPEN_ACTION) { + addresses.push(action.address); + } + return addresses; + }, [] as EvmAddress[]); +} + +function extractUnknownReferenceModuleAddress(reference?: ReferencePolicyConfig): EvmAddress[] { + if (!reference) { + return []; + } + + if (reference.type !== ReferencePolicyType.UNKNOWN) { + return []; + } + + return [reference.address]; +} + +export function extractUnknownModuleConfigAddresses({ + actions = [], + reference, +}: { + actions: OpenActionConfig[] | undefined; // | undefined is intentional to force consumers to provide a value + reference: ReferencePolicyConfig | undefined; // | undefined is intentional to force consumers to provide a value +}): EvmAddress[] { + return [ + ...extractUnknownOpenActionModuleAddresses(actions), + ...extractUnknownReferenceModuleAddress(reference), + ]; +} diff --git a/packages/react/src/transactions/publications/useCreateComment.ts b/packages/react/src/transactions/publications/useCreateComment.ts index f1276ee701..ba5bcef98c 100644 --- a/packages/react/src/transactions/publications/useCreateComment.ts +++ b/packages/react/src/transactions/publications/useCreateComment.ts @@ -19,7 +19,7 @@ import { useDeferredTask, UseDeferredTask } from '../../helpers/tasks'; import { AsyncTransactionResult } from '../adapters/AsyncTransactionResult'; import { createCommentRequest } from '../adapters/schemas/builders'; import { useCreateCommentController } from '../adapters/useCreateCommentController'; -import { useSponsoredConfig } from '../shared/useSponsoredConfig'; +import { useReferenceExecutionMode } from './useReferenceExecutionMode'; /** * An object representing the result of a comment creation. @@ -495,25 +495,26 @@ export function useCreateComment(): UseDeferredTask< > { const { data: session } = useSession(); const createComment = useCreateCommentController(); - const configureRequest = useSponsoredConfig(); + const resolveExecutionMode = useReferenceExecutionMode(); return useDeferredTask(async (args: CreateCommentArgs) => { invariant( - session?.authenticated, - 'You must be authenticated to create a comment. Use `useLogin` hook to authenticate.', - ); - invariant( - session.type === SessionType.WithProfile, - 'You must have a profile to create a comment.', + session?.type === SessionType.WithProfile, + 'You must be authenticated with a Profile to comment. Use `useLogin` hook to authenticate.', ); - const request = configureRequest( - createCommentRequest({ - signless: session.profile.signless, - sponsored: args.sponsored ?? true, - ...args, - }), - ); + const mode = await resolveExecutionMode({ + actions: args.actions, + author: session.profile, + reference: args.reference, + referencedPublicationId: args.commentOn, + sponsored: args.sponsored, + }); + + const request = createCommentRequest({ + ...args, + ...mode, + }); return createComment(request); }); diff --git a/packages/react/src/transactions/publications/useCreateMirror.ts b/packages/react/src/transactions/publications/useCreateMirror.ts index acf6482df6..ceb7075a1f 100644 --- a/packages/react/src/transactions/publications/useCreateMirror.ts +++ b/packages/react/src/transactions/publications/useCreateMirror.ts @@ -15,7 +15,7 @@ import { useDeferredTask, UseDeferredTask } from '../../helpers/tasks'; import { AsyncTransactionResult } from '../adapters/AsyncTransactionResult'; import { createMirrorRequest } from '../adapters/schemas/builders'; import { useCreateMirrorController } from '../adapters/useCreateMirrorController'; -import { useSponsoredConfig } from '../shared/useSponsoredConfig'; +import { useReferenceExecutionMode } from './useReferenceExecutionMode'; /** * An object representing the result of a mirror creation. @@ -244,25 +244,24 @@ export function useCreateMirror(): UseDeferredTask< > { const { data: session } = useSession(); const createMirror = useCreateMirrorController(); - const configureRequest = useSponsoredConfig(); + const resolveExecutionMode = useReferenceExecutionMode(); return useDeferredTask(async (args: CreateMirrorArgs) => { invariant( - session?.authenticated, - 'You must be authenticated to create a mirror. Use `useLogin` hook to authenticate.', - ); - invariant( - session.type === SessionType.WithProfile, - 'You must have a profile to create a mirror.', + session?.type === SessionType.WithProfile, + 'You must be authenticated with a Profile to mirror. Use `useLogin` hook to authenticate.', ); - const request = configureRequest( - createMirrorRequest({ - signless: session.profile.signless, - sponsored: args.sponsored ?? true, - ...args, - }), - ); + const mode = await resolveExecutionMode({ + author: session.profile, + referencedPublicationId: args.mirrorOn, + sponsored: args.sponsored, + }); + + const request = createMirrorRequest({ + ...args, + ...mode, + }); return createMirror(request); }); diff --git a/packages/react/src/transactions/publications/useCreatePost.ts b/packages/react/src/transactions/publications/useCreatePost.ts index 69c4a3423d..e651e14792 100644 --- a/packages/react/src/transactions/publications/useCreatePost.ts +++ b/packages/react/src/transactions/publications/useCreatePost.ts @@ -470,6 +470,7 @@ export function useCreatePost(): UseDeferredTask< const mode = await resolveExecutionMode({ author: session.profile, sponsored: args.sponsored, + reference: args.reference, actions: args.actions, }); diff --git a/packages/react/src/transactions/publications/useCreatePostExecutionMode.ts b/packages/react/src/transactions/publications/useCreatePostExecutionMode.ts index d26d448018..e1d6b8d0b9 100644 --- a/packages/react/src/transactions/publications/useCreatePostExecutionMode.ts +++ b/packages/react/src/transactions/publications/useCreatePostExecutionMode.ts @@ -1,99 +1,41 @@ import { Profile } from '@lens-protocol/api-bindings'; -import { OpenActionConfig, OpenActionType } from '@lens-protocol/domain/use-cases/publications'; -import { EvmAddress } from '@lens-protocol/shared-kernel'; +import { + OpenActionConfig, + ReferencePolicyConfig, +} from '@lens-protocol/domain/use-cases/publications'; -import { NotFoundError } from '../../NotFoundError'; -import { useLazyModuleMetadata } from '../../misc'; import { useSharedDependencies } from '../../shared'; - -function extractUnknownOpenActionModuleAddresses(actions: OpenActionConfig[] = []): EvmAddress[] { - return actions.reduce((addresses, action) => { - if (action.type === OpenActionType.UNKNOWN_OPEN_ACTION) { - addresses.push(action.address); - } - return addresses; - }, [] as EvmAddress[]); -} +import { extractUnknownModuleConfigAddresses } from './modules'; +import { useExecutionMode, TransactionExecutionMode } from './useExecutionMode'; export type CreatePostExecutionModeArgs = { author: Profile; - actions?: OpenActionConfig[]; - sponsored?: boolean; + actions: OpenActionConfig[] | undefined; // | undefined is intentional to force consumers to provide a value + reference: ReferencePolicyConfig | undefined; // | undefined is intentional to force consumers to provide a value + sponsored: boolean | undefined; // | undefined is intentional to force consumers to provide a value }; -export type TransactionExecutionMode = - | { - signless: false; - sponsored: false; - } - | { - signless: boolean; - sponsored: true; - }; - export function useCreatePostExecutionMode() { - const { execute: fetch } = useLazyModuleMetadata(); + const resolve = useExecutionMode(); const { config } = useSharedDependencies(); return async ({ actions, author, + reference, sponsored, }: CreatePostExecutionModeArgs): Promise => { - // if sponsored is disabled globally, return here - if (config.sponsored === false) { + if (sponsored === false) { return { signless: false, sponsored: false }; } - const desired: TransactionExecutionMode = - sponsored === false - ? { signless: false, sponsored: false } - : author.sponsor - ? { - signless: author.signless, - sponsored: true, - } - : { - signless: false, - sponsored: false, - }; - - const implementations = extractUnknownOpenActionModuleAddresses(actions); - - const results = await Promise.all( - implementations.map((implementation) => fetch({ implementation })), - ); - - for (const result of results) { - if (result.isFailure()) { - if (result.error instanceof NotFoundError) { - // if the module is not registered, opt for non-sponsored tx - return { - ...desired, - sponsored: false, - signless: false, - }; - } - throw result.error; - } - const { signlessApproved, sponsoredApproved } = result.value; - - if (!sponsoredApproved) { - return { - ...desired, - sponsored: false, - signless: false, - }; - } - - if (!signlessApproved) { - return { - ...desired, - signless: false, - }; - } + if (config.sponsored === false) { + return { signless: false, sponsored: false }; } - return desired; + return resolve({ + author, + unknownModules: extractUnknownModuleConfigAddresses({ actions, reference }), + }); }; } diff --git a/packages/react/src/transactions/publications/useCreateQuote.ts b/packages/react/src/transactions/publications/useCreateQuote.ts index 45f2fe5f08..83c6786e34 100644 --- a/packages/react/src/transactions/publications/useCreateQuote.ts +++ b/packages/react/src/transactions/publications/useCreateQuote.ts @@ -19,7 +19,7 @@ import { useDeferredTask, UseDeferredTask } from '../../helpers/tasks'; import { AsyncTransactionResult } from '../adapters/AsyncTransactionResult'; import { createQuoteRequest } from '../adapters/schemas/builders'; import { useCreateQuoteController } from '../adapters/useCreateQuoteController'; -import { useSponsoredConfig } from '../shared/useSponsoredConfig'; +import { useReferenceExecutionMode } from './useReferenceExecutionMode'; /** * An object representing the result of a quote creation. @@ -467,25 +467,26 @@ export function useCreateQuote(): UseDeferredTask< > { const { data: session } = useSession(); const createQuote = useCreateQuoteController(); - const configureRequest = useSponsoredConfig(); + const resolveExecutionMode = useReferenceExecutionMode(); return useDeferredTask(async (args: CreateQuoteArgs) => { invariant( - session?.authenticated, - 'You must be authenticated to create a quote. Use `useLogin` hook to authenticate.', - ); - invariant( - session.type === SessionType.WithProfile, - 'You must have a profile to create a quote.', + session?.type === SessionType.WithProfile, + 'You must be authenticated with a Profile to quote. Use `useLogin` hook to authenticate.', ); - const request = configureRequest( - createQuoteRequest({ - signless: session.profile.signless, - sponsored: args.sponsored ?? true, - ...args, - }), - ); + const mode = await resolveExecutionMode({ + actions: args.actions, + author: session.profile, + reference: args.reference, + referencedPublicationId: args.quoteOn, + sponsored: args.sponsored, + }); + + const request = createQuoteRequest({ + ...args, + ...mode, + }); return createQuote(request); }); diff --git a/packages/react/src/transactions/publications/useExecutionMode.ts b/packages/react/src/transactions/publications/useExecutionMode.ts new file mode 100644 index 0000000000..2b678a8ff4 --- /dev/null +++ b/packages/react/src/transactions/publications/useExecutionMode.ts @@ -0,0 +1,75 @@ +import { Profile } from '@lens-protocol/api-bindings'; +import { EvmAddress } from '@lens-protocol/shared-kernel'; + +import { NotFoundError } from '../../NotFoundError'; +import { useLazyModuleMetadata } from '../../misc'; + +export type TransactionExecutionMode = + | { + signless: false; + sponsored: false; + } + | { + signless: boolean; + sponsored: true; + }; + +export type ExecutionModeArgs = { + author: Profile; + unknownModules: EvmAddress[]; +}; + +export function useExecutionMode() { + const { execute: fetch } = useLazyModuleMetadata(); + + return async ({ + author, + unknownModules, + }: ExecutionModeArgs): Promise => { + const desired: TransactionExecutionMode = author.sponsor + ? { + signless: author.signless, + sponsored: true, + } + : { + signless: false, + sponsored: false, + }; + + const results = await Promise.all( + unknownModules.map((implementation) => fetch({ implementation })), + ); + + for (const result of results) { + if (result.isFailure()) { + if (result.error instanceof NotFoundError) { + // if the module is not registered, opt for non-sponsored tx + return { + ...desired, + sponsored: false, + signless: false, + }; + } + throw result.error; + } + const { signlessApproved, sponsoredApproved } = result.value; + + if (!sponsoredApproved) { + return { + ...desired, + sponsored: false, + signless: false, + }; + } + + if (!signlessApproved) { + return { + ...desired, + signless: false, + }; + } + } + + return desired; + }; +} diff --git a/packages/react/src/transactions/publications/useOptimisticCreatePost.ts b/packages/react/src/transactions/publications/useOptimisticCreatePost.ts index e38003c09d..60d609fedb 100644 --- a/packages/react/src/transactions/publications/useOptimisticCreatePost.ts +++ b/packages/react/src/transactions/publications/useOptimisticCreatePost.ts @@ -297,6 +297,7 @@ export function useOptimisticCreatePost( const mode = await resolveExecutionMode({ actions: args.actions, author: session.profile, + reference: args.reference, sponsored: args.sponsored, }); diff --git a/packages/react/src/transactions/publications/useReferenceExecutionMode.ts b/packages/react/src/transactions/publications/useReferenceExecutionMode.ts new file mode 100644 index 0000000000..79afb771fa --- /dev/null +++ b/packages/react/src/transactions/publications/useReferenceExecutionMode.ts @@ -0,0 +1,72 @@ +import { Profile, isPrimaryPublication, resolveReferencePolicy } from '@lens-protocol/api-bindings'; +import { PublicationId, isMomokaPublicationId } from '@lens-protocol/domain/entities'; +import { + OpenActionConfig, + ReferencePolicyConfig, + ReferencePolicyType, +} from '@lens-protocol/domain/use-cases/publications'; +import { invariant } from '@lens-protocol/shared-kernel'; + +import { useLazyPublication } from '../../publication'; +import { useSharedDependencies } from '../../shared'; +import { extractUnknownModuleConfigAddresses } from './modules'; +import { useExecutionMode, TransactionExecutionMode } from './useExecutionMode'; + +export type ReferenceExecutionModeArgs = { + author: Profile; + referencedPublicationId: PublicationId; + actions?: OpenActionConfig[]; + reference?: ReferencePolicyConfig; + sponsored?: boolean; +}; + +export function useReferenceExecutionMode() { + const { config } = useSharedDependencies(); + const { execute: fetch } = useLazyPublication(); + const resolve = useExecutionMode(); + + return async ({ + actions, + author, + reference, + referencedPublicationId, + sponsored, + }: ReferenceExecutionModeArgs): Promise => { + if (isMomokaPublicationId(referencedPublicationId)) { + return { + signless: author.signless, + sponsored: true, + }; + } + + if (sponsored === false) { + return { signless: false, sponsored: false }; + } + + if (config.sponsored === false) { + return { signless: false, sponsored: false }; + } + + const result = await fetch({ forId: referencedPublicationId }); + + const publication = result.unwrap(); + + invariant( + isPrimaryPublication(publication), + `Referenced publication ${referencedPublicationId} is not a primary publication: ${publication.__typename}`, + ); + + const referencePolicy = resolveReferencePolicy(publication); + + if (referencePolicy.type === ReferencePolicyType.UNKNOWN) { + if (!referencePolicy.sponsoredApproved) { + return { signless: false, sponsored: false }; + } + } + + return resolve({ + author, + unknownModules: extractUnknownModuleConfigAddresses({ actions, reference }), + }); + }; +} From 9b59b66af6af89e75498126680291c7b8045dc97 Mon Sep 17 00:00:00 2001 From: Cesare Naldi Date: Tue, 26 Mar 2024 13:51:44 +0100 Subject: [PATCH 4/8] Refactors into a simpler solution --- .../useCreatePostExecutionMode.spec.ts | 132 ----------- .../__test__/useExecutionMode.spec.ts | 167 +++++++++++++- .../useReferenceExecutionMode.spec.ts | 217 ------------------ .../publications/useCreateComment.ts | 4 +- .../publications/useCreateMirror.ts | 4 +- .../publications/useCreatePost.ts | 4 +- .../useCreatePostExecutionMode.ts | 41 ---- .../publications/useCreateQuote.ts | 4 +- .../publications/useExecutionMode.ts | 72 +++++- .../publications/useOptimisticCreatePost.ts | 4 +- .../publications/useReferenceExecutionMode.ts | 72 ------ 11 files changed, 230 insertions(+), 491 deletions(-) delete mode 100644 packages/react/src/transactions/publications/__test__/useCreatePostExecutionMode.spec.ts delete mode 100644 packages/react/src/transactions/publications/__test__/useReferenceExecutionMode.spec.ts delete mode 100644 packages/react/src/transactions/publications/useCreatePostExecutionMode.ts delete mode 100644 packages/react/src/transactions/publications/useReferenceExecutionMode.ts diff --git a/packages/react/src/transactions/publications/__test__/useCreatePostExecutionMode.spec.ts b/packages/react/src/transactions/publications/__test__/useCreatePostExecutionMode.spec.ts deleted file mode 100644 index 1f9a050f8b..0000000000 --- a/packages/react/src/transactions/publications/__test__/useCreatePostExecutionMode.spec.ts +++ /dev/null @@ -1,132 +0,0 @@ -import { ModuleType } from '@lens-protocol/api-bindings'; -import { - mockModuleMetadataResponse, - mockModuleMetadataResultFragment, - mockProfileFragment, -} from '@lens-protocol/api-bindings/mocks'; -import { - mockUnknownOpenActionConfig, - mockUnknownReferencePolicyConfig, -} from '@lens-protocol/domain/mocks'; -import { act } from '@testing-library/react'; - -import { setupHookTestScenario } from '../../../__helpers__/setupHookTestScenario'; -import { useCreatePostExecutionMode } from '../useCreatePostExecutionMode'; - -describe(`Given the ${useCreatePostExecutionMode.name} hook`, () => { - const author = mockProfileFragment({ - sponsor: true, - signless: true, - }); - const unknownOpenActionConfig = mockUnknownOpenActionConfig(); - const unknownReferencePolicyConfig = mockUnknownReferencePolicyConfig(); - - describe('when executed with sponsored=false', () => { - it('should return a sponsored=false, signless=false', async () => { - const { renderHook } = setupHookTestScenario([ - /* empty */ - ]); - - const { result } = renderHook(useCreatePostExecutionMode); - - await act(async () => { - const request = await result.current({ - actions: undefined, - author, - reference: undefined, - sponsored: false, - }); - expect(request).toMatchObject({ - signless: false, - sponsored: false, - }); - }); - }); - }); - - describe('when executed while the global "sponsored" flag is false', () => { - it('should return a sponsored=false, signless=false', async () => { - const { renderHook } = setupHookTestScenario( - [ - /* empty */ - ], - { sponsored: false }, - ); - - const { result } = renderHook(useCreatePostExecutionMode); - - await act(async () => { - const request = await result.current({ - actions: undefined, - author, - reference: undefined, - sponsored: false, - }); - expect(request).toMatchObject({ - signless: false, - sponsored: false, - }); - }); - }); - }); - - describe('when executed with an Unknown Open Action configuration', () => { - it('should take into account the corresponding module metadata', async () => { - const { renderHook } = setupHookTestScenario([ - mockModuleMetadataResponse({ - implementation: unknownOpenActionConfig.address, - result: mockModuleMetadataResultFragment({ - signlessApproved: false, - sponsoredApproved: false, - moduleType: ModuleType.OpenAction, - }), - }), - ]); - - const { result } = renderHook(useCreatePostExecutionMode); - - await act(async () => { - const request = await result.current({ - author, - actions: [unknownOpenActionConfig], - reference: undefined, - sponsored: true, - }); - expect(request).toMatchObject({ - signless: false, - sponsored: false, - }); - }); - }); - }); - - describe('when executed with an Unknown Reference Policy configuration', () => { - it('should take into account the corresponding module metadata', async () => { - const { renderHook } = setupHookTestScenario([ - mockModuleMetadataResponse({ - implementation: unknownReferencePolicyConfig.address, - result: mockModuleMetadataResultFragment({ - signlessApproved: false, - sponsoredApproved: false, - moduleType: ModuleType.OpenAction, - }), - }), - ]); - - const { result } = renderHook(useCreatePostExecutionMode); - - await act(async () => { - const request = await result.current({ - actions: undefined, - author, - reference: unknownReferencePolicyConfig, - sponsored: true, - }); - expect(request).toMatchObject({ - signless: false, - sponsored: false, - }); - }); - }); - }); -}); diff --git a/packages/react/src/transactions/publications/__test__/useExecutionMode.spec.ts b/packages/react/src/transactions/publications/__test__/useExecutionMode.spec.ts index b08954889e..f4fc55d9b6 100644 --- a/packages/react/src/transactions/publications/__test__/useExecutionMode.spec.ts +++ b/packages/react/src/transactions/publications/__test__/useExecutionMode.spec.ts @@ -2,26 +2,173 @@ import { ModuleType } from '@lens-protocol/api-bindings'; import { mockModuleMetadataResponse, mockModuleMetadataResultFragment, + mockPostFragment, mockProfileFragment, + mockPublicationResponse, + mockUnknownReferenceModuleSettings, } from '@lens-protocol/api-bindings/mocks'; -import { mockEvmAddress } from '@lens-protocol/shared-kernel/mocks'; +import { + mockMomokaPublicationId, + mockPublicationId, + mockUnknownOpenActionConfig, + mockUnknownReferencePolicyConfig, +} from '@lens-protocol/domain/mocks'; import { act } from '@testing-library/react'; import { setupHookTestScenario } from '../../../__helpers__/setupHookTestScenario'; import { useExecutionMode } from '../useExecutionMode'; describe(`Given the ${useExecutionMode.name} hook`, () => { - const moduleAddress = mockEvmAddress(); + const unknownOpenActionConfig = mockUnknownOpenActionConfig(); + const unknownReferencePolicyConfig = mockUnknownReferencePolicyConfig(); const author = mockProfileFragment({ sponsor: true, signless: true, }); - describe('when executed with a registered Unknown Module', () => { - it('should take into account Unknown Open Action modules metadata to determine the "sponsored" and "signless" flags', async () => { + describe('when referencing a Momoka publication', () => { + it(`should return sponsored=true and signless according to author.signless value`, async () => { + const referencedPublication = mockPostFragment({ + id: mockMomokaPublicationId(), + }); + + const { renderHook } = setupHookTestScenario([ + /* empty */ + ]); + + const { result } = renderHook(useExecutionMode); + + await act(async () => { + const request = await result.current({ + author, + referencedPublicationId: referencedPublication.id, + }); + expect(request).toMatchObject({ + signless: author.signless, + sponsored: true, + }); + }); + }); + }); + + describe.each([ + { description: 'a Momoka publication', publicationId: mockMomokaPublicationId() }, + { description: 'an on-chain publication', publicationId: mockPublicationId() }, + ])('and the referenced publication is $description', ({ publicationId }) => { + describe('when executed with sponsored=false', () => { + it('should return a sponsored=false, signless=false', async () => { + const { renderHook } = setupHookTestScenario([ + /* empty */ + ]); + + const { result } = renderHook(useExecutionMode); + + await act(async () => { + const request = await result.current({ + author, + referencedPublicationId: publicationId, + sponsored: false, + }); + expect(request).toMatchObject({ + signless: false, + sponsored: false, + }); + }); + }); + }); + + describe('when executed while the global "sponsored" flag is false', () => { + it('should return a sponsored=false, signless=false', async () => { + const { renderHook } = setupHookTestScenario( + [ + /* empty */ + ], + { sponsored: false }, + ); + + const { result } = renderHook(useExecutionMode); + + await act(async () => { + const request = await result.current({ + author, + referencedPublicationId: publicationId, + }); + expect(request).toMatchObject({ + signless: false, + sponsored: false, + }); + }); + }); + }); + }); + + describe('when the referenced publication is configured with an Unknown Reference Policy', () => { + it('should take into account the corresponding module metadata', async () => { + const referenceModule = mockUnknownReferenceModuleSettings({ + sponsoredApproved: false, + signlessApproved: false, + }); + const referencedPublication = mockPostFragment({ + referenceModule, + }); + + const { renderHook } = setupHookTestScenario([ + mockPublicationResponse({ + variables: { + request: { forId: referencedPublication.id }, + }, + result: referencedPublication, + }), + ]); + + const { result } = renderHook(useExecutionMode); + + await act(async () => { + const request = await result.current({ + author, + referencedPublicationId: referencedPublication.id, + }); + expect(request).toMatchObject({ + signless: false, + sponsored: false, + }); + }); + }); + }); + + describe('when executed with an Unknown Open Action configuration', () => { + it('should take into account the corresponding module metadata', async () => { + const { renderHook } = setupHookTestScenario([ + mockModuleMetadataResponse({ + implementation: unknownOpenActionConfig.address, + result: mockModuleMetadataResultFragment({ + signlessApproved: false, + sponsoredApproved: false, + moduleType: ModuleType.OpenAction, + }), + }), + ]); + + const { result } = renderHook(useExecutionMode); + + await act(async () => { + const request = await result.current({ + author, + actions: [unknownOpenActionConfig], + }); + expect(request).toMatchObject({ + signless: false, + sponsored: false, + }); + }); + }); + }); + + describe('when executed with an Unknown Reference Policy configuration', () => { + it('should take into account the corresponding module metadata', async () => { const { renderHook } = setupHookTestScenario([ mockModuleMetadataResponse({ - implementation: moduleAddress, + implementation: unknownReferencePolicyConfig.address, result: mockModuleMetadataResultFragment({ signlessApproved: false, sponsoredApproved: false, @@ -35,7 +182,7 @@ describe(`Given the ${useExecutionMode.name} hook`, () => { await act(async () => { const request = await result.current({ author, - unknownModules: [moduleAddress], + reference: unknownReferencePolicyConfig, }); expect(request).toMatchObject({ signless: false, @@ -45,11 +192,11 @@ describe(`Given the ${useExecutionMode.name} hook`, () => { }); }); - describe('when executed with an unregistered Unknown Module', () => { - it('should opt for non-sponsored tx', async () => { + describe('when executed with an unregistered Unknown Reference or Unknown Open Action module', () => { + it('should return a sponsored=false, signless=false', async () => { const { renderHook } = setupHookTestScenario([ mockModuleMetadataResponse({ - implementation: moduleAddress, + implementation: unknownReferencePolicyConfig.address, result: null, }), ]); @@ -59,7 +206,7 @@ describe(`Given the ${useExecutionMode.name} hook`, () => { await act(async () => { const request = await result.current({ author, - unknownModules: [moduleAddress], + reference: unknownReferencePolicyConfig, }); expect(request).toMatchObject({ signless: false, diff --git a/packages/react/src/transactions/publications/__test__/useReferenceExecutionMode.spec.ts b/packages/react/src/transactions/publications/__test__/useReferenceExecutionMode.spec.ts deleted file mode 100644 index eb2144bb96..0000000000 --- a/packages/react/src/transactions/publications/__test__/useReferenceExecutionMode.spec.ts +++ /dev/null @@ -1,217 +0,0 @@ -import { ModuleType } from '@lens-protocol/api-bindings'; -import { - mockModuleMetadataResponse, - mockModuleMetadataResultFragment, - mockPostFragment, - mockProfileFragment, - mockPublicationResponse, - mockUnknownReferenceModuleSettings, -} from '@lens-protocol/api-bindings/mocks'; -import { - mockMomokaPublicationId, - mockPublicationId, - mockUnknownOpenActionConfig, - mockUnknownReferencePolicyConfig, -} from '@lens-protocol/domain/mocks'; -import { act } from '@testing-library/react'; - -import { setupHookTestScenario } from '../../../__helpers__/setupHookTestScenario'; -import { useReferenceExecutionMode } from '../useReferenceExecutionMode'; - -describe(`Given the ${useReferenceExecutionMode.name} hook`, () => { - const unknownOpenActionConfig = mockUnknownOpenActionConfig(); - const unknownReferencePolicyConfig = mockUnknownReferencePolicyConfig(); - const author = mockProfileFragment({ - sponsor: true, - signless: true, - }); - - describe('when referencing a Momoka publication', () => { - it(`should return sponsored=true and signless according to author.signless value`, async () => { - const referencedPublication = mockPostFragment({ - id: mockMomokaPublicationId(), - }); - - const { renderHook } = setupHookTestScenario([ - /* empty */ - ]); - - const { result } = renderHook(useReferenceExecutionMode); - - await act(async () => { - const request = await result.current({ - author, - referencedPublicationId: referencedPublication.id, - }); - expect(request).toMatchObject({ - signless: author.signless, - sponsored: true, - }); - }); - }); - }); - - describe('and the referenced publication is an on-chain publication', () => { - describe('when executed with sponsored=false', () => { - it('should return a sponsored=false, signless=false', async () => { - const referencedPublication = mockPostFragment({ - id: mockPublicationId(), - }); - - const { renderHook } = setupHookTestScenario([ - /* empty */ - ]); - - const { result } = renderHook(useReferenceExecutionMode); - - await act(async () => { - const request = await result.current({ - author, - referencedPublicationId: referencedPublication.id, - sponsored: false, - }); - expect(request).toMatchObject({ - signless: false, - sponsored: false, - }); - }); - }); - }); - - describe('when executed while the global "sponsored" flag is false', () => { - it('should return a sponsored=false, signless=false', async () => { - const referencedPublication = mockPostFragment({ - id: mockPublicationId(), - }); - - const { renderHook } = setupHookTestScenario( - [ - /* empty */ - ], - { sponsored: false }, - ); - - const { result } = renderHook(useReferenceExecutionMode); - - await act(async () => { - const request = await result.current({ - author, - referencedPublicationId: referencedPublication.id, - }); - expect(request).toMatchObject({ - signless: false, - sponsored: false, - }); - }); - }); - }); - - describe('when the referenced publication is configured with an Unknown Reference Policy', () => { - it('should take into account the corresponding module metadata', async () => { - const referenceModule = mockUnknownReferenceModuleSettings({ - sponsoredApproved: false, - signlessApproved: false, - }); - const referencedPublication = mockPostFragment({ - referenceModule, - }); - - const { renderHook } = setupHookTestScenario([ - mockPublicationResponse({ - variables: { - request: { forId: referencedPublication.id }, - }, - result: referencedPublication, - }), - ]); - - const { result } = renderHook(useReferenceExecutionMode); - - await act(async () => { - const request = await result.current({ - author, - referencedPublicationId: referencedPublication.id, - }); - expect(request).toMatchObject({ - signless: false, - sponsored: false, - }); - }); - }); - }); - - describe('and the referenced publication is using a sponsored Unknown Reference Policy or a built-in one', () => { - const referencedPublication = mockPostFragment(); - - describe('when executed with an Unknown Open Action configuration', () => { - it('should take into account the corresponding module metadata', async () => { - const { renderHook } = setupHookTestScenario([ - mockPublicationResponse({ - variables: { - request: { forId: referencedPublication.id }, - }, - result: referencedPublication, - }), - mockModuleMetadataResponse({ - implementation: unknownOpenActionConfig.address, - result: mockModuleMetadataResultFragment({ - signlessApproved: false, - sponsoredApproved: false, - moduleType: ModuleType.OpenAction, - }), - }), - ]); - - const { result } = renderHook(useReferenceExecutionMode); - - await act(async () => { - const request = await result.current({ - author, - actions: [unknownOpenActionConfig], - referencedPublicationId: referencedPublication.id, - }); - expect(request).toMatchObject({ - signless: false, - sponsored: false, - }); - }); - }); - }); - - describe('when executed with an Unknown Reference Policy configuration', () => { - it('should take into account the corresponding module metadata', async () => { - const { renderHook } = setupHookTestScenario([ - mockPublicationResponse({ - variables: { - request: { forId: referencedPublication.id }, - }, - result: referencedPublication, - }), - mockModuleMetadataResponse({ - implementation: unknownReferencePolicyConfig.address, - result: mockModuleMetadataResultFragment({ - signlessApproved: false, - sponsoredApproved: false, - moduleType: ModuleType.OpenAction, - }), - }), - ]); - - const { result } = renderHook(useReferenceExecutionMode); - - await act(async () => { - const request = await result.current({ - author, - referencedPublicationId: referencedPublication.id, - reference: unknownReferencePolicyConfig, - }); - expect(request).toMatchObject({ - signless: false, - sponsored: false, - }); - }); - }); - }); - }); - }); -}); diff --git a/packages/react/src/transactions/publications/useCreateComment.ts b/packages/react/src/transactions/publications/useCreateComment.ts index ba5bcef98c..704f72edf3 100644 --- a/packages/react/src/transactions/publications/useCreateComment.ts +++ b/packages/react/src/transactions/publications/useCreateComment.ts @@ -19,7 +19,7 @@ import { useDeferredTask, UseDeferredTask } from '../../helpers/tasks'; import { AsyncTransactionResult } from '../adapters/AsyncTransactionResult'; import { createCommentRequest } from '../adapters/schemas/builders'; import { useCreateCommentController } from '../adapters/useCreateCommentController'; -import { useReferenceExecutionMode } from './useReferenceExecutionMode'; +import { useExecutionMode } from './useExecutionMode'; /** * An object representing the result of a comment creation. @@ -495,7 +495,7 @@ export function useCreateComment(): UseDeferredTask< > { const { data: session } = useSession(); const createComment = useCreateCommentController(); - const resolveExecutionMode = useReferenceExecutionMode(); + const resolveExecutionMode = useExecutionMode(); return useDeferredTask(async (args: CreateCommentArgs) => { invariant( diff --git a/packages/react/src/transactions/publications/useCreateMirror.ts b/packages/react/src/transactions/publications/useCreateMirror.ts index ceb7075a1f..5273d00729 100644 --- a/packages/react/src/transactions/publications/useCreateMirror.ts +++ b/packages/react/src/transactions/publications/useCreateMirror.ts @@ -15,7 +15,7 @@ import { useDeferredTask, UseDeferredTask } from '../../helpers/tasks'; import { AsyncTransactionResult } from '../adapters/AsyncTransactionResult'; import { createMirrorRequest } from '../adapters/schemas/builders'; import { useCreateMirrorController } from '../adapters/useCreateMirrorController'; -import { useReferenceExecutionMode } from './useReferenceExecutionMode'; +import { useExecutionMode } from './useExecutionMode'; /** * An object representing the result of a mirror creation. @@ -244,7 +244,7 @@ export function useCreateMirror(): UseDeferredTask< > { const { data: session } = useSession(); const createMirror = useCreateMirrorController(); - const resolveExecutionMode = useReferenceExecutionMode(); + const resolveExecutionMode = useExecutionMode(); return useDeferredTask(async (args: CreateMirrorArgs) => { invariant( diff --git a/packages/react/src/transactions/publications/useCreatePost.ts b/packages/react/src/transactions/publications/useCreatePost.ts index e651e14792..c243aca4cb 100644 --- a/packages/react/src/transactions/publications/useCreatePost.ts +++ b/packages/react/src/transactions/publications/useCreatePost.ts @@ -17,7 +17,7 @@ import { useDeferredTask, UseDeferredTask } from '../../helpers/tasks'; import { AsyncTransactionResult } from '../adapters/AsyncTransactionResult'; import { createPostRequest } from '../adapters/schemas/builders'; import { useCreatePostController } from '../adapters/useCreatePostController'; -import { useCreatePostExecutionMode } from './useCreatePostExecutionMode'; +import { useExecutionMode } from './useExecutionMode'; /** * An object representing the result of a post creation. @@ -458,7 +458,7 @@ export function useCreatePost(): UseDeferredTask< CreatePostArgs > { const { data: session } = useSession(); - const resolveExecutionMode = useCreatePostExecutionMode(); + const resolveExecutionMode = useExecutionMode(); const createPost = useCreatePostController(); return useDeferredTask(async (args: CreatePostArgs) => { diff --git a/packages/react/src/transactions/publications/useCreatePostExecutionMode.ts b/packages/react/src/transactions/publications/useCreatePostExecutionMode.ts deleted file mode 100644 index e1d6b8d0b9..0000000000 --- a/packages/react/src/transactions/publications/useCreatePostExecutionMode.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { Profile } from '@lens-protocol/api-bindings'; -import { - OpenActionConfig, - ReferencePolicyConfig, -} from '@lens-protocol/domain/use-cases/publications'; - -import { useSharedDependencies } from '../../shared'; -import { extractUnknownModuleConfigAddresses } from './modules'; -import { useExecutionMode, TransactionExecutionMode } from './useExecutionMode'; - -export type CreatePostExecutionModeArgs = { - author: Profile; - actions: OpenActionConfig[] | undefined; // | undefined is intentional to force consumers to provide a value - reference: ReferencePolicyConfig | undefined; // | undefined is intentional to force consumers to provide a value - sponsored: boolean | undefined; // | undefined is intentional to force consumers to provide a value -}; - -export function useCreatePostExecutionMode() { - const resolve = useExecutionMode(); - const { config } = useSharedDependencies(); - - return async ({ - actions, - author, - reference, - sponsored, - }: CreatePostExecutionModeArgs): Promise => { - if (sponsored === false) { - return { signless: false, sponsored: false }; - } - - if (config.sponsored === false) { - return { signless: false, sponsored: false }; - } - - return resolve({ - author, - unknownModules: extractUnknownModuleConfigAddresses({ actions, reference }), - }); - }; -} diff --git a/packages/react/src/transactions/publications/useCreateQuote.ts b/packages/react/src/transactions/publications/useCreateQuote.ts index 83c6786e34..04b1ca18a5 100644 --- a/packages/react/src/transactions/publications/useCreateQuote.ts +++ b/packages/react/src/transactions/publications/useCreateQuote.ts @@ -19,7 +19,7 @@ import { useDeferredTask, UseDeferredTask } from '../../helpers/tasks'; import { AsyncTransactionResult } from '../adapters/AsyncTransactionResult'; import { createQuoteRequest } from '../adapters/schemas/builders'; import { useCreateQuoteController } from '../adapters/useCreateQuoteController'; -import { useReferenceExecutionMode } from './useReferenceExecutionMode'; +import { useExecutionMode } from './useExecutionMode'; /** * An object representing the result of a quote creation. @@ -467,7 +467,7 @@ export function useCreateQuote(): UseDeferredTask< > { const { data: session } = useSession(); const createQuote = useCreateQuoteController(); - const resolveExecutionMode = useReferenceExecutionMode(); + const resolveExecutionMode = useExecutionMode(); return useDeferredTask(async (args: CreateQuoteArgs) => { invariant( diff --git a/packages/react/src/transactions/publications/useExecutionMode.ts b/packages/react/src/transactions/publications/useExecutionMode.ts index 2b678a8ff4..ca28eb9552 100644 --- a/packages/react/src/transactions/publications/useExecutionMode.ts +++ b/packages/react/src/transactions/publications/useExecutionMode.ts @@ -1,8 +1,17 @@ -import { Profile } from '@lens-protocol/api-bindings'; -import { EvmAddress } from '@lens-protocol/shared-kernel'; +import { Profile, isPrimaryPublication, resolveReferencePolicy } from '@lens-protocol/api-bindings'; +import { PublicationId, isMomokaPublicationId } from '@lens-protocol/domain/entities'; +import { + OpenActionConfig, + ReferencePolicyConfig, + ReferencePolicyType, +} from '@lens-protocol/domain/use-cases/publications'; +import { invariant } from '@lens-protocol/shared-kernel'; import { NotFoundError } from '../../NotFoundError'; import { useLazyModuleMetadata } from '../../misc'; +import { useLazyPublication } from '../../publication'; +import { useSharedDependencies } from '../../shared'; +import { extractUnknownModuleConfigAddresses } from './modules'; export type TransactionExecutionMode = | { @@ -16,16 +25,65 @@ export type TransactionExecutionMode = export type ExecutionModeArgs = { author: Profile; - unknownModules: EvmAddress[]; + referencedPublicationId?: PublicationId; + actions?: OpenActionConfig[]; + reference?: ReferencePolicyConfig; + sponsored?: boolean; }; export function useExecutionMode() { - const { execute: fetch } = useLazyModuleMetadata(); + const { config } = useSharedDependencies(); + const { execute: fetchPublication } = useLazyPublication(); + const { execute: fetchModuleMetadata } = useLazyModuleMetadata(); return async ({ + actions, author, - unknownModules, + reference, + referencedPublicationId, + sponsored, }: ExecutionModeArgs): Promise => { + // TODO should be + if (sponsored === false) { + return { signless: false, sponsored: false }; + } + + if (config.sponsored === false) { + return { signless: false, sponsored: false }; + } + + if (referencedPublicationId && isMomokaPublicationId(referencedPublicationId)) { + return { + signless: author.signless, + sponsored: true, + }; + } + + if (referencedPublicationId) { + const result = await fetchPublication({ forId: referencedPublicationId }); + + const publication = result.unwrap(); + + invariant( + isPrimaryPublication(publication), + `Referenced publication ${referencedPublicationId} is not a primary publication: ${publication.__typename}`, + ); + + const referencePolicy = resolveReferencePolicy(publication); + + if (referencePolicy.type === ReferencePolicyType.UNKNOWN) { + if (!referencePolicy.sponsoredApproved) { + return { signless: false, sponsored: false }; + } + } + } + + const unknownModules = extractUnknownModuleConfigAddresses({ actions, reference }); + + const results = await Promise.all( + unknownModules.map((implementation) => fetchModuleMetadata({ implementation })), + ); + const desired: TransactionExecutionMode = author.sponsor ? { signless: author.signless, @@ -36,10 +94,6 @@ export function useExecutionMode() { sponsored: false, }; - const results = await Promise.all( - unknownModules.map((implementation) => fetch({ implementation })), - ); - for (const result of results) { if (result.isFailure()) { if (result.error instanceof NotFoundError) { diff --git a/packages/react/src/transactions/publications/useOptimisticCreatePost.ts b/packages/react/src/transactions/publications/useOptimisticCreatePost.ts index 60d609fedb..3f0b46e663 100644 --- a/packages/react/src/transactions/publications/useOptimisticCreatePost.ts +++ b/packages/react/src/transactions/publications/useOptimisticCreatePost.ts @@ -24,7 +24,7 @@ import { IUploader, UploadError } from './IUploader'; import { PublicationMetadataUploader } from './PublicationMetadataUploader'; import { post } from './optimistic'; import { PostAsyncResult } from './useCreatePost'; -import { useCreatePostExecutionMode } from './useCreatePostExecutionMode'; +import { useExecutionMode } from './useExecutionMode'; /** * Create new post details. @@ -276,7 +276,7 @@ export function useOptimisticCreatePost( return new PublicationMetadataUploader(uploader); }, [uploader]); const { data: session } = useSession(); - const resolveExecutionMode = useCreatePostExecutionMode(); + const resolveExecutionMode = useExecutionMode(); const createPost = useCreatePostController(); const [state, setState] = useState< diff --git a/packages/react/src/transactions/publications/useReferenceExecutionMode.ts b/packages/react/src/transactions/publications/useReferenceExecutionMode.ts deleted file mode 100644 index 79afb771fa..0000000000 --- a/packages/react/src/transactions/publications/useReferenceExecutionMode.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { Profile, isPrimaryPublication, resolveReferencePolicy } from '@lens-protocol/api-bindings'; -import { PublicationId, isMomokaPublicationId } from '@lens-protocol/domain/entities'; -import { - OpenActionConfig, - ReferencePolicyConfig, - ReferencePolicyType, -} from '@lens-protocol/domain/use-cases/publications'; -import { invariant } from '@lens-protocol/shared-kernel'; - -import { useLazyPublication } from '../../publication'; -import { useSharedDependencies } from '../../shared'; -import { extractUnknownModuleConfigAddresses } from './modules'; -import { useExecutionMode, TransactionExecutionMode } from './useExecutionMode'; - -export type ReferenceExecutionModeArgs = { - author: Profile; - referencedPublicationId: PublicationId; - actions?: OpenActionConfig[]; - reference?: ReferencePolicyConfig; - sponsored?: boolean; -}; - -export function useReferenceExecutionMode() { - const { config } = useSharedDependencies(); - const { execute: fetch } = useLazyPublication(); - const resolve = useExecutionMode(); - - return async ({ - actions, - author, - reference, - referencedPublicationId, - sponsored, - }: ReferenceExecutionModeArgs): Promise => { - if (isMomokaPublicationId(referencedPublicationId)) { - return { - signless: author.signless, - sponsored: true, - }; - } - - if (sponsored === false) { - return { signless: false, sponsored: false }; - } - - if (config.sponsored === false) { - return { signless: false, sponsored: false }; - } - - const result = await fetch({ forId: referencedPublicationId }); - - const publication = result.unwrap(); - - invariant( - isPrimaryPublication(publication), - `Referenced publication ${referencedPublicationId} is not a primary publication: ${publication.__typename}`, - ); - - const referencePolicy = resolveReferencePolicy(publication); - - if (referencePolicy.type === ReferencePolicyType.UNKNOWN) { - if (!referencePolicy.sponsoredApproved) { - return { signless: false, sponsored: false }; - } - } - - return resolve({ - author, - unknownModules: extractUnknownModuleConfigAddresses({ actions, reference }), - }); - }; -} From 880fb5de34d11c1c097346c489282ed7b041fcbb Mon Sep 17 00:00:00 2001 From: Cesare Naldi Date: Tue, 2 Apr 2024 15:22:07 +0200 Subject: [PATCH 5/8] Address code review comments --- .changeset/silly-paws-mate.md | 9 +++++++++ .../src/transactions/publications/useExecutionMode.ts | 1 - 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changeset/silly-paws-mate.md diff --git a/.changeset/silly-paws-mate.md b/.changeset/silly-paws-mate.md new file mode 100644 index 0000000000..6a02fd93c0 --- /dev/null +++ b/.changeset/silly-paws-mate.md @@ -0,0 +1,9 @@ +--- +"@lens-protocol/react-native": minor +"@lens-protocol/react-web": minor +"@lens-protocol/api-bindings": patch +"@lens-protocol/domain": patch +"@lens-protocol/react": patch +--- + +**feat:** supports Unknown Reference modules diff --git a/packages/react/src/transactions/publications/useExecutionMode.ts b/packages/react/src/transactions/publications/useExecutionMode.ts index ca28eb9552..766042dbab 100644 --- a/packages/react/src/transactions/publications/useExecutionMode.ts +++ b/packages/react/src/transactions/publications/useExecutionMode.ts @@ -43,7 +43,6 @@ export function useExecutionMode() { referencedPublicationId, sponsored, }: ExecutionModeArgs): Promise => { - // TODO should be if (sponsored === false) { return { signless: false, sponsored: false }; } From 8dcaeda6199f516782e5d89ddc1bbdb494204476 Mon Sep 17 00:00:00 2001 From: Cesare Naldi Date: Thu, 4 Apr 2024 08:40:51 +0100 Subject: [PATCH 6/8] chore: remove unused local-only field (#894) --- .changeset/chilled-turtles-pull.md | 8 + packages/api-bindings/codegen-api.yml | 2 +- .../__tests__/cursorBasedPagination.spec.ts | 14 +- .../cache/utils/cursorBasedPagination.ts | 24 -- .../src/lens/__helpers__/fragments.ts | 1 - .../src/lens/graphql/client.graphql | 3 - .../src/lens/graphql/fragments.graphql | 1 - .../src/lens/graphql/generated.ts | 397 +----------------- 8 files changed, 13 insertions(+), 437 deletions(-) create mode 100644 .changeset/chilled-turtles-pull.md delete mode 100644 packages/api-bindings/src/lens/graphql/client.graphql diff --git a/.changeset/chilled-turtles-pull.md b/.changeset/chilled-turtles-pull.md new file mode 100644 index 0000000000..2c9d09fa80 --- /dev/null +++ b/.changeset/chilled-turtles-pull.md @@ -0,0 +1,8 @@ +--- +"@lens-protocol/api-bindings": patch +"@lens-protocol/react-web": patch +"@lens-protocol/react": patch +"@lens-protocol/react-native": patch +--- + +**chore:** remove unused local-only field diff --git a/packages/api-bindings/codegen-api.yml b/packages/api-bindings/codegen-api.yml index 498b5dfe5e..7b28321a5e 100644 --- a/packages/api-bindings/codegen-api.yml +++ b/packages/api-bindings/codegen-api.yml @@ -63,7 +63,6 @@ generates: # - https://api-mumbai.lens-v2.crtlkey.com/ # staging - https://api-v2-mumbai-live.lens.dev/graphql # testnet # - http://localhost:4000/ - - src/lens/graphql/client.graphql documents: - src/lens/graphql/*.graphql plugins: @@ -98,5 +97,6 @@ generates: operationResultSuffix: 'Data' # goes with typescript-operations.operationResultSuffix fragmentVariablePrefix: Fragment # because FragmentDoc suffix is removed by omitOperationSuffix we need to add a prefix to differentiate fragment types from fragment documents documentMode: documentNode + withMutationFn: false - 'typescript-apollo-client-helpers' - 'fragment-matcher' diff --git a/packages/api-bindings/src/apollo/cache/utils/__tests__/cursorBasedPagination.spec.ts b/packages/api-bindings/src/apollo/cache/utils/__tests__/cursorBasedPagination.spec.ts index 6feefba895..d174ab7178 100644 --- a/packages/api-bindings/src/apollo/cache/utils/__tests__/cursorBasedPagination.spec.ts +++ b/packages/api-bindings/src/apollo/cache/utils/__tests__/cursorBasedPagination.spec.ts @@ -44,8 +44,7 @@ describe(`Given a cursor-based paginated query field`, () => { describe('when fetching the next page', () => { it(`should: - append incoming items to the existing ones - - update "pageInfo.prev" to results prior the first page and "pageInfo.next" to results after the new last page - - update "pageInfo.moreAfter" accordingly`, async () => { + - update "pageInfo.prev" to results prior the first page and "pageInfo.next" to results after the new last page`, async () => { const initialResult = mockAnyPaginatedQueryResult({ next: nextCursor, prev: prevCursor, @@ -76,7 +75,6 @@ describe(`Given a cursor-based paginated query field`, () => { expect(data.result).toMatchObject({ items: [...initialResult.items, ...nextResult.items], pageInfo: { - moreAfter: true, next: nextResult.pageInfo.next, prev: initialResult.pageInfo.prev, }, @@ -84,9 +82,7 @@ describe(`Given a cursor-based paginated query field`, () => { }); describe('but the incoming result is empty', () => { - it(`should: - - NOT update the "pageInfo.next" cursor - - unset the "pageInfo.moreAfter" flag`, async () => { + it(`should NOT update the "pageInfo.next" cursor`, async () => { const initialResult = mockAnyPaginatedQueryResult({ next: nextCursor, prev: prevCursor, @@ -116,7 +112,6 @@ describe(`Given a cursor-based paginated query field`, () => { expect(data.result).toMatchObject({ pageInfo: { - moreAfter: false, next: initialResult.pageInfo.next, prev: initialResult.pageInfo.prev, }, @@ -128,8 +123,7 @@ describe(`Given a cursor-based paginated query field`, () => { describe('when fetching the previous page', () => { it(`should: - prepend incoming items to the existing ones - - update the "pageInfo.prev" to results prior the new first page and "pageInfo.next" to results after the last page - - update the "pageInfo.moreAfter" accordingly`, async () => { + - update the "pageInfo.prev" to results prior the new first page and "pageInfo.next" to results after the last page`, async () => { const initialResult = mockAnyPaginatedQueryResult({ prev: prevCursor, next: null, @@ -160,7 +154,6 @@ describe(`Given a cursor-based paginated query field`, () => { expect(data.result).toMatchObject({ items: [...prevResult.items, ...initialResult.items], pageInfo: { - moreAfter: false, next: initialResult.pageInfo.next, prev: prevResult.pageInfo.prev, }, @@ -198,7 +191,6 @@ describe(`Given a cursor-based paginated query field`, () => { expect(data.result).toMatchObject({ pageInfo: { - moreAfter: true, next: initialResult.pageInfo.next, prev: initialResult.pageInfo.prev, }, diff --git a/packages/api-bindings/src/apollo/cache/utils/cursorBasedPagination.ts b/packages/api-bindings/src/apollo/cache/utils/cursorBasedPagination.ts index 7f72afd3a4..92d5faa422 100644 --- a/packages/api-bindings/src/apollo/cache/utils/cursorBasedPagination.ts +++ b/packages/api-bindings/src/apollo/cache/utils/cursorBasedPagination.ts @@ -23,26 +23,6 @@ export function cursorBasedPagination | undefined) { - if (!existing) { - return existing; - } - - const { items, pageInfo } = existing; - - // items that are not in the cache anymore (for .e.g deleted publication) - const readRes: SafeReadonly = { - ...existing, - items, - pageInfo: { - ...pageInfo, - moreAfter: existing.pageInfo.moreAfter ?? existing.pageInfo.next !== null, - }, - }; - - return readRes; - }, - merge( existing: SafeReadonly | undefined, incoming: SafeReadonly, @@ -61,7 +41,6 @@ export function cursorBasedPagination = {}, ): gql.PaginatedResultInfo { return { - moreAfter: false, prev: null, next: null, ...overrides, diff --git a/packages/api-bindings/src/lens/graphql/client.graphql b/packages/api-bindings/src/lens/graphql/client.graphql deleted file mode 100644 index 712d8324b5..0000000000 --- a/packages/api-bindings/src/lens/graphql/client.graphql +++ /dev/null @@ -1,3 +0,0 @@ -extend type PaginatedResultInfo { - moreAfter: Boolean! -} diff --git a/packages/api-bindings/src/lens/graphql/fragments.graphql b/packages/api-bindings/src/lens/graphql/fragments.graphql index a4641e66bb..57202c446c 100644 --- a/packages/api-bindings/src/lens/graphql/fragments.graphql +++ b/packages/api-bindings/src/lens/graphql/fragments.graphql @@ -385,7 +385,6 @@ fragment ProfileMentioned on ProfileMentioned { fragment PaginatedResultInfo on PaginatedResultInfo { __typename - moreAfter @client prev next } diff --git a/packages/api-bindings/src/lens/graphql/generated.ts b/packages/api-bindings/src/lens/graphql/generated.ts index 9f6348762b..679c61b84b 100644 --- a/packages/api-bindings/src/lens/graphql/generated.ts +++ b/packages/api-bindings/src/lens/graphql/generated.ts @@ -27,89 +27,47 @@ export type Scalars = { Boolean: boolean; Int: number; Float: number; - /** The ABI json string */ ABIJson: string; - /** The app id */ AppId: AppId; - /** Blockchain data */ BlockchainData: string; - /** The broadcast id */ BroadcastId: string; - /** The chain id */ ChainId: number; - /** The challenge id */ ChallengeId: string; - /** The content encryption key value */ ContentEncryptionKey: ContentEncryptionKey; - /** Create handle value */ CreateHandle: string; - /** Cursor custom scalar type */ Cursor: Cursor; - /** The javascript `Date` as string. Type represents date and time as the ISO Date string. */ DateTime: string; - /** An ISO-8610 DateTime that could also be encrypted in some circumstances. Check parent nodes to determine if the value is encrypted or ready to use. */ EncryptableDateTime: string; - /** A Markdown text that could also be encrypted in some circumstances. Check parent nodes to determine if the value is encrypted or ready to use. */ EncryptableMarkdown: string; - /** A string that could also be encrypted in some circumstances. Check parent nodes to determine if the value is encrypted or ready to use. */ EncryptableString: string; - /** The tx hash that could also be encrypted in some circumstances. Check parent nodes to determine if the value is encrypted or ready to use. */ EncryptableTxHash: string; - /** A URI value that could also be encrypted in some circumstances. Check parent nodes to determine if the value is encrypted or ready to use. */ EncryptableURI: string; - /** Define a path of a possibly encrypted property in the Publication Metadata */ EncryptedPath: string; - /** The ens name */ Ens: string; - /** evm address type */ EvmAddress: EvmAddress; - /** The handle attached to a profile - note its it own NFT and always identified by its full name */ Handle: string; - /** The image size transform */ ImageSizeTransform: ImageSizeTransform; - /** The jwt token */ Jwt: string; - /** The locale */ Locale: string; - /** The markdown value */ Markdown: string; - /** Mimetype type */ MimeType: string; - /** The momoka id */ MomokaId: string; - /** The momoka proof */ MomokaProof: string; - /** Nft gallery id type */ NftGalleryId: string; - /** Nft gallery name type */ NftGalleryName: string; - /** The nonce value */ Nonce: number; - /** The onchain publication id */ OnchainPublicationId: string; - /** The Poap Event id */ PoapEventId: string; - /** ProfileId custom scalar type */ ProfileId: ProfileId; - /** Publication id */ PublicationId: PublicationId; - /** The signature value */ Signature: string; - /** The NFT token id */ TokenId: string; - /** The tx hash */ TxHash: string; - /** The tx id */ TxId: string; - /** The URI value not this can be used in it can be a https OR different aka ar:// and ipfs:// */ URI: URI; - /** The url value */ URL: URL; - /** The guid uuid value */ UUID: string; - /** The unix timestamp */ UnixTimestamp: number; - /** Represents NULL values */ Void: void; }; @@ -2469,7 +2427,6 @@ export type ProfileMentioned = { export type PaginatedResultInfo = { __typename: 'PaginatedResultInfo'; - moreAfter: boolean; prev: Cursor | null; next: Cursor | null; }; @@ -89999,11 +89956,6 @@ export const FragmentPaginatedResultInfo = /*#__PURE__*/ { kind: 'SelectionSet', selections: [ { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'moreAfter' }, - directives: [{ kind: 'Directive', name: { kind: 'Name', value: 'client' } }], - }, { kind: 'Field', name: { kind: 'Name', value: 'prev' } }, { kind: 'Field', name: { kind: 'Name', value: 'next' } }, ], @@ -160778,10 +160730,6 @@ export const ActOnOpenActionDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type ActOnOpenActionMutationFn = Apollo.MutationFunction< - ActOnOpenActionData, - ActOnOpenActionVariables ->; /** * __useActOnOpenAction__ @@ -160990,10 +160938,6 @@ export const CreateActOnOpenActionTypedDataDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type CreateActOnOpenActionTypedDataMutationFn = Apollo.MutationFunction< - CreateActOnOpenActionTypedDataData, - CreateActOnOpenActionTypedDataVariables ->; /** * __useCreateActOnOpenActionTypedData__ @@ -161242,10 +161186,6 @@ export const AuthAuthenticateDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type AuthAuthenticateMutationFn = Apollo.MutationFunction< - AuthAuthenticateData, - AuthAuthenticateVariables ->; /** * __useAuthAuthenticate__ @@ -161324,7 +161264,6 @@ export const AuthRefreshDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type AuthRefreshMutationFn = Apollo.MutationFunction; /** * __useAuthRefresh__ @@ -161403,10 +161342,6 @@ export const WalletAuthenticationToProfileAuthenticationDocument = /*#__PURE__*/ }, ], } as unknown as DocumentNode; -export type WalletAuthenticationToProfileAuthenticationMutationFn = Apollo.MutationFunction< - WalletAuthenticationToProfileAuthenticationData, - WalletAuthenticationToProfileAuthenticationVariables ->; /** * __useWalletAuthenticationToProfileAuthentication__ @@ -161485,10 +161420,6 @@ export const RevokeAuthenticationDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type RevokeAuthenticationMutationFn = Apollo.MutationFunction< - RevokeAuthenticationData, - RevokeAuthenticationVariables ->; /** * __useRevokeAuthentication__ @@ -162934,11 +162865,6 @@ export const ExplorePublicationsDocument = /*#__PURE__*/ { kind: 'SelectionSet', selections: [ { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'moreAfter' }, - directives: [{ kind: 'Directive', name: { kind: 'Name', value: 'client' } }], - }, { kind: 'Field', name: { kind: 'Name', value: 'prev' } }, { kind: 'Field', name: { kind: 'Name', value: 'next' } }, ], @@ -169538,11 +169464,6 @@ export const ExploreProfilesDocument = /*#__PURE__*/ { kind: 'SelectionSet', selections: [ { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'moreAfter' }, - directives: [{ kind: 'Directive', name: { kind: 'Name', value: 'client' } }], - }, { kind: 'Field', name: { kind: 'Name', value: 'prev' } }, { kind: 'Field', name: { kind: 'Name', value: 'next' } }, ], @@ -171051,11 +170972,6 @@ export const FeedDocument = /*#__PURE__*/ { kind: 'SelectionSet', selections: [ { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'moreAfter' }, - directives: [{ kind: 'Directive', name: { kind: 'Name', value: 'client' } }], - }, { kind: 'Field', name: { kind: 'Name', value: 'prev' } }, { kind: 'Field', name: { kind: 'Name', value: 'next' } }, ], @@ -178084,11 +178000,6 @@ export const FeedHighlightsDocument = /*#__PURE__*/ { kind: 'SelectionSet', selections: [ { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'moreAfter' }, - directives: [{ kind: 'Directive', name: { kind: 'Name', value: 'client' } }], - }, { kind: 'Field', name: { kind: 'Name', value: 'prev' } }, { kind: 'Field', name: { kind: 'Name', value: 'next' } }, ], @@ -185220,7 +185131,6 @@ export const InviteDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type InviteMutationFn = Apollo.MutationFunction; /** * __useInvite__ @@ -185370,11 +185280,6 @@ export const CurrenciesDocument = /*#__PURE__*/ { kind: 'SelectionSet', selections: [ { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'moreAfter' }, - directives: [{ kind: 'Directive', name: { kind: 'Name', value: 'client' } }], - }, { kind: 'Field', name: { kind: 'Name', value: 'prev' } }, { kind: 'Field', name: { kind: 'Name', value: 'next' } }, ], @@ -187026,11 +186931,6 @@ export const NotificationsDocument = /*#__PURE__*/ { kind: 'SelectionSet', selections: [ { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'moreAfter' }, - directives: [{ kind: 'Directive', name: { kind: 'Name', value: 'client' } }], - }, { kind: 'Field', name: { kind: 'Name', value: 'prev' } }, { kind: 'Field', name: { kind: 'Name', value: 'next' } }, ], @@ -195277,11 +195177,6 @@ export const ProfilesDocument = /*#__PURE__*/ { kind: 'SelectionSet', selections: [ { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'moreAfter' }, - directives: [{ kind: 'Directive', name: { kind: 'Name', value: 'client' } }], - }, { kind: 'Field', name: { kind: 'Name', value: 'prev' } }, { kind: 'Field', name: { kind: 'Name', value: 'next' } }, ], @@ -195397,11 +195292,6 @@ export const ProfileManagersDocument = /*#__PURE__*/ { kind: 'SelectionSet', selections: [ { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'moreAfter' }, - directives: [{ kind: 'Directive', name: { kind: 'Name', value: 'client' } }], - }, { kind: 'Field', name: { kind: 'Name', value: 'prev' } }, { kind: 'Field', name: { kind: 'Name', value: 'next' } }, ], @@ -196564,11 +196454,6 @@ export const ProfileRecommendationsDocument = /*#__PURE__*/ { kind: 'SelectionSet', selections: [ { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'moreAfter' }, - directives: [{ kind: 'Directive', name: { kind: 'Name', value: 'client' } }], - }, { kind: 'Field', name: { kind: 'Name', value: 'prev' } }, { kind: 'Field', name: { kind: 'Name', value: 'next' } }, ], @@ -197713,11 +197598,6 @@ export const FollowingDocument = /*#__PURE__*/ { kind: 'SelectionSet', selections: [ { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'moreAfter' }, - directives: [{ kind: 'Directive', name: { kind: 'Name', value: 'client' } }], - }, { kind: 'Field', name: { kind: 'Name', value: 'prev' } }, { kind: 'Field', name: { kind: 'Name', value: 'next' } }, ], @@ -198846,11 +198726,6 @@ export const FollowersDocument = /*#__PURE__*/ { kind: 'SelectionSet', selections: [ { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'moreAfter' }, - directives: [{ kind: 'Directive', name: { kind: 'Name', value: 'client' } }], - }, { kind: 'Field', name: { kind: 'Name', value: 'prev' } }, { kind: 'Field', name: { kind: 'Name', value: 'next' } }, ], @@ -199992,11 +199867,6 @@ export const MutualFollowersDocument = /*#__PURE__*/ { kind: 'SelectionSet', selections: [ { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'moreAfter' }, - directives: [{ kind: 'Directive', name: { kind: 'Name', value: 'client' } }], - }, { kind: 'Field', name: { kind: 'Name', value: 'prev' } }, { kind: 'Field', name: { kind: 'Name', value: 'next' } }, ], @@ -201145,11 +201015,6 @@ export const WhoActedOnPublicationDocument = /*#__PURE__*/ { kind: 'SelectionSet', selections: [ { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'moreAfter' }, - directives: [{ kind: 'Directive', name: { kind: 'Name', value: 'client' } }], - }, { kind: 'Field', name: { kind: 'Name', value: 'prev' } }, { kind: 'Field', name: { kind: 'Name', value: 'next' } }, ], @@ -202280,11 +202145,6 @@ export const WhoHaveBlockedDocument = /*#__PURE__*/ { kind: 'SelectionSet', selections: [ { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'moreAfter' }, - directives: [{ kind: 'Directive', name: { kind: 'Name', value: 'client' } }], - }, { kind: 'Field', name: { kind: 'Name', value: 'prev' } }, { kind: 'Field', name: { kind: 'Name', value: 'next' } }, ], @@ -202429,11 +202289,6 @@ export const ProfileActionHistoryDocument = /*#__PURE__*/ { kind: 'SelectionSet', selections: [ { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'moreAfter' }, - directives: [{ kind: 'Directive', name: { kind: 'Name', value: 'client' } }], - }, { kind: 'Field', name: { kind: 'Name', value: 'prev' } }, { kind: 'Field', name: { kind: 'Name', value: 'next' } }, ], @@ -202712,10 +202567,6 @@ export const ClaimProfileWithHandleDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type ClaimProfileWithHandleMutationFn = Apollo.MutationFunction< - ClaimProfileWithHandleData, - ClaimProfileWithHandleVariables ->; /** * __useClaimProfileWithHandle__ @@ -202790,10 +202641,6 @@ export const AddProfileInterestsDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type AddProfileInterestsMutationFn = Apollo.MutationFunction< - AddProfileInterestsData, - AddProfileInterestsVariables ->; /** * __useAddProfileInterests__ @@ -202864,10 +202711,6 @@ export const RemoveProfileInterestsDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type RemoveProfileInterestsMutationFn = Apollo.MutationFunction< - RemoveProfileInterestsData, - RemoveProfileInterestsVariables ->; /** * __useRemoveProfileInterests__ @@ -203007,10 +202850,6 @@ export const SetProfileMetadataDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type SetProfileMetadataMutationFn = Apollo.MutationFunction< - SetProfileMetadataData, - SetProfileMetadataVariables ->; /** * __useSetProfileMetadata__ @@ -203143,7 +202982,6 @@ export const BlockDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type BlockMutationFn = Apollo.MutationFunction; /** * __useBlock__ @@ -203268,7 +203106,6 @@ export const UnblockDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type UnblockMutationFn = Apollo.MutationFunction; /** * __useUnblock__ @@ -203395,7 +203232,6 @@ export const FollowDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type FollowMutationFn = Apollo.MutationFunction; /** * __useFollow__ @@ -203520,7 +203356,6 @@ export const UnfollowDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type UnfollowMutationFn = Apollo.MutationFunction; /** * __useUnfollow__ @@ -203588,10 +203423,6 @@ export const DismissRecommendedProfilesDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type DismissRecommendedProfilesMutationFn = Apollo.MutationFunction< - DismissRecommendedProfilesData, - DismissRecommendedProfilesVariables ->; /** * __useDismissRecommendedProfiles__ @@ -203777,10 +203608,6 @@ export const CreateOnchainSetProfileMetadataTypedDataDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type CreateOnchainSetProfileMetadataTypedDataMutationFn = Apollo.MutationFunction< - CreateOnchainSetProfileMetadataTypedDataData, - CreateOnchainSetProfileMetadataTypedDataVariables ->; /** * __useCreateOnchainSetProfileMetadataTypedData__ @@ -203969,10 +203796,6 @@ export const CreateChangeProfileManagersTypedDataDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type CreateChangeProfileManagersTypedDataMutationFn = Apollo.MutationFunction< - CreateChangeProfileManagersTypedDataData, - CreateChangeProfileManagersTypedDataVariables ->; /** * __useCreateChangeProfileManagersTypedData__ @@ -204159,10 +203982,6 @@ export const CreateBlockProfilesTypedDataDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type CreateBlockProfilesTypedDataMutationFn = Apollo.MutationFunction< - CreateBlockProfilesTypedDataData, - CreateBlockProfilesTypedDataVariables ->; /** * __useCreateBlockProfilesTypedData__ @@ -204349,10 +204168,6 @@ export const CreateUnblockProfilesTypedDataDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type CreateUnblockProfilesTypedDataMutationFn = Apollo.MutationFunction< - CreateUnblockProfilesTypedDataData, - CreateUnblockProfilesTypedDataVariables ->; /** * __useCreateUnblockProfilesTypedData__ @@ -204537,10 +204352,6 @@ export const CreateFollowTypedDataDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type CreateFollowTypedDataMutationFn = Apollo.MutationFunction< - CreateFollowTypedDataData, - CreateFollowTypedDataVariables ->; /** * __useCreateFollowTypedData__ @@ -204720,10 +204531,6 @@ export const CreateUnfollowTypedDataDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type CreateUnfollowTypedDataMutationFn = Apollo.MutationFunction< - CreateUnfollowTypedDataData, - CreateUnfollowTypedDataVariables ->; /** * __useCreateUnfollowTypedData__ @@ -204861,10 +204668,6 @@ export const SetFollowModuleDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type SetFollowModuleMutationFn = Apollo.MutationFunction< - SetFollowModuleData, - SetFollowModuleVariables ->; /** * __useSetFollowModule__ @@ -205041,10 +204844,6 @@ export const CreateSetFollowModuleTypedDataDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type CreateSetFollowModuleTypedDataMutationFn = Apollo.MutationFunction< - CreateSetFollowModuleTypedDataData, - CreateSetFollowModuleTypedDataVariables ->; /** * __useCreateSetFollowModuleTypedData__ @@ -205187,10 +204986,6 @@ export const LinkHandleToProfileDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type LinkHandleToProfileMutationFn = Apollo.MutationFunction< - LinkHandleToProfileData, - LinkHandleToProfileVariables ->; /** * __useLinkHandleToProfile__ @@ -205326,10 +205121,6 @@ export const UnlinkHandleFromProfileDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type UnlinkHandleFromProfileMutationFn = Apollo.MutationFunction< - UnlinkHandleFromProfileData, - UnlinkHandleFromProfileVariables ->; /** * __useUnlinkHandleFromProfile__ @@ -205526,10 +205317,6 @@ export const CreateLinkHandleToProfileTypedDataDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type CreateLinkHandleToProfileTypedDataMutationFn = Apollo.MutationFunction< - CreateLinkHandleToProfileTypedDataData, - CreateLinkHandleToProfileTypedDataVariables ->; /** * __useCreateLinkHandleToProfileTypedData__ @@ -205729,10 +205516,6 @@ export const CreateUnlinkHandleFromProfileTypedDataDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type CreateUnlinkHandleFromProfileTypedDataMutationFn = Apollo.MutationFunction< - CreateUnlinkHandleFromProfileTypedDataData, - CreateUnlinkHandleFromProfileTypedDataVariables ->; /** * __useCreateUnlinkHandleFromProfileTypedData__ @@ -205809,10 +205592,6 @@ export const ReportProfileDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type ReportProfileMutationFn = Apollo.MutationFunction< - ReportProfileData, - ReportProfileVariables ->; /** * __useReportProfile__ @@ -205885,10 +205664,6 @@ export const PeerToPeerRecommendDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type PeerToPeerRecommendMutationFn = Apollo.MutationFunction< - PeerToPeerRecommendData, - PeerToPeerRecommendVariables ->; /** * __usePeerToPeerRecommend__ @@ -205961,10 +205736,6 @@ export const PeerToPeerUnrecommendDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type PeerToPeerUnrecommendMutationFn = Apollo.MutationFunction< - PeerToPeerUnrecommendData, - PeerToPeerUnrecommendVariables ->; /** * __usePeerToPeerUnrecommend__ @@ -214398,11 +214169,6 @@ export const PublicationsDocument = /*#__PURE__*/ { kind: 'SelectionSet', selections: [ { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'moreAfter' }, - directives: [{ kind: 'Directive', name: { kind: 'Name', value: 'client' } }], - }, { kind: 'Field', name: { kind: 'Name', value: 'prev' } }, { kind: 'Field', name: { kind: 'Name', value: 'next' } }, ], @@ -220115,11 +219881,6 @@ export const PublicationsTagsDocument = /*#__PURE__*/ { kind: 'SelectionSet', selections: [ { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'moreAfter' }, - directives: [{ kind: 'Directive', name: { kind: 'Name', value: 'client' } }], - }, { kind: 'Field', name: { kind: 'Name', value: 'prev' } }, { kind: 'Field', name: { kind: 'Name', value: 'next' } }, ], @@ -221689,11 +221450,6 @@ export const PublicationBookmarksDocument = /*#__PURE__*/ { kind: 'SelectionSet', selections: [ { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'moreAfter' }, - directives: [{ kind: 'Directive', name: { kind: 'Name', value: 'client' } }], - }, { kind: 'Field', name: { kind: 'Name', value: 'prev' } }, { kind: 'Field', name: { kind: 'Name', value: 'next' } }, ], @@ -227490,10 +227246,6 @@ export const CreateOnchainPostTypedDataDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type CreateOnchainPostTypedDataMutationFn = Apollo.MutationFunction< - CreateOnchainPostTypedDataData, - CreateOnchainPostTypedDataVariables ->; /** * __useCreateOnchainPostTypedData__ @@ -227683,10 +227435,6 @@ export const CreateOnchainCommentTypedDataDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type CreateOnchainCommentTypedDataMutationFn = Apollo.MutationFunction< - CreateOnchainCommentTypedDataData, - CreateOnchainCommentTypedDataVariables ->; /** * __useCreateOnchainCommentTypedData__ @@ -227874,10 +227622,6 @@ export const CreateOnchainMirrorTypedDataDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type CreateOnchainMirrorTypedDataMutationFn = Apollo.MutationFunction< - CreateOnchainMirrorTypedDataData, - CreateOnchainMirrorTypedDataVariables ->; /** * __useCreateOnchainMirrorTypedData__ @@ -228083,10 +227827,6 @@ export const CreateOnchainQuoteTypedDataDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type CreateOnchainQuoteTypedDataMutationFn = Apollo.MutationFunction< - CreateOnchainQuoteTypedDataData, - CreateOnchainQuoteTypedDataVariables ->; /** * __useCreateOnchainQuoteTypedData__ @@ -228263,10 +228003,6 @@ export const CreateMomokaPostTypedDataDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type CreateMomokaPostTypedDataMutationFn = Apollo.MutationFunction< - CreateMomokaPostTypedDataData, - CreateMomokaPostTypedDataVariables ->; /** * __useCreateMomokaPostTypedData__ @@ -228445,10 +228181,6 @@ export const CreateMomokaCommentTypedDataDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type CreateMomokaCommentTypedDataMutationFn = Apollo.MutationFunction< - CreateMomokaCommentTypedDataData, - CreateMomokaCommentTypedDataVariables ->; /** * __useCreateMomokaCommentTypedData__ @@ -228625,10 +228357,6 @@ export const CreateMomokaMirrorTypedDataDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type CreateMomokaMirrorTypedDataMutationFn = Apollo.MutationFunction< - CreateMomokaMirrorTypedDataData, - CreateMomokaMirrorTypedDataVariables ->; /** * __useCreateMomokaMirrorTypedData__ @@ -228809,10 +228537,6 @@ export const CreateMomokaQuoteTypedDataDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type CreateMomokaQuoteTypedDataMutationFn = Apollo.MutationFunction< - CreateMomokaQuoteTypedDataData, - CreateMomokaQuoteTypedDataVariables ->; /** * __useCreateMomokaQuoteTypedData__ @@ -228949,7 +228673,6 @@ export const PostOnchainDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type PostOnchainMutationFn = Apollo.MutationFunction; /** * __usePostOnchain__ @@ -229079,10 +228802,6 @@ export const CommentOnchainDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type CommentOnchainMutationFn = Apollo.MutationFunction< - CommentOnchainData, - CommentOnchainVariables ->; /** * __useCommentOnchain__ @@ -229215,10 +228934,6 @@ export const MirrorOnchainDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type MirrorOnchainMutationFn = Apollo.MutationFunction< - MirrorOnchainData, - MirrorOnchainVariables ->; /** * __useMirrorOnchain__ @@ -229351,10 +229066,6 @@ export const QuoteOnchainDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type QuoteOnchainMutationFn = Apollo.MutationFunction< - QuoteOnchainData, - QuoteOnchainVariables ->; /** * __useQuoteOnchain__ @@ -229491,10 +229202,6 @@ export const PostOnMomokaDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type PostOnMomokaMutationFn = Apollo.MutationFunction< - PostOnMomokaData, - PostOnMomokaVariables ->; /** * __usePostOnMomoka__ @@ -229631,10 +229338,6 @@ export const CommentOnMomokaDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type CommentOnMomokaMutationFn = Apollo.MutationFunction< - CommentOnMomokaData, - CommentOnMomokaVariables ->; /** * __useCommentOnMomoka__ @@ -229774,10 +229477,6 @@ export const MirrorOnMomokaDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type MirrorOnMomokaMutationFn = Apollo.MutationFunction< - MirrorOnMomokaData, - MirrorOnMomokaVariables ->; /** * __useMirrorOnMomoka__ @@ -229917,10 +229616,6 @@ export const QuoteOnMomokaDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type QuoteOnMomokaMutationFn = Apollo.MutationFunction< - QuoteOnMomokaData, - QuoteOnMomokaVariables ->; /** * __useQuoteOnMomoka__ @@ -229990,10 +229685,6 @@ export const HidePublicationDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type HidePublicationMutationFn = Apollo.MutationFunction< - HidePublicationData, - HidePublicationVariables ->; /** * __useHidePublication__ @@ -230063,10 +229754,6 @@ export const ReportPublicationDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type ReportPublicationMutationFn = Apollo.MutationFunction< - ReportPublicationData, - ReportPublicationVariables ->; /** * __useReportPublication__ @@ -230199,10 +229886,6 @@ export const LegacyCollectDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type LegacyCollectMutationFn = Apollo.MutationFunction< - LegacyCollectData, - LegacyCollectVariables ->; /** * __useLegacyCollect__ @@ -230410,10 +230093,6 @@ export const CreateLegacyCollectTypedDataDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type CreateLegacyCollectTypedDataMutationFn = Apollo.MutationFunction< - CreateLegacyCollectTypedDataData, - CreateLegacyCollectTypedDataVariables ->; /** * __useCreateLegacyCollectTypedData__ @@ -230498,10 +230177,6 @@ export const RefreshPublicationMetadataDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type RefreshPublicationMetadataMutationFn = Apollo.MutationFunction< - RefreshPublicationMetadataData, - RefreshPublicationMetadataVariables ->; /** * __useRefreshPublicationMetadata__ @@ -230579,10 +230254,6 @@ export const AddPublicationBookmarkDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type AddPublicationBookmarkMutationFn = Apollo.MutationFunction< - AddPublicationBookmarkData, - AddPublicationBookmarkVariables ->; /** * __useAddPublicationBookmark__ @@ -230660,10 +230331,6 @@ export const RemovePublicationBookmarkDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type RemovePublicationBookmarkMutationFn = Apollo.MutationFunction< - RemovePublicationBookmarkData, - RemovePublicationBookmarkVariables ->; /** * __useRemovePublicationBookmark__ @@ -230740,10 +230407,6 @@ export const AddPublicationNotInterestedDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type AddPublicationNotInterestedMutationFn = Apollo.MutationFunction< - AddPublicationNotInterestedData, - AddPublicationNotInterestedVariables ->; /** * __useAddPublicationNotInterested__ @@ -230822,10 +230485,6 @@ export const UndoPublicationNotInterestedDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type UndoPublicationNotInterestedMutationFn = Apollo.MutationFunction< - UndoPublicationNotInterestedData, - UndoPublicationNotInterestedVariables ->; /** * __useUndoPublicationNotInterested__ @@ -230901,7 +230560,6 @@ export const HideCommentDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type HideCommentMutationFn = Apollo.MutationFunction; /** * __useHideComment__ @@ -230968,10 +230626,6 @@ export const UnhideCommentDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type UnhideCommentMutationFn = Apollo.MutationFunction< - UnhideCommentData, - UnhideCommentVariables ->; /** * __useUnhideComment__ @@ -231041,7 +230695,6 @@ export const AddReactionDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type AddReactionMutationFn = Apollo.MutationFunction; /** * __useAddReaction__ @@ -231108,10 +230761,6 @@ export const RemoveReactionDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type RemoveReactionMutationFn = Apollo.MutationFunction< - RemoveReactionData, - RemoveReactionVariables ->; /** * __useRemoveReaction__ @@ -232240,11 +231889,6 @@ export const WhoReactedPublicationDocument = /*#__PURE__*/ { kind: 'SelectionSet', selections: [ { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'moreAfter' }, - directives: [{ kind: 'Directive', name: { kind: 'Name', value: 'client' } }], - }, { kind: 'Field', name: { kind: 'Name', value: 'prev' } }, { kind: 'Field', name: { kind: 'Name', value: 'next' } }, ], @@ -233740,11 +233384,6 @@ export const RevenueFromPublicationsDocument = /*#__PURE__*/ { kind: 'SelectionSet', selections: [ { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'moreAfter' }, - directives: [{ kind: 'Directive', name: { kind: 'Name', value: 'client' } }], - }, { kind: 'Field', name: { kind: 'Name', value: 'prev' } }, { kind: 'Field', name: { kind: 'Name', value: 'next' } }, ], @@ -248185,11 +247824,6 @@ export const SearchPublicationsDocument = /*#__PURE__*/ { kind: 'SelectionSet', selections: [ { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'moreAfter' }, - directives: [{ kind: 'Directive', name: { kind: 'Name', value: 'client' } }], - }, { kind: 'Field', name: { kind: 'Name', value: 'prev' } }, { kind: 'Field', name: { kind: 'Name', value: 'next' } }, ], @@ -254856,11 +254490,6 @@ export const SearchProfilesDocument = /*#__PURE__*/ { kind: 'SelectionSet', selections: [ { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'moreAfter' }, - directives: [{ kind: 'Directive', name: { kind: 'Name', value: 'client' } }], - }, { kind: 'Field', name: { kind: 'Name', value: 'prev' } }, { kind: 'Field', name: { kind: 'Name', value: 'next' } }, ], @@ -255279,10 +254908,6 @@ export const BroadcastOnchainDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type BroadcastOnchainMutationFn = Apollo.MutationFunction< - BroadcastOnchainData, - BroadcastOnchainVariables ->; /** * __useBroadcastOnchain__ @@ -255413,10 +255038,6 @@ export const BroadcastOnMomokaDocument = /*#__PURE__*/ { }, ], } as unknown as DocumentNode; -export type BroadcastOnMomokaMutationFn = Apollo.MutationFunction< - BroadcastOnMomokaData, - BroadcastOnMomokaVariables ->; /** * __useBroadcastOnMomoka__ @@ -255680,11 +255301,6 @@ export const OwnedHandlesDocument = /*#__PURE__*/ { kind: 'SelectionSet', selections: [ { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'moreAfter' }, - directives: [{ kind: 'Directive', name: { kind: 'Name', value: 'client' } }], - }, { kind: 'Field', name: { kind: 'Name', value: 'prev' } }, { kind: 'Field', name: { kind: 'Name', value: 'next' } }, ], @@ -256821,11 +256437,6 @@ export const ProfilesManagedDocument = /*#__PURE__*/ { kind: 'SelectionSet', selections: [ { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'moreAfter' }, - directives: [{ kind: 'Directive', name: { kind: 'Name', value: 'client' } }], - }, { kind: 'Field', name: { kind: 'Name', value: 'prev' } }, { kind: 'Field', name: { kind: 'Name', value: 'next' } }, ], @@ -261063,14 +260674,8 @@ export type PaginatedPublicationsTagsResultFieldPolicy = { items?: FieldPolicy | FieldReadFunction; pageInfo?: FieldPolicy | FieldReadFunction; }; -export type PaginatedResultInfoKeySpecifier = ( - | 'moreAfter' - | 'next' - | 'prev' - | PaginatedResultInfoKeySpecifier -)[]; +export type PaginatedResultInfoKeySpecifier = ('next' | 'prev' | PaginatedResultInfoKeySpecifier)[]; export type PaginatedResultInfoFieldPolicy = { - moreAfter?: FieldPolicy | FieldReadFunction; next?: FieldPolicy | FieldReadFunction; prev?: FieldPolicy | FieldReadFunction; }; From 9efad9243de24959621980ecb749b2886e8192c4 Mon Sep 17 00:00:00 2001 From: Kris Urbas <605420+krzysu@users.noreply.github.com> Date: Thu, 4 Apr 2024 10:05:59 +0200 Subject: [PATCH 7/8] client: remove Poaps module (#896) --- .changeset/healthy-poets-serve.md | 6 + examples/node/scripts/poaps/event.ts | 15 - examples/node/scripts/poaps/fetch.ts | 18 - examples/node/scripts/poaps/holders.ts | 21 - examples/node/scripts/poaps/mutualEvents.ts | 19 - .../createFollowTypedData.ts | 0 .../createSetFollowModuleTypedData.ts | 0 .../createUnfollowTypedData.ts | 0 .../scripts/{follow => profile}/follow.ts | 0 .../{follow => profile}/followStatusBulk.ts | 0 .../scripts/{follow => profile}/followers.ts | 0 .../scripts/{follow => profile}/following.ts | 0 .../{follow => profile}/mutualFollowers.ts | 0 .../{follow => profile}/setFollowModule.ts | 0 .../scripts/{follow => profile}/unfollow.ts | 0 .../postOnchain-token-overwrite.ts | 47 - packages/client/src/LensClient.ts | 8 - packages/client/src/graphql/index.ts | 13 +- packages/client/src/submodules/index.ts | 1 - .../modules/graphql/modules.generated.ts | 2 - .../submodules/nfts/graphql/nfts.generated.ts | 2 - packages/client/src/submodules/poaps/Poaps.ts | 137 -- .../poaps/graphql/poap.generated.ts | 1609 ----------------- .../src/submodules/poaps/graphql/poap.graphql | 80 - packages/client/src/submodules/poaps/index.ts | 3 - .../src/submodules/publication/Publication.ts | 13 +- .../src/submodules/publication/types.ts | 10 - .../graphql/transaction.generated.ts | 2 - 28 files changed, 16 insertions(+), 1990 deletions(-) create mode 100644 .changeset/healthy-poets-serve.md delete mode 100644 examples/node/scripts/poaps/event.ts delete mode 100644 examples/node/scripts/poaps/fetch.ts delete mode 100644 examples/node/scripts/poaps/holders.ts delete mode 100644 examples/node/scripts/poaps/mutualEvents.ts rename examples/node/scripts/{follow => profile}/createFollowTypedData.ts (100%) rename examples/node/scripts/{follow => profile}/createSetFollowModuleTypedData.ts (100%) rename examples/node/scripts/{follow => profile}/createUnfollowTypedData.ts (100%) rename examples/node/scripts/{follow => profile}/follow.ts (100%) rename examples/node/scripts/{follow => profile}/followStatusBulk.ts (100%) rename examples/node/scripts/{follow => profile}/followers.ts (100%) rename examples/node/scripts/{follow => profile}/following.ts (100%) rename examples/node/scripts/{follow => profile}/mutualFollowers.ts (100%) rename examples/node/scripts/{follow => profile}/setFollowModule.ts (100%) rename examples/node/scripts/{follow => profile}/unfollow.ts (100%) delete mode 100644 examples/node/scripts/publication/postOnchain-token-overwrite.ts delete mode 100644 packages/client/src/submodules/poaps/Poaps.ts delete mode 100644 packages/client/src/submodules/poaps/graphql/poap.generated.ts delete mode 100644 packages/client/src/submodules/poaps/graphql/poap.graphql delete mode 100644 packages/client/src/submodules/poaps/index.ts diff --git a/.changeset/healthy-poets-serve.md b/.changeset/healthy-poets-serve.md new file mode 100644 index 0000000000..18e4e39fa8 --- /dev/null +++ b/.changeset/healthy-poets-serve.md @@ -0,0 +1,6 @@ +--- +"@lens-protocol/client": minor +--- + +**chore:** removed Poaps module as was never implemented on the API side +**chore:** removed accessToken overwrite for `publication.postOnchain` method diff --git a/examples/node/scripts/poaps/event.ts b/examples/node/scripts/poaps/event.ts deleted file mode 100644 index 5aa11bcd55..0000000000 --- a/examples/node/scripts/poaps/event.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { LensClient, development } from '@lens-protocol/client'; - -async function main() { - const client = new LensClient({ - environment: development, - }); - - const result = await client.poaps.event({ - eventId: '0x04', - }); - - console.log('Result: ', result); -} - -main(); diff --git a/examples/node/scripts/poaps/fetch.ts b/examples/node/scripts/poaps/fetch.ts deleted file mode 100644 index bb6656e59a..0000000000 --- a/examples/node/scripts/poaps/fetch.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { LensClient, development } from '@lens-protocol/client'; - -async function main() { - const client = new LensClient({ - environment: development, - }); - - const result = await client.poaps.fetch({ - for: '0x04', - }); - - console.log( - 'Result: ', - result.items.map((item) => item), - ); -} - -main(); diff --git a/examples/node/scripts/poaps/holders.ts b/examples/node/scripts/poaps/holders.ts deleted file mode 100644 index c46182a09f..0000000000 --- a/examples/node/scripts/poaps/holders.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { LensClient, development } from '@lens-protocol/client'; - -async function main() { - const client = new LensClient({ - environment: development, - }); - - const result = await client.poaps.holders({ - eventId: '0x04', - }); - - console.log( - 'Result: ', - result.items.map((item) => ({ - id: item.id, - handle: item.handle, - })), - ); -} - -main(); diff --git a/examples/node/scripts/poaps/mutualEvents.ts b/examples/node/scripts/poaps/mutualEvents.ts deleted file mode 100644 index bc626d5644..0000000000 --- a/examples/node/scripts/poaps/mutualEvents.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { LensClient, development } from '@lens-protocol/client'; - -async function main() { - const client = new LensClient({ - environment: development, - }); - - const result = await client.poaps.mutualEvents({ - observer: '0x04', - viewing: '0x01', - }); - - console.log( - 'Result: ', - result.items.map((item) => item), - ); -} - -main(); diff --git a/examples/node/scripts/follow/createFollowTypedData.ts b/examples/node/scripts/profile/createFollowTypedData.ts similarity index 100% rename from examples/node/scripts/follow/createFollowTypedData.ts rename to examples/node/scripts/profile/createFollowTypedData.ts diff --git a/examples/node/scripts/follow/createSetFollowModuleTypedData.ts b/examples/node/scripts/profile/createSetFollowModuleTypedData.ts similarity index 100% rename from examples/node/scripts/follow/createSetFollowModuleTypedData.ts rename to examples/node/scripts/profile/createSetFollowModuleTypedData.ts diff --git a/examples/node/scripts/follow/createUnfollowTypedData.ts b/examples/node/scripts/profile/createUnfollowTypedData.ts similarity index 100% rename from examples/node/scripts/follow/createUnfollowTypedData.ts rename to examples/node/scripts/profile/createUnfollowTypedData.ts diff --git a/examples/node/scripts/follow/follow.ts b/examples/node/scripts/profile/follow.ts similarity index 100% rename from examples/node/scripts/follow/follow.ts rename to examples/node/scripts/profile/follow.ts diff --git a/examples/node/scripts/follow/followStatusBulk.ts b/examples/node/scripts/profile/followStatusBulk.ts similarity index 100% rename from examples/node/scripts/follow/followStatusBulk.ts rename to examples/node/scripts/profile/followStatusBulk.ts diff --git a/examples/node/scripts/follow/followers.ts b/examples/node/scripts/profile/followers.ts similarity index 100% rename from examples/node/scripts/follow/followers.ts rename to examples/node/scripts/profile/followers.ts diff --git a/examples/node/scripts/follow/following.ts b/examples/node/scripts/profile/following.ts similarity index 100% rename from examples/node/scripts/follow/following.ts rename to examples/node/scripts/profile/following.ts diff --git a/examples/node/scripts/follow/mutualFollowers.ts b/examples/node/scripts/profile/mutualFollowers.ts similarity index 100% rename from examples/node/scripts/follow/mutualFollowers.ts rename to examples/node/scripts/profile/mutualFollowers.ts diff --git a/examples/node/scripts/follow/setFollowModule.ts b/examples/node/scripts/profile/setFollowModule.ts similarity index 100% rename from examples/node/scripts/follow/setFollowModule.ts rename to examples/node/scripts/profile/setFollowModule.ts diff --git a/examples/node/scripts/follow/unfollow.ts b/examples/node/scripts/profile/unfollow.ts similarity index 100% rename from examples/node/scripts/follow/unfollow.ts rename to examples/node/scripts/profile/unfollow.ts diff --git a/examples/node/scripts/publication/postOnchain-token-overwrite.ts b/examples/node/scripts/publication/postOnchain-token-overwrite.ts deleted file mode 100644 index ed9669e7ef..0000000000 --- a/examples/node/scripts/publication/postOnchain-token-overwrite.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { LensClient, development, isRelaySuccess } from '@lens-protocol/client'; - -import { getAuthenticatedClient } from '../shared/getAuthenticatedClient'; -import { setupWallet } from '../shared/setupWallet'; - -async function getNewAccessToken() { - const wallet = setupWallet(); - const temp = await getAuthenticatedClient(wallet); - const result = await temp.authentication.getAccessToken(); - if (result.isFailure()) { - throw result.error; - } - return result.value; -} - -async function main() { - const client = new LensClient({ - environment: development, - }); - - const overwriteAccessToken = await getNewAccessToken(); - - console.log(`The client is authenticated: `, await client.authentication.isAuthenticated()); - console.log(`The request will be overwritten with accessToken: `, overwriteAccessToken); - - const contentURI = 'https://arweave.net/Ff8hn9iT0RXG3S_l0_AbYRb1OzY-4WS9QDRsEHBQpgw'; - - const result = await client.publication.postOnchain( - { - contentURI, - }, - { - accessToken: overwriteAccessToken, - }, - ); - - const resultValue = result.unwrap(); - - if (!isRelaySuccess(resultValue)) { - console.log(`Something went wrong`, resultValue); - return; - } - - console.log(`Transaction was successfully broadcasted with txId`, resultValue.txId); -} - -main(); diff --git a/packages/client/src/LensClient.ts b/packages/client/src/LensClient.ts index bddaf9b08b..f738a33710 100644 --- a/packages/client/src/LensClient.ts +++ b/packages/client/src/LensClient.ts @@ -14,7 +14,6 @@ import { Momoka, Nfts, Notifications, - Poaps, Profile, Publication, Revenue, @@ -158,13 +157,6 @@ export class LensClient { return new Notifications(this.context, this._authentication); } - /** - * The Poaps module - */ - get poaps(): Poaps { - return new Poaps(this.context, this._authentication); - } - /** * The Profile module */ diff --git a/packages/client/src/graphql/index.ts b/packages/client/src/graphql/index.ts index b4c4b930c7..94b9c6e16e 100644 --- a/packages/client/src/graphql/index.ts +++ b/packages/client/src/graphql/index.ts @@ -123,6 +123,8 @@ export type { FollowRequest, FollowRevenueRequest, FollowStatusBulkRequest, + FrameEip712Request, + FrameLensManagerEip712Request, GenerateModuleCurrencyApprovalDataRequest, HandleToAddressRequest, HideCommentRequest, @@ -141,7 +143,6 @@ export type { MomokaTransactionsRequest, MutualFollowersRequest, MutualNftCollectionsRequest, - MutualPoapsQueryRequest, NftCollectionOwnersRequest, NftCollectionsRequest, NftGalleriesRequest, @@ -160,8 +161,6 @@ export type { OwnedHandlesRequest, PaginatedOffsetRequest, PeerToPeerRecommendRequest, - PoapEventQueryRequest, - PoapHoldersQueryRequest, PopularNftCollectionsRequest, ProfileActionHistoryRequest, ProfileInterestsRequest, @@ -193,8 +192,8 @@ export type { UnhideCommentRequest, UnlinkHandleFromProfileRequest, UserCurrentRateLimitRequest, - UserPoapsQueryRequest, ValidatePublicationMetadataRequest, + VerifyRequest, WalletAuthenticationToProfileAuthenticationRequest, WhoActedOnPublicationRequest, WhoHaveBlockedRequest, @@ -220,7 +219,12 @@ export type { ActOnOpenActionInput, AmountInput, CollectActionModuleInput, + CreateFrameEip712TypedDataInput, + CreateFrameEip712TypedDataTypesInput, + CreateFrameEip712TypedDataValueInput, DegreesOfSeparationReferenceModuleInput, + Eip712TypedDataDomainInput, + Eip712TypedDataFieldInput, FeeFollowModuleInput, FeeFollowModuleRedeemInput, FollowModuleInput, @@ -308,7 +312,6 @@ export { NotificationType, OpenActionCategoryType, OpenActionModuleType, - PoapTokenLayerType, PopularNftCollectionsOrder, ProfileActionHistoryType, ProfileInterestTypes, diff --git a/packages/client/src/submodules/index.ts b/packages/client/src/submodules/index.ts index 1f33dfbd0f..2230251861 100644 --- a/packages/client/src/submodules/index.ts +++ b/packages/client/src/submodules/index.ts @@ -7,7 +7,6 @@ export * from './modules'; export * from './momoka'; export * from './nfts'; export * from './notifications'; -export * from './poaps'; export * from './profile'; export * from './publication'; export * from './revenue'; diff --git a/packages/client/src/submodules/modules/graphql/modules.generated.ts b/packages/client/src/submodules/modules/graphql/modules.generated.ts index 4d6e142d9c..00af4970b4 100644 --- a/packages/client/src/submodules/modules/graphql/modules.generated.ts +++ b/packages/client/src/submodules/modules/graphql/modules.generated.ts @@ -12,8 +12,6 @@ import { QuoteFragment, CommentFragment, MirrorFragment, - OpenActionResult_KnownCollectOpenActionResult_Fragment, - OpenActionResult_UnknownOpenActionResult_Fragment, RelaySuccessFragment, RelayErrorFragment, CreateMomokaPublicationResultFragment, diff --git a/packages/client/src/submodules/nfts/graphql/nfts.generated.ts b/packages/client/src/submodules/nfts/graphql/nfts.generated.ts index d7852977d3..c92f02d8d2 100644 --- a/packages/client/src/submodules/nfts/graphql/nfts.generated.ts +++ b/packages/client/src/submodules/nfts/graphql/nfts.generated.ts @@ -12,8 +12,6 @@ import { QuoteFragment, CommentFragment, MirrorFragment, - OpenActionResult_KnownCollectOpenActionResult_Fragment, - OpenActionResult_UnknownOpenActionResult_Fragment, RelaySuccessFragment, RelayErrorFragment, CreateMomokaPublicationResultFragment, diff --git a/packages/client/src/submodules/poaps/Poaps.ts b/packages/client/src/submodules/poaps/Poaps.ts deleted file mode 100644 index 011ff9ab8c..0000000000 --- a/packages/client/src/submodules/poaps/Poaps.ts +++ /dev/null @@ -1,137 +0,0 @@ -import type { Authentication } from '../../authentication'; -import { LensContext } from '../../context'; -import { FetchGraphQLClient } from '../../graphql/FetchGraphQLClient'; -import { ProfileFragment } from '../../graphql/fragments.generated'; -import type { - MutualPoapsQueryRequest, - PoapEventQueryRequest, - PoapHoldersQueryRequest, - UserPoapsQueryRequest, -} from '../../graphql/types.generated'; -import { - PaginatedResult, - commonQueryVariables, - buildPaginatedQueryResult, - sdkAuthHeaderWrapper, -} from '../../helpers'; -import { PoapEventFragment, PoapTokenFragment, Sdk, getSdk } from './graphql/poap.generated'; - -/** - * POAP is a protocol for the preservation of memories as digital records. - * - * @experimental This module is not stable and may be removed in a future release - * @group LensClient Modules - */ -export class Poaps { - private readonly sdk: Sdk; - - /** - * @internal - */ - constructor( - private readonly context: LensContext, - authentication: Authentication, - ) { - const client = new FetchGraphQLClient(context); - - this.sdk = getSdk(client, sdkAuthHeaderWrapper(authentication)); - } - - /** - * Get profile POAP tokens. - * - * @param request - The request object. - * @returns POAP tokens wrapped in {@link PaginatedResult} - * @experimental This function is not stable and may be removed in a future release - * - * @example - * ```ts - * const result = await client.poaps.fetch({ - * for: '0x04', - * }); - * ``` - */ - async fetch(request: UserPoapsQueryRequest): Promise> { - return buildPaginatedQueryResult(async (currRequest) => { - const result = await this.sdk.Poaps({ - request: currRequest, - }); - - return result.data.result; - }, request); - } - - /** - * Get profiles holding a POAP token from a specific event. - * - * @param request - The request object. - * @returns Profiles wrapped in {@link PaginatedResult} - * @experimental This function is not stable and may be removed in a future release - * - * @example - * ```ts - * const result = await client.poaps.holders({ - * eventId: '0x04', - * }); - * ``` - */ - async holders(request: PoapHoldersQueryRequest): Promise> { - return buildPaginatedQueryResult(async (currRequest) => { - const result = await this.sdk.PoapHolders({ - request: currRequest, - ...commonQueryVariables(this.context), - }); - - return result.data.result; - }, request); - } - - /** - * Fetch mutual POAP events between two profiles. - * - * @param request - The request object. - * @returns POAP events wrapped in {@link PaginatedResult} - * @experimental This function is not stable and may be removed in a future release - * - * @example - * ```ts - * const result = await client.poaps.mutualEvents({ - * observer: '0x04', - * viewing: '0x01', - * }); - * ``` - */ - async mutualEvents( - request: MutualPoapsQueryRequest, - ): Promise> { - return buildPaginatedQueryResult(async (currRequest) => { - const result = await this.sdk.MutualPoaps({ - request: currRequest, - }); - - return result.data.result; - }, request); - } - - /** - * Fetch a POAP event. - * - * @param request - The request object. - * @returns POAP event. - * @experimental This function is not stable and may be removed in a future release - * - * @example - * ```ts - * const result = await client.poaps.event({ - * eventId: '0x04', - * }); - * ``` - */ - async event(request: PoapEventQueryRequest): Promise { - const result = await this.sdk.PoapEvent({ - request, - }); - - return result.data.result; - } -} diff --git a/packages/client/src/submodules/poaps/graphql/poap.generated.ts b/packages/client/src/submodules/poaps/graphql/poap.generated.ts deleted file mode 100644 index 723465e055..0000000000 --- a/packages/client/src/submodules/poaps/graphql/poap.generated.ts +++ /dev/null @@ -1,1609 +0,0 @@ -// @ts-nocheck -import * as Types from '../../../graphql/types.generated'; - -import { - NetworkAddressFragment, - AmountFragment, - Erc20Fragment, - PaginatedResultInfoFragment, - ImageFragment, - ProfileFragment, - PostFragment, - QuoteFragment, - CommentFragment, - MirrorFragment, - OpenActionResult_KnownCollectOpenActionResult_Fragment, - OpenActionResult_UnknownOpenActionResult_Fragment, - RelaySuccessFragment, - RelayErrorFragment, - CreateMomokaPublicationResultFragment, -} from '../../../graphql/fragments.generated'; -import { GraphQLClient } from 'graphql-request'; -import { GraphQLClientRequestHeaders } from 'graphql-request/build/cjs/types'; -import { print } from 'graphql'; -import { DocumentNode } from 'graphql'; -export type PoapEventFragment = { - id: string; - fancyId: string | null; - name: string | null; - eventUrl: string | null; - imageUrl: string | null; - country: string | null; - city: string | null; - description: string | null; - year: number | null; - startDate: string | null; - endDate: string | null; - expiryDate: string | null; - virtualEvent: boolean | null; - fromAdmin: boolean | null; - animationUrl: string | null; - eventTemplateId: number | null; - privateEvent: boolean | null; -}; - -export type PoapTokenFragment = { - tokenId: string; - eventId: string; - layer: Types.PoapTokenLayerType; - created: string; - migrated: string | null; - owner: NetworkAddressFragment; - event: PoapEventFragment; -}; - -export type PoapsQueryVariables = Types.Exact<{ - request: Types.UserPoapsQueryRequest; -}>; - -export type PoapsQuery = { - result: { items: Array; pageInfo: PaginatedResultInfoFragment }; -}; - -export type MutualPoapsQueryVariables = Types.Exact<{ - request: Types.MutualPoapsQueryRequest; -}>; - -export type MutualPoapsQuery = { - result: { items: Array; pageInfo: PaginatedResultInfoFragment }; -}; - -export type PoapHoldersQueryVariables = Types.Exact<{ - request: Types.PoapHoldersQueryRequest; - profileCoverTransform: Types.ImageTransform; - profilePictureTransform: Types.ImageTransform; - profileStatsArg?: Types.InputMaybe; - profileStatsCountOpenActionArgs?: Types.InputMaybe; - profileMetadataSource?: Types.InputMaybe; - rateRequest: Types.RateRequest; -}>; - -export type PoapHoldersQuery = { - result: { items: Array; pageInfo: PaginatedResultInfoFragment }; -}; - -export type PoapEventQueryVariables = Types.Exact<{ - request: Types.PoapEventQueryRequest; -}>; - -export type PoapEventQuery = { result: PoapEventFragment | null }; - -export const PoapEventFragmentDoc = { - kind: 'Document', - definitions: [ - { - kind: 'FragmentDefinition', - name: { kind: 'Name', value: 'PoapEvent' }, - typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'PoapEvent' } }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: 'id' } }, - { kind: 'Field', name: { kind: 'Name', value: 'fancyId' } }, - { kind: 'Field', name: { kind: 'Name', value: 'name' } }, - { kind: 'Field', name: { kind: 'Name', value: 'eventUrl' } }, - { kind: 'Field', name: { kind: 'Name', value: 'imageUrl' } }, - { kind: 'Field', name: { kind: 'Name', value: 'country' } }, - { kind: 'Field', name: { kind: 'Name', value: 'city' } }, - { kind: 'Field', name: { kind: 'Name', value: 'description' } }, - { kind: 'Field', name: { kind: 'Name', value: 'year' } }, - { kind: 'Field', name: { kind: 'Name', value: 'startDate' } }, - { kind: 'Field', name: { kind: 'Name', value: 'endDate' } }, - { kind: 'Field', name: { kind: 'Name', value: 'expiryDate' } }, - { kind: 'Field', name: { kind: 'Name', value: 'virtualEvent' } }, - { kind: 'Field', name: { kind: 'Name', value: 'fromAdmin' } }, - { kind: 'Field', name: { kind: 'Name', value: 'animationUrl' } }, - { kind: 'Field', name: { kind: 'Name', value: 'eventTemplateId' } }, - { kind: 'Field', name: { kind: 'Name', value: 'privateEvent' } }, - ], - }, - }, - ], -} as unknown as DocumentNode; -export const PoapTokenFragmentDoc = { - kind: 'Document', - definitions: [ - { - kind: 'FragmentDefinition', - name: { kind: 'Name', value: 'PoapToken' }, - typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'PoapToken' } }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: 'tokenId' } }, - { kind: 'Field', name: { kind: 'Name', value: 'eventId' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'owner' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'FragmentSpread', name: { kind: 'Name', value: 'NetworkAddress' } }, - ], - }, - }, - { kind: 'Field', name: { kind: 'Name', value: 'layer' } }, - { kind: 'Field', name: { kind: 'Name', value: 'created' } }, - { kind: 'Field', name: { kind: 'Name', value: 'migrated' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'event' }, - selectionSet: { - kind: 'SelectionSet', - selections: [{ kind: 'FragmentSpread', name: { kind: 'Name', value: 'PoapEvent' } }], - }, - }, - ], - }, - }, - { - kind: 'FragmentDefinition', - name: { kind: 'Name', value: 'PoapEvent' }, - typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'PoapEvent' } }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: 'id' } }, - { kind: 'Field', name: { kind: 'Name', value: 'fancyId' } }, - { kind: 'Field', name: { kind: 'Name', value: 'name' } }, - { kind: 'Field', name: { kind: 'Name', value: 'eventUrl' } }, - { kind: 'Field', name: { kind: 'Name', value: 'imageUrl' } }, - { kind: 'Field', name: { kind: 'Name', value: 'country' } }, - { kind: 'Field', name: { kind: 'Name', value: 'city' } }, - { kind: 'Field', name: { kind: 'Name', value: 'description' } }, - { kind: 'Field', name: { kind: 'Name', value: 'year' } }, - { kind: 'Field', name: { kind: 'Name', value: 'startDate' } }, - { kind: 'Field', name: { kind: 'Name', value: 'endDate' } }, - { kind: 'Field', name: { kind: 'Name', value: 'expiryDate' } }, - { kind: 'Field', name: { kind: 'Name', value: 'virtualEvent' } }, - { kind: 'Field', name: { kind: 'Name', value: 'fromAdmin' } }, - { kind: 'Field', name: { kind: 'Name', value: 'animationUrl' } }, - { kind: 'Field', name: { kind: 'Name', value: 'eventTemplateId' } }, - { kind: 'Field', name: { kind: 'Name', value: 'privateEvent' } }, - ], - }, - }, - { - kind: 'FragmentDefinition', - name: { kind: 'Name', value: 'NetworkAddress' }, - typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'NetworkAddress' } }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { kind: 'Field', name: { kind: 'Name', value: 'address' } }, - { kind: 'Field', name: { kind: 'Name', value: 'chainId' } }, - ], - }, - }, - ], -} as unknown as DocumentNode; -export const PoapsDocument = { - kind: 'Document', - definitions: [ - { - kind: 'OperationDefinition', - operation: 'query', - name: { kind: 'Name', value: 'Poaps' }, - variableDefinitions: [ - { - kind: 'VariableDefinition', - variable: { kind: 'Variable', name: { kind: 'Name', value: 'request' } }, - type: { - kind: 'NonNullType', - type: { kind: 'NamedType', name: { kind: 'Name', value: 'UserPoapsQueryRequest' } }, - }, - }, - ], - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'Field', - alias: { kind: 'Name', value: 'result' }, - name: { kind: 'Name', value: 'poaps' }, - arguments: [ - { - kind: 'Argument', - name: { kind: 'Name', value: 'request' }, - value: { kind: 'Variable', name: { kind: 'Name', value: 'request' } }, - }, - ], - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'Field', - name: { kind: 'Name', value: 'items' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'FragmentSpread', name: { kind: 'Name', value: 'PoapToken' } }, - ], - }, - }, - { - kind: 'Field', - name: { kind: 'Name', value: 'pageInfo' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'FragmentSpread', - name: { kind: 'Name', value: 'PaginatedResultInfo' }, - }, - ], - }, - }, - ], - }, - }, - ], - }, - }, - { - kind: 'FragmentDefinition', - name: { kind: 'Name', value: 'PoapEvent' }, - typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'PoapEvent' } }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: 'id' } }, - { kind: 'Field', name: { kind: 'Name', value: 'fancyId' } }, - { kind: 'Field', name: { kind: 'Name', value: 'name' } }, - { kind: 'Field', name: { kind: 'Name', value: 'eventUrl' } }, - { kind: 'Field', name: { kind: 'Name', value: 'imageUrl' } }, - { kind: 'Field', name: { kind: 'Name', value: 'country' } }, - { kind: 'Field', name: { kind: 'Name', value: 'city' } }, - { kind: 'Field', name: { kind: 'Name', value: 'description' } }, - { kind: 'Field', name: { kind: 'Name', value: 'year' } }, - { kind: 'Field', name: { kind: 'Name', value: 'startDate' } }, - { kind: 'Field', name: { kind: 'Name', value: 'endDate' } }, - { kind: 'Field', name: { kind: 'Name', value: 'expiryDate' } }, - { kind: 'Field', name: { kind: 'Name', value: 'virtualEvent' } }, - { kind: 'Field', name: { kind: 'Name', value: 'fromAdmin' } }, - { kind: 'Field', name: { kind: 'Name', value: 'animationUrl' } }, - { kind: 'Field', name: { kind: 'Name', value: 'eventTemplateId' } }, - { kind: 'Field', name: { kind: 'Name', value: 'privateEvent' } }, - ], - }, - }, - { - kind: 'FragmentDefinition', - name: { kind: 'Name', value: 'PoapToken' }, - typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'PoapToken' } }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: 'tokenId' } }, - { kind: 'Field', name: { kind: 'Name', value: 'eventId' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'owner' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'FragmentSpread', name: { kind: 'Name', value: 'NetworkAddress' } }, - ], - }, - }, - { kind: 'Field', name: { kind: 'Name', value: 'layer' } }, - { kind: 'Field', name: { kind: 'Name', value: 'created' } }, - { kind: 'Field', name: { kind: 'Name', value: 'migrated' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'event' }, - selectionSet: { - kind: 'SelectionSet', - selections: [{ kind: 'FragmentSpread', name: { kind: 'Name', value: 'PoapEvent' } }], - }, - }, - ], - }, - }, - { - kind: 'FragmentDefinition', - name: { kind: 'Name', value: 'NetworkAddress' }, - typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'NetworkAddress' } }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { kind: 'Field', name: { kind: 'Name', value: 'address' } }, - { kind: 'Field', name: { kind: 'Name', value: 'chainId' } }, - ], - }, - }, - { - kind: 'FragmentDefinition', - name: { kind: 'Name', value: 'PaginatedResultInfo' }, - typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'PaginatedResultInfo' } }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: 'prev' } }, - { kind: 'Field', name: { kind: 'Name', value: 'next' } }, - ], - }, - }, - ], -} as unknown as DocumentNode; -export const MutualPoapsDocument = { - kind: 'Document', - definitions: [ - { - kind: 'OperationDefinition', - operation: 'query', - name: { kind: 'Name', value: 'MutualPoaps' }, - variableDefinitions: [ - { - kind: 'VariableDefinition', - variable: { kind: 'Variable', name: { kind: 'Name', value: 'request' } }, - type: { - kind: 'NonNullType', - type: { kind: 'NamedType', name: { kind: 'Name', value: 'MutualPoapsQueryRequest' } }, - }, - }, - ], - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'Field', - alias: { kind: 'Name', value: 'result' }, - name: { kind: 'Name', value: 'mutualPoaps' }, - arguments: [ - { - kind: 'Argument', - name: { kind: 'Name', value: 'request' }, - value: { kind: 'Variable', name: { kind: 'Name', value: 'request' } }, - }, - ], - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'Field', - name: { kind: 'Name', value: 'items' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'FragmentSpread', name: { kind: 'Name', value: 'PoapEvent' } }, - ], - }, - }, - { - kind: 'Field', - name: { kind: 'Name', value: 'pageInfo' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'FragmentSpread', - name: { kind: 'Name', value: 'PaginatedResultInfo' }, - }, - ], - }, - }, - ], - }, - }, - ], - }, - }, - { - kind: 'FragmentDefinition', - name: { kind: 'Name', value: 'PoapEvent' }, - typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'PoapEvent' } }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: 'id' } }, - { kind: 'Field', name: { kind: 'Name', value: 'fancyId' } }, - { kind: 'Field', name: { kind: 'Name', value: 'name' } }, - { kind: 'Field', name: { kind: 'Name', value: 'eventUrl' } }, - { kind: 'Field', name: { kind: 'Name', value: 'imageUrl' } }, - { kind: 'Field', name: { kind: 'Name', value: 'country' } }, - { kind: 'Field', name: { kind: 'Name', value: 'city' } }, - { kind: 'Field', name: { kind: 'Name', value: 'description' } }, - { kind: 'Field', name: { kind: 'Name', value: 'year' } }, - { kind: 'Field', name: { kind: 'Name', value: 'startDate' } }, - { kind: 'Field', name: { kind: 'Name', value: 'endDate' } }, - { kind: 'Field', name: { kind: 'Name', value: 'expiryDate' } }, - { kind: 'Field', name: { kind: 'Name', value: 'virtualEvent' } }, - { kind: 'Field', name: { kind: 'Name', value: 'fromAdmin' } }, - { kind: 'Field', name: { kind: 'Name', value: 'animationUrl' } }, - { kind: 'Field', name: { kind: 'Name', value: 'eventTemplateId' } }, - { kind: 'Field', name: { kind: 'Name', value: 'privateEvent' } }, - ], - }, - }, - { - kind: 'FragmentDefinition', - name: { kind: 'Name', value: 'PaginatedResultInfo' }, - typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'PaginatedResultInfo' } }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: 'prev' } }, - { kind: 'Field', name: { kind: 'Name', value: 'next' } }, - ], - }, - }, - ], -} as unknown as DocumentNode; -export const PoapHoldersDocument = { - kind: 'Document', - definitions: [ - { - kind: 'OperationDefinition', - operation: 'query', - name: { kind: 'Name', value: 'PoapHolders' }, - variableDefinitions: [ - { - kind: 'VariableDefinition', - variable: { kind: 'Variable', name: { kind: 'Name', value: 'request' } }, - type: { - kind: 'NonNullType', - type: { kind: 'NamedType', name: { kind: 'Name', value: 'PoapHoldersQueryRequest' } }, - }, - }, - { - kind: 'VariableDefinition', - variable: { kind: 'Variable', name: { kind: 'Name', value: 'profileCoverTransform' } }, - type: { - kind: 'NonNullType', - type: { kind: 'NamedType', name: { kind: 'Name', value: 'ImageTransform' } }, - }, - }, - { - kind: 'VariableDefinition', - variable: { kind: 'Variable', name: { kind: 'Name', value: 'profilePictureTransform' } }, - type: { - kind: 'NonNullType', - type: { kind: 'NamedType', name: { kind: 'Name', value: 'ImageTransform' } }, - }, - }, - { - kind: 'VariableDefinition', - variable: { kind: 'Variable', name: { kind: 'Name', value: 'profileStatsArg' } }, - type: { kind: 'NamedType', name: { kind: 'Name', value: 'ProfileStatsArg' } }, - }, - { - kind: 'VariableDefinition', - variable: { - kind: 'Variable', - name: { kind: 'Name', value: 'profileStatsCountOpenActionArgs' }, - }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'ProfileStatsCountOpenActionArgs' }, - }, - }, - { - kind: 'VariableDefinition', - variable: { kind: 'Variable', name: { kind: 'Name', value: 'profileMetadataSource' } }, - type: { kind: 'NamedType', name: { kind: 'Name', value: 'AppId' } }, - }, - { - kind: 'VariableDefinition', - variable: { kind: 'Variable', name: { kind: 'Name', value: 'rateRequest' } }, - type: { - kind: 'NonNullType', - type: { kind: 'NamedType', name: { kind: 'Name', value: 'RateRequest' } }, - }, - }, - ], - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'Field', - alias: { kind: 'Name', value: 'result' }, - name: { kind: 'Name', value: 'poapHolders' }, - arguments: [ - { - kind: 'Argument', - name: { kind: 'Name', value: 'request' }, - value: { kind: 'Variable', name: { kind: 'Name', value: 'request' } }, - }, - ], - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'Field', - name: { kind: 'Name', value: 'items' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'FragmentSpread', name: { kind: 'Name', value: 'Profile' } }, - ], - }, - }, - { - kind: 'Field', - name: { kind: 'Name', value: 'pageInfo' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'FragmentSpread', - name: { kind: 'Name', value: 'PaginatedResultInfo' }, - }, - ], - }, - }, - ], - }, - }, - ], - }, - }, - { - kind: 'FragmentDefinition', - name: { kind: 'Name', value: 'NetworkAddress' }, - typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'NetworkAddress' } }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { kind: 'Field', name: { kind: 'Name', value: 'address' } }, - { kind: 'Field', name: { kind: 'Name', value: 'chainId' } }, - ], - }, - }, - { - kind: 'FragmentDefinition', - name: { kind: 'Name', value: 'PaginatedResultInfo' }, - typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'PaginatedResultInfo' } }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: 'prev' } }, - { kind: 'Field', name: { kind: 'Name', value: 'next' } }, - ], - }, - }, - { - kind: 'FragmentDefinition', - name: { kind: 'Name', value: 'Profile' }, - typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'Profile' } }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { kind: 'Field', name: { kind: 'Name', value: 'id' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'ownedBy' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'FragmentSpread', name: { kind: 'Name', value: 'NetworkAddress' } }, - ], - }, - }, - { kind: 'Field', name: { kind: 'Name', value: 'txHash' } }, - { kind: 'Field', name: { kind: 'Name', value: 'createdAt' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'operations' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { kind: 'Field', name: { kind: 'Name', value: 'id' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'isBlockedByMe' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'FragmentSpread', - name: { kind: 'Name', value: 'OptimisticStatusResult' }, - }, - ], - }, - }, - { - kind: 'Field', - name: { kind: 'Name', value: 'isFollowedByMe' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'FragmentSpread', - name: { kind: 'Name', value: 'OptimisticStatusResult' }, - }, - ], - }, - }, - { - kind: 'Field', - name: { kind: 'Name', value: 'isFollowingMe' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'FragmentSpread', - name: { kind: 'Name', value: 'OptimisticStatusResult' }, - }, - ], - }, - }, - { kind: 'Field', name: { kind: 'Name', value: 'canBlock' } }, - { kind: 'Field', name: { kind: 'Name', value: 'canUnblock' } }, - { kind: 'Field', name: { kind: 'Name', value: 'canFollow' } }, - { kind: 'Field', name: { kind: 'Name', value: 'canUnfollow' } }, - ], - }, - }, - { kind: 'Field', name: { kind: 'Name', value: 'interests' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'guardian' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: 'protected' } }, - { kind: 'Field', name: { kind: 'Name', value: 'cooldownEndsOn' } }, - ], - }, - }, - { kind: 'Field', name: { kind: 'Name', value: 'invitesLeft' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'onchainIdentity' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: 'proofOfHumanity' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'ens' }, - selectionSet: { - kind: 'SelectionSet', - selections: [{ kind: 'Field', name: { kind: 'Name', value: 'name' } }], - }, - }, - { - kind: 'Field', - name: { kind: 'Name', value: 'sybilDotOrg' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: 'verified' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'source' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'Field', - name: { kind: 'Name', value: 'twitter' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: 'handle' } }, - ], - }, - }, - ], - }, - }, - ], - }, - }, - { - kind: 'Field', - name: { kind: 'Name', value: 'worldcoin' }, - selectionSet: { - kind: 'SelectionSet', - selections: [{ kind: 'Field', name: { kind: 'Name', value: 'isHuman' } }], - }, - }, - ], - }, - }, - { - kind: 'Field', - name: { kind: 'Name', value: 'followNftAddress' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'FragmentSpread', name: { kind: 'Name', value: 'NetworkAddress' } }, - ], - }, - }, - { - kind: 'Field', - name: { kind: 'Name', value: 'followModule' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'InlineFragment', - typeCondition: { - kind: 'NamedType', - name: { kind: 'Name', value: 'FeeFollowModuleSettings' }, - }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'FragmentSpread', - name: { kind: 'Name', value: 'FeeFollowModuleSettings' }, - }, - ], - }, - }, - { - kind: 'InlineFragment', - typeCondition: { - kind: 'NamedType', - name: { kind: 'Name', value: 'RevertFollowModuleSettings' }, - }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'FragmentSpread', - name: { kind: 'Name', value: 'RevertFollowModuleSettings' }, - }, - ], - }, - }, - { - kind: 'InlineFragment', - typeCondition: { - kind: 'NamedType', - name: { kind: 'Name', value: 'UnknownFollowModuleSettings' }, - }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'FragmentSpread', - name: { kind: 'Name', value: 'UnknownFollowModuleSettings' }, - }, - ], - }, - }, - ], - }, - }, - { - kind: 'Field', - name: { kind: 'Name', value: 'metadata' }, - arguments: [ - { - kind: 'Argument', - name: { kind: 'Name', value: 'request' }, - value: { - kind: 'ObjectValue', - fields: [ - { - kind: 'ObjectField', - name: { kind: 'Name', value: 'appId' }, - value: { - kind: 'Variable', - name: { kind: 'Name', value: 'profileMetadataSource' }, - }, - }, - { - kind: 'ObjectField', - name: { kind: 'Name', value: 'useFallback' }, - value: { kind: 'BooleanValue', value: true }, - }, - ], - }, - }, - ], - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'FragmentSpread', name: { kind: 'Name', value: 'ProfileMetadata' } }, - ], - }, - }, - { - kind: 'Field', - name: { kind: 'Name', value: 'handle' }, - selectionSet: { - kind: 'SelectionSet', - selections: [{ kind: 'FragmentSpread', name: { kind: 'Name', value: 'HandleInfo' } }], - }, - }, - { kind: 'Field', name: { kind: 'Name', value: 'sponsor' } }, - { kind: 'Field', name: { kind: 'Name', value: 'signless' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'invitedBy' }, - selectionSet: { - kind: 'SelectionSet', - selections: [{ kind: 'Field', name: { kind: 'Name', value: 'id' } }], - }, - }, - { - kind: 'Field', - name: { kind: 'Name', value: 'stats' }, - arguments: [ - { - kind: 'Argument', - name: { kind: 'Name', value: 'request' }, - value: { kind: 'Variable', name: { kind: 'Name', value: 'profileStatsArg' } }, - }, - ], - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'FragmentSpread', name: { kind: 'Name', value: 'ProfileStats' } }, - ], - }, - }, - { kind: 'Field', name: { kind: 'Name', value: 'peerToPeerRecommendedByMe' } }, - ], - }, - }, - { - kind: 'FragmentDefinition', - name: { kind: 'Name', value: 'OptimisticStatusResult' }, - typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'OptimisticStatusResult' } }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { kind: 'Field', name: { kind: 'Name', value: 'value' } }, - { kind: 'Field', name: { kind: 'Name', value: 'isFinalisedOnchain' } }, - ], - }, - }, - { - kind: 'FragmentDefinition', - name: { kind: 'Name', value: 'FeeFollowModuleSettings' }, - typeCondition: { - kind: 'NamedType', - name: { kind: 'Name', value: 'FeeFollowModuleSettings' }, - }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'amount' }, - selectionSet: { - kind: 'SelectionSet', - selections: [{ kind: 'FragmentSpread', name: { kind: 'Name', value: 'Amount' } }], - }, - }, - { - kind: 'Field', - name: { kind: 'Name', value: 'contract' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'FragmentSpread', name: { kind: 'Name', value: 'NetworkAddress' } }, - ], - }, - }, - { kind: 'Field', name: { kind: 'Name', value: 'recipient' } }, - ], - }, - }, - { - kind: 'FragmentDefinition', - name: { kind: 'Name', value: 'Amount' }, - typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'Amount' } }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'asset' }, - selectionSet: { - kind: 'SelectionSet', - selections: [{ kind: 'FragmentSpread', name: { kind: 'Name', value: 'Erc20' } }], - }, - }, - { kind: 'Field', name: { kind: 'Name', value: 'value' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'rate' }, - arguments: [ - { - kind: 'Argument', - name: { kind: 'Name', value: 'request' }, - value: { kind: 'Variable', name: { kind: 'Name', value: 'rateRequest' } }, - }, - ], - selectionSet: { - kind: 'SelectionSet', - selections: [{ kind: 'FragmentSpread', name: { kind: 'Name', value: 'FiatAmount' } }], - }, - }, - ], - }, - }, - { - kind: 'FragmentDefinition', - name: { kind: 'Name', value: 'Erc20' }, - typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'Erc20' } }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { kind: 'Field', name: { kind: 'Name', value: 'name' } }, - { kind: 'Field', name: { kind: 'Name', value: 'symbol' } }, - { kind: 'Field', name: { kind: 'Name', value: 'decimals' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'contract' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'FragmentSpread', name: { kind: 'Name', value: 'NetworkAddress' } }, - ], - }, - }, - ], - }, - }, - { - kind: 'FragmentDefinition', - name: { kind: 'Name', value: 'FiatAmount' }, - typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'FiatAmount' } }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'asset' }, - selectionSet: { - kind: 'SelectionSet', - selections: [{ kind: 'FragmentSpread', name: { kind: 'Name', value: 'Fiat' } }], - }, - }, - { kind: 'Field', name: { kind: 'Name', value: 'value' } }, - ], - }, - }, - { - kind: 'FragmentDefinition', - name: { kind: 'Name', value: 'Fiat' }, - typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'Fiat' } }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { kind: 'Field', name: { kind: 'Name', value: 'name' } }, - { kind: 'Field', name: { kind: 'Name', value: 'symbol' } }, - { kind: 'Field', name: { kind: 'Name', value: 'decimals' } }, - ], - }, - }, - { - kind: 'FragmentDefinition', - name: { kind: 'Name', value: 'RevertFollowModuleSettings' }, - typeCondition: { - kind: 'NamedType', - name: { kind: 'Name', value: 'RevertFollowModuleSettings' }, - }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'contract' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'FragmentSpread', name: { kind: 'Name', value: 'NetworkAddress' } }, - ], - }, - }, - ], - }, - }, - { - kind: 'FragmentDefinition', - name: { kind: 'Name', value: 'UnknownFollowModuleSettings' }, - typeCondition: { - kind: 'NamedType', - name: { kind: 'Name', value: 'UnknownFollowModuleSettings' }, - }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'contract' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'FragmentSpread', name: { kind: 'Name', value: 'NetworkAddress' } }, - ], - }, - }, - { kind: 'Field', name: { kind: 'Name', value: 'initializeCalldata' } }, - { kind: 'Field', name: { kind: 'Name', value: 'initializeResultData' } }, - { kind: 'Field', name: { kind: 'Name', value: 'signlessApproved' } }, - { kind: 'Field', name: { kind: 'Name', value: 'sponsoredApproved' } }, - { kind: 'Field', name: { kind: 'Name', value: 'verified' } }, - ], - }, - }, - { - kind: 'FragmentDefinition', - name: { kind: 'Name', value: 'ProfileMetadata' }, - typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'ProfileMetadata' } }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { kind: 'Field', name: { kind: 'Name', value: 'appId' } }, - { kind: 'Field', name: { kind: 'Name', value: 'displayName' } }, - { kind: 'Field', name: { kind: 'Name', value: 'bio' } }, - { kind: 'Field', name: { kind: 'Name', value: 'rawURI' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'picture' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'InlineFragment', - typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'ImageSet' } }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'FragmentSpread', - name: { kind: 'Name', value: 'ProfilePictureSet' }, - }, - ], - }, - }, - { - kind: 'InlineFragment', - typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'NftImage' } }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'FragmentSpread', name: { kind: 'Name', value: 'NftImage' } }, - ], - }, - }, - ], - }, - }, - { - kind: 'Field', - name: { kind: 'Name', value: 'coverPicture' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'FragmentSpread', name: { kind: 'Name', value: 'ProfileCoverSet' } }, - ], - }, - }, - { - kind: 'Field', - name: { kind: 'Name', value: 'attributes' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: 'type' } }, - { kind: 'Field', name: { kind: 'Name', value: 'key' } }, - { kind: 'Field', name: { kind: 'Name', value: 'value' } }, - ], - }, - }, - ], - }, - }, - { - kind: 'FragmentDefinition', - name: { kind: 'Name', value: 'ProfilePictureSet' }, - typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'ImageSet' } }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'raw' }, - selectionSet: { - kind: 'SelectionSet', - selections: [{ kind: 'FragmentSpread', name: { kind: 'Name', value: 'Image' } }], - }, - }, - { - kind: 'Field', - name: { kind: 'Name', value: 'optimized' }, - selectionSet: { - kind: 'SelectionSet', - selections: [{ kind: 'FragmentSpread', name: { kind: 'Name', value: 'Image' } }], - }, - }, - { - kind: 'Field', - alias: { kind: 'Name', value: 'thumbnail' }, - name: { kind: 'Name', value: 'transformed' }, - arguments: [ - { - kind: 'Argument', - name: { kind: 'Name', value: 'request' }, - value: { - kind: 'Variable', - name: { kind: 'Name', value: 'profilePictureTransform' }, - }, - }, - ], - selectionSet: { - kind: 'SelectionSet', - selections: [{ kind: 'FragmentSpread', name: { kind: 'Name', value: 'Image' } }], - }, - }, - ], - }, - }, - { - kind: 'FragmentDefinition', - name: { kind: 'Name', value: 'Image' }, - typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'Image' } }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { kind: 'Field', name: { kind: 'Name', value: 'uri' } }, - { kind: 'Field', name: { kind: 'Name', value: 'mimeType' } }, - { kind: 'Field', name: { kind: 'Name', value: 'width' } }, - { kind: 'Field', name: { kind: 'Name', value: 'height' } }, - ], - }, - }, - { - kind: 'FragmentDefinition', - name: { kind: 'Name', value: 'NftImage' }, - typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'NftImage' } }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'collection' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'FragmentSpread', name: { kind: 'Name', value: 'NetworkAddress' } }, - ], - }, - }, - { kind: 'Field', name: { kind: 'Name', value: 'tokenId' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'image' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'FragmentSpread', name: { kind: 'Name', value: 'ProfilePictureSet' } }, - ], - }, - }, - { kind: 'Field', name: { kind: 'Name', value: 'verified' } }, - ], - }, - }, - { - kind: 'FragmentDefinition', - name: { kind: 'Name', value: 'ProfileCoverSet' }, - typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'ImageSet' } }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'raw' }, - selectionSet: { - kind: 'SelectionSet', - selections: [{ kind: 'FragmentSpread', name: { kind: 'Name', value: 'Image' } }], - }, - }, - { - kind: 'Field', - name: { kind: 'Name', value: 'optimized' }, - selectionSet: { - kind: 'SelectionSet', - selections: [{ kind: 'FragmentSpread', name: { kind: 'Name', value: 'Image' } }], - }, - }, - { - kind: 'Field', - name: { kind: 'Name', value: 'transformed' }, - arguments: [ - { - kind: 'Argument', - name: { kind: 'Name', value: 'request' }, - value: { kind: 'Variable', name: { kind: 'Name', value: 'profileCoverTransform' } }, - }, - ], - selectionSet: { - kind: 'SelectionSet', - selections: [{ kind: 'FragmentSpread', name: { kind: 'Name', value: 'Image' } }], - }, - }, - ], - }, - }, - { - kind: 'FragmentDefinition', - name: { kind: 'Name', value: 'HandleInfo' }, - typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'HandleInfo' } }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: '__typename' } }, - { kind: 'Field', name: { kind: 'Name', value: 'id' } }, - { kind: 'Field', name: { kind: 'Name', value: 'fullHandle' } }, - { kind: 'Field', name: { kind: 'Name', value: 'namespace' } }, - { kind: 'Field', name: { kind: 'Name', value: 'localName' } }, - { - kind: 'Field', - name: { kind: 'Name', value: 'suggestedFormatted' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: 'full' } }, - { kind: 'Field', name: { kind: 'Name', value: 'localName' } }, - ], - }, - }, - { - kind: 'Field', - name: { kind: 'Name', value: 'linkedTo' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'Field', - name: { kind: 'Name', value: 'contract' }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'FragmentSpread', name: { kind: 'Name', value: 'NetworkAddress' } }, - ], - }, - }, - { kind: 'Field', name: { kind: 'Name', value: 'nftTokenId' } }, - ], - }, - }, - { kind: 'Field', name: { kind: 'Name', value: 'ownedBy' } }, - ], - }, - }, - { - kind: 'FragmentDefinition', - name: { kind: 'Name', value: 'ProfileStats' }, - typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'ProfileStats' } }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: 'id' } }, - { kind: 'Field', name: { kind: 'Name', value: 'followers' } }, - { kind: 'Field', name: { kind: 'Name', value: 'following' } }, - { kind: 'Field', name: { kind: 'Name', value: 'comments' } }, - { kind: 'Field', name: { kind: 'Name', value: 'posts' } }, - { kind: 'Field', name: { kind: 'Name', value: 'mirrors' } }, - { kind: 'Field', name: { kind: 'Name', value: 'quotes' } }, - { kind: 'Field', name: { kind: 'Name', value: 'publications' } }, - { - kind: 'Field', - alias: { kind: 'Name', value: 'upvotes' }, - name: { kind: 'Name', value: 'reactions' }, - arguments: [ - { - kind: 'Argument', - name: { kind: 'Name', value: 'request' }, - value: { - kind: 'ObjectValue', - fields: [ - { - kind: 'ObjectField', - name: { kind: 'Name', value: 'type' }, - value: { kind: 'EnumValue', value: 'UPVOTE' }, - }, - ], - }, - }, - ], - }, - { - kind: 'Field', - alias: { kind: 'Name', value: 'downvotes' }, - name: { kind: 'Name', value: 'reactions' }, - arguments: [ - { - kind: 'Argument', - name: { kind: 'Name', value: 'request' }, - value: { - kind: 'ObjectValue', - fields: [ - { - kind: 'ObjectField', - name: { kind: 'Name', value: 'type' }, - value: { kind: 'EnumValue', value: 'DOWNVOTE' }, - }, - ], - }, - }, - ], - }, - { - kind: 'Field', - alias: { kind: 'Name', value: 'upvoted' }, - name: { kind: 'Name', value: 'reacted' }, - arguments: [ - { - kind: 'Argument', - name: { kind: 'Name', value: 'request' }, - value: { - kind: 'ObjectValue', - fields: [ - { - kind: 'ObjectField', - name: { kind: 'Name', value: 'type' }, - value: { kind: 'EnumValue', value: 'UPVOTE' }, - }, - ], - }, - }, - ], - }, - { - kind: 'Field', - alias: { kind: 'Name', value: 'downvoted' }, - name: { kind: 'Name', value: 'reacted' }, - arguments: [ - { - kind: 'Argument', - name: { kind: 'Name', value: 'request' }, - value: { - kind: 'ObjectValue', - fields: [ - { - kind: 'ObjectField', - name: { kind: 'Name', value: 'type' }, - value: { kind: 'EnumValue', value: 'DOWNVOTE' }, - }, - ], - }, - }, - ], - }, - { - kind: 'Field', - alias: { kind: 'Name', value: 'collects' }, - name: { kind: 'Name', value: 'countOpenActions' }, - arguments: [ - { - kind: 'Argument', - name: { kind: 'Name', value: 'request' }, - value: { - kind: 'ObjectValue', - fields: [ - { - kind: 'ObjectField', - name: { kind: 'Name', value: 'anyOf' }, - value: { - kind: 'ListValue', - values: [ - { - kind: 'ObjectValue', - fields: [ - { - kind: 'ObjectField', - name: { kind: 'Name', value: 'category' }, - value: { kind: 'EnumValue', value: 'COLLECT' }, - }, - ], - }, - ], - }, - }, - ], - }, - }, - ], - }, - { - kind: 'Field', - name: { kind: 'Name', value: 'countOpenActions' }, - arguments: [ - { - kind: 'Argument', - name: { kind: 'Name', value: 'request' }, - value: { - kind: 'Variable', - name: { kind: 'Name', value: 'profileStatsCountOpenActionArgs' }, - }, - }, - ], - }, - { kind: 'Field', name: { kind: 'Name', value: 'lensClassifierScore' } }, - ], - }, - }, - ], -} as unknown as DocumentNode; -export const PoapEventDocument = { - kind: 'Document', - definitions: [ - { - kind: 'OperationDefinition', - operation: 'query', - name: { kind: 'Name', value: 'PoapEvent' }, - variableDefinitions: [ - { - kind: 'VariableDefinition', - variable: { kind: 'Variable', name: { kind: 'Name', value: 'request' } }, - type: { - kind: 'NonNullType', - type: { kind: 'NamedType', name: { kind: 'Name', value: 'PoapEventQueryRequest' } }, - }, - }, - ], - selectionSet: { - kind: 'SelectionSet', - selections: [ - { - kind: 'Field', - alias: { kind: 'Name', value: 'result' }, - name: { kind: 'Name', value: 'poapEvent' }, - arguments: [ - { - kind: 'Argument', - name: { kind: 'Name', value: 'request' }, - value: { kind: 'Variable', name: { kind: 'Name', value: 'request' } }, - }, - ], - selectionSet: { - kind: 'SelectionSet', - selections: [{ kind: 'FragmentSpread', name: { kind: 'Name', value: 'PoapEvent' } }], - }, - }, - ], - }, - }, - { - kind: 'FragmentDefinition', - name: { kind: 'Name', value: 'PoapEvent' }, - typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'PoapEvent' } }, - selectionSet: { - kind: 'SelectionSet', - selections: [ - { kind: 'Field', name: { kind: 'Name', value: 'id' } }, - { kind: 'Field', name: { kind: 'Name', value: 'fancyId' } }, - { kind: 'Field', name: { kind: 'Name', value: 'name' } }, - { kind: 'Field', name: { kind: 'Name', value: 'eventUrl' } }, - { kind: 'Field', name: { kind: 'Name', value: 'imageUrl' } }, - { kind: 'Field', name: { kind: 'Name', value: 'country' } }, - { kind: 'Field', name: { kind: 'Name', value: 'city' } }, - { kind: 'Field', name: { kind: 'Name', value: 'description' } }, - { kind: 'Field', name: { kind: 'Name', value: 'year' } }, - { kind: 'Field', name: { kind: 'Name', value: 'startDate' } }, - { kind: 'Field', name: { kind: 'Name', value: 'endDate' } }, - { kind: 'Field', name: { kind: 'Name', value: 'expiryDate' } }, - { kind: 'Field', name: { kind: 'Name', value: 'virtualEvent' } }, - { kind: 'Field', name: { kind: 'Name', value: 'fromAdmin' } }, - { kind: 'Field', name: { kind: 'Name', value: 'animationUrl' } }, - { kind: 'Field', name: { kind: 'Name', value: 'eventTemplateId' } }, - { kind: 'Field', name: { kind: 'Name', value: 'privateEvent' } }, - ], - }, - }, - ], -} as unknown as DocumentNode; - -export type SdkFunctionWrapper = ( - action: (requestHeaders?: Record) => Promise, - operationName: string, - operationType?: string, -) => Promise; - -const defaultWrapper: SdkFunctionWrapper = (action, _operationName, _operationType) => action(); -const PoapsDocumentString = print(PoapsDocument); -const MutualPoapsDocumentString = print(MutualPoapsDocument); -const PoapHoldersDocumentString = print(PoapHoldersDocument); -const PoapEventDocumentString = print(PoapEventDocument); -export function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper = defaultWrapper) { - return { - Poaps( - variables: PoapsQueryVariables, - requestHeaders?: GraphQLClientRequestHeaders, - ): Promise<{ data: PoapsQuery; extensions?: any; headers: Dom.Headers; status: number }> { - return withWrapper( - (wrappedRequestHeaders) => - client.rawRequest(PoapsDocumentString, variables, { - ...requestHeaders, - ...wrappedRequestHeaders, - }), - 'Poaps', - 'query', - ); - }, - MutualPoaps( - variables: MutualPoapsQueryVariables, - requestHeaders?: GraphQLClientRequestHeaders, - ): Promise<{ data: MutualPoapsQuery; extensions?: any; headers: Dom.Headers; status: number }> { - return withWrapper( - (wrappedRequestHeaders) => - client.rawRequest(MutualPoapsDocumentString, variables, { - ...requestHeaders, - ...wrappedRequestHeaders, - }), - 'MutualPoaps', - 'query', - ); - }, - PoapHolders( - variables: PoapHoldersQueryVariables, - requestHeaders?: GraphQLClientRequestHeaders, - ): Promise<{ data: PoapHoldersQuery; extensions?: any; headers: Dom.Headers; status: number }> { - return withWrapper( - (wrappedRequestHeaders) => - client.rawRequest(PoapHoldersDocumentString, variables, { - ...requestHeaders, - ...wrappedRequestHeaders, - }), - 'PoapHolders', - 'query', - ); - }, - PoapEvent( - variables: PoapEventQueryVariables, - requestHeaders?: GraphQLClientRequestHeaders, - ): Promise<{ data: PoapEventQuery; extensions?: any; headers: Dom.Headers; status: number }> { - return withWrapper( - (wrappedRequestHeaders) => - client.rawRequest(PoapEventDocumentString, variables, { - ...requestHeaders, - ...wrappedRequestHeaders, - }), - 'PoapEvent', - 'query', - ); - }, - }; -} -export type Sdk = ReturnType; diff --git a/packages/client/src/submodules/poaps/graphql/poap.graphql b/packages/client/src/submodules/poaps/graphql/poap.graphql deleted file mode 100644 index 297274e86e..0000000000 --- a/packages/client/src/submodules/poaps/graphql/poap.graphql +++ /dev/null @@ -1,80 +0,0 @@ -fragment PoapEvent on PoapEvent { - id - fancyId - name - eventUrl - imageUrl - country - city - description - year - startDate - endDate - expiryDate - virtualEvent - fromAdmin - animationUrl - eventTemplateId - privateEvent -} - -fragment PoapToken on PoapToken { - tokenId - eventId - owner { - ...NetworkAddress - } - layer - created - migrated - event { - ...PoapEvent - } -} - -query Poaps($request: UserPoapsQueryRequest!) { - result: poaps(request: $request) { - items { - ...PoapToken - } - pageInfo { - ...PaginatedResultInfo - } - } -} - -query MutualPoaps($request: MutualPoapsQueryRequest!) { - result: mutualPoaps(request: $request) { - items { - ...PoapEvent - } - pageInfo { - ...PaginatedResultInfo - } - } -} - -query PoapHolders( - $request: PoapHoldersQueryRequest! - $profileCoverTransform: ImageTransform! - $profilePictureTransform: ImageTransform! - $profileStatsArg: ProfileStatsArg - $profileStatsCountOpenActionArgs: ProfileStatsCountOpenActionArgs - $profileMetadataSource: AppId - $rateRequest: RateRequest! -) { - result: poapHolders(request: $request) { - items { - ...Profile - } - pageInfo { - ...PaginatedResultInfo - } - } -} - -query PoapEvent($request: PoapEventQueryRequest!) { - result: poapEvent(request: $request) { - ...PoapEvent - } -} diff --git a/packages/client/src/submodules/poaps/index.ts b/packages/client/src/submodules/poaps/index.ts deleted file mode 100644 index b6ebecffb4..0000000000 --- a/packages/client/src/submodules/poaps/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './Poaps'; - -export type { PoapEventFragment, PoapTokenFragment } from './graphql/poap.generated'; diff --git a/packages/client/src/submodules/publication/Publication.ts b/packages/client/src/submodules/publication/Publication.ts index ed89bcf6db..8ee61d8611 100644 --- a/packages/client/src/submodules/publication/Publication.ts +++ b/packages/client/src/submodules/publication/Publication.ts @@ -1,4 +1,4 @@ -import { hasAtLeastOne, never, PromiseResult, success } from '@lens-protocol/shared-kernel'; +import { hasAtLeastOne, never, PromiseResult } from '@lens-protocol/shared-kernel'; import type { Authentication } from '../../authentication'; import { LensContext } from '../../context'; @@ -40,7 +40,6 @@ import { PaginatedResult, requireAuthHeaders, sdkAuthHeaderWrapper, - buildAuthorizationHeader, } from '../../helpers'; import { CreateLegacyCollectBroadcastItemResultFragment, @@ -58,7 +57,7 @@ import { TagResultFragment, } from './graphql/publication.generated'; import { Bookmarks, Reactions, NotInterested, Actions } from './submodules'; -import { FetchPublicationOptions, RequestOverwrites } from './types'; +import { FetchPublicationOptions } from './types'; /** * Publications are the posts, comments, mirrors and quotes that a profile creates. @@ -356,18 +355,10 @@ export class Publication { */ async postOnchain( request: OnchainPostRequest, - overwrites?: RequestOverwrites, ): PromiseResult< RelaySuccessFragment | LensProfileManagerRelayErrorFragment, CredentialsExpiredError | NotAuthenticatedError > { - if (overwrites?.accessToken) { - const overwrittenHeaders = buildAuthorizationHeader(overwrites.accessToken); - - const result = await this.sdk.PostOnchain({ request }, overwrittenHeaders); - return success(result.data.result); - } - return requireAuthHeaders(this.authentication, async (headers) => { const result = await this.sdk.PostOnchain({ request }, headers); return result.data.result; diff --git a/packages/client/src/submodules/publication/types.ts b/packages/client/src/submodules/publication/types.ts index 08e4de119a..30c41650fb 100644 --- a/packages/client/src/submodules/publication/types.ts +++ b/packages/client/src/submodules/publication/types.ts @@ -3,13 +3,3 @@ import { PublicationStatsCountOpenActionArgs } from '../../graphql/types.generat export type FetchPublicationOptions = { publicationStatsCountOpenActionArgs?: PublicationStatsCountOpenActionArgs; }; - -/** - * @experimental This is experimental and might change or be removed in future versions. - */ -export type RequestOverwrites = { - /** - * @experimental - */ - accessToken?: string; -}; diff --git a/packages/client/src/submodules/transaction/graphql/transaction.generated.ts b/packages/client/src/submodules/transaction/graphql/transaction.generated.ts index ae59b10a4b..0a10e1df3a 100644 --- a/packages/client/src/submodules/transaction/graphql/transaction.generated.ts +++ b/packages/client/src/submodules/transaction/graphql/transaction.generated.ts @@ -12,8 +12,6 @@ import { QuoteFragment, CommentFragment, MirrorFragment, - OpenActionResult_KnownCollectOpenActionResult_Fragment, - OpenActionResult_UnknownOpenActionResult_Fragment, RelaySuccessFragment, RelayErrorFragment, CreateMomokaPublicationResultFragment, From e757edf8abb3dad83049291d129378a2c7f3ec24 Mon Sep 17 00:00:00 2001 From: Kris Urbas <605420+krzysu@users.noreply.github.com> Date: Thu, 4 Apr 2024 10:11:03 +0200 Subject: [PATCH 8/8] chore: prepare release react 2.0.0-alpha.38 --- .changeset/pre.json | 3 +++ packages/api-bindings/CHANGELOG.md | 9 +++++++++ packages/api-bindings/package.json | 2 +- packages/blockchain-bindings/CHANGELOG.md | 7 +++++++ packages/blockchain-bindings/package.json | 2 +- packages/client/CHANGELOG.md | 11 +++++++++++ packages/client/package.json | 2 +- packages/domain/CHANGELOG.md | 6 ++++++ packages/domain/package.json | 2 +- packages/react-native/CHANGELOG.md | 15 +++++++++++++++ packages/react-native/package.json | 2 +- packages/react-web/CHANGELOG.md | 14 ++++++++++++++ packages/react-web/package.json | 2 +- packages/react/CHANGELOG.md | 12 ++++++++++++ packages/react/package.json | 2 +- packages/wagmi/CHANGELOG.md | 8 ++++++++ packages/wagmi/package.json | 2 +- 17 files changed, 93 insertions(+), 8 deletions(-) diff --git a/.changeset/pre.json b/.changeset/pre.json index b1d9e074e4..08af89e7ec 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -44,6 +44,7 @@ "chatty-ligers-care", "chatty-socks-promise", "chilled-panthers-march", + "chilled-turtles-pull", "chilly-mirrors-fry", "chilly-toes-check", "cold-pants-do", @@ -98,6 +99,7 @@ "happy-onions-act", "happy-pumpkins-clean", "healthy-avocados-rhyme", + "healthy-poets-serve", "heavy-dodos-raise", "heavy-lizards-eat", "heavy-terms-prove", @@ -177,6 +179,7 @@ "shy-pugs-taste", "silent-mangos-yawn", "silly-meals-tell", + "silly-paws-mate", "six-cherries-notice", "six-feet-sparkle", "six-flowers-smell", diff --git a/packages/api-bindings/CHANGELOG.md b/packages/api-bindings/CHANGELOG.md index ec080ab1cc..4f6166121b 100644 --- a/packages/api-bindings/CHANGELOG.md +++ b/packages/api-bindings/CHANGELOG.md @@ -1,5 +1,14 @@ # @lens-protocol/api-bindings +## 0.11.0-alpha.34 + +### Patch Changes + +- 8dcaeda61: **chore:** remove unused local-only field +- 880fb5de3: **feat:** supports Unknown Reference modules +- Updated dependencies [880fb5de3] + - @lens-protocol/domain@0.11.0-alpha.27 + ## 0.11.0-alpha.33 ### Minor Changes diff --git a/packages/api-bindings/package.json b/packages/api-bindings/package.json index 65fd5b59be..8312b260d6 100644 --- a/packages/api-bindings/package.json +++ b/packages/api-bindings/package.json @@ -1,6 +1,6 @@ { "name": "@lens-protocol/api-bindings", - "version": "0.11.0-alpha.33", + "version": "0.11.0-alpha.34", "description": "Graphql fragments, react hooks, typescript types of lens API.", "repository": { "directory": "packages/api-bindings", diff --git a/packages/blockchain-bindings/CHANGELOG.md b/packages/blockchain-bindings/CHANGELOG.md index b91fea0d5a..29bf2f586c 100644 --- a/packages/blockchain-bindings/CHANGELOG.md +++ b/packages/blockchain-bindings/CHANGELOG.md @@ -1,5 +1,12 @@ # @lens-protocol/blockchain-bindings +## 0.10.0-alpha.28 + +### Patch Changes + +- Updated dependencies [880fb5de3] + - @lens-protocol/domain@0.11.0-alpha.27 + ## 0.10.0-alpha.27 ### Minor Changes diff --git a/packages/blockchain-bindings/package.json b/packages/blockchain-bindings/package.json index 7d5672b61f..9219a71040 100644 --- a/packages/blockchain-bindings/package.json +++ b/packages/blockchain-bindings/package.json @@ -1,6 +1,6 @@ { "name": "@lens-protocol/blockchain-bindings", - "version": "0.10.0-alpha.27", + "version": "0.10.0-alpha.28", "description": "Utilities for interacting with the blockchain.", "repository": { "directory": "packages/blockchain-bindings", diff --git a/packages/client/CHANGELOG.md b/packages/client/CHANGELOG.md index 79f5d8a598..503aa03cea 100644 --- a/packages/client/CHANGELOG.md +++ b/packages/client/CHANGELOG.md @@ -1,5 +1,16 @@ # @lens-protocol/client +## 2.0.0-alpha.38 + +### Minor Changes + +- 9efad9243: **chore:** removed Poaps module as was never implemented on the API side + **chore:** removed accessToken overwrite for `publication.postOnchain` method + +### Patch Changes + +- @lens-protocol/blockchain-bindings@0.10.0-alpha.28 + ## 2.0.0-alpha.37 ### Minor Changes diff --git a/packages/client/package.json b/packages/client/package.json index 607248e9cd..97c57048a4 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@lens-protocol/client", - "version": "2.0.0-alpha.37", + "version": "2.0.0-alpha.38", "description": "Low level Lens API client", "repository": { "directory": "packages/client", diff --git a/packages/domain/CHANGELOG.md b/packages/domain/CHANGELOG.md index 81d57818ef..90bbeb44ec 100644 --- a/packages/domain/CHANGELOG.md +++ b/packages/domain/CHANGELOG.md @@ -1,5 +1,11 @@ # @lens-protocol/domain +## 0.11.0-alpha.27 + +### Patch Changes + +- 880fb5de3: **feat:** supports Unknown Reference modules + ## 0.11.0-alpha.26 ### Minor Changes diff --git a/packages/domain/package.json b/packages/domain/package.json index a5337d39f3..42a701773b 100644 --- a/packages/domain/package.json +++ b/packages/domain/package.json @@ -1,6 +1,6 @@ { "name": "@lens-protocol/domain", - "version": "0.11.0-alpha.26", + "version": "0.11.0-alpha.27", "description": "Critical Business Rules and Application-specific Business Rules", "exports": { "./mocks": { diff --git a/packages/react-native/CHANGELOG.md b/packages/react-native/CHANGELOG.md index 4d6aba3417..5f205de04e 100644 --- a/packages/react-native/CHANGELOG.md +++ b/packages/react-native/CHANGELOG.md @@ -1,5 +1,20 @@ # @lens-protocol/react-native +## 2.0.0-alpha.38 + +### Minor Changes + +- 880fb5de3: **feat:** supports Unknown Reference modules + +### Patch Changes + +- 8dcaeda61: **chore:** remove unused local-only field +- Updated dependencies [8dcaeda61] +- Updated dependencies [880fb5de3] + - @lens-protocol/api-bindings@0.11.0-alpha.34 + - @lens-protocol/react@2.0.0-alpha.38 + - @lens-protocol/domain@0.11.0-alpha.27 + ## 2.0.0-alpha.37 ### Minor Changes diff --git a/packages/react-native/package.json b/packages/react-native/package.json index 2e4df5e593..812475ca03 100644 --- a/packages/react-native/package.json +++ b/packages/react-native/package.json @@ -1,6 +1,6 @@ { "name": "@lens-protocol/react-native", - "version": "2.0.0-alpha.37", + "version": "2.0.0-alpha.38", "description": "Lens Protocol SDK for React Native", "main": "dist/lens-protocol-react-native.cjs.js", "module": "dist/lens-protocol-react-native.esm.js", diff --git a/packages/react-web/CHANGELOG.md b/packages/react-web/CHANGELOG.md index 340ecc1eb7..b4f5c362d8 100644 --- a/packages/react-web/CHANGELOG.md +++ b/packages/react-web/CHANGELOG.md @@ -1,5 +1,19 @@ # @lens-protocol/react-web +## 2.0.0-alpha.38 + +### Minor Changes + +- 880fb5de3: **feat:** supports Unknown Reference modules + +### Patch Changes + +- 8dcaeda61: **chore:** remove unused local-only field +- Updated dependencies [8dcaeda61] +- Updated dependencies [880fb5de3] + - @lens-protocol/react@2.0.0-alpha.38 + - @lens-protocol/domain@0.11.0-alpha.27 + ## 2.0.0-alpha.37 ### Minor Changes diff --git a/packages/react-web/package.json b/packages/react-web/package.json index eb73ebcba2..bbc6b31396 100644 --- a/packages/react-web/package.json +++ b/packages/react-web/package.json @@ -1,6 +1,6 @@ { "name": "@lens-protocol/react-web", - "version": "2.0.0-alpha.37", + "version": "2.0.0-alpha.38", "description": "Lens Protocol SDK for React web applications", "main": "dist/lens-protocol-react-web.cjs.js", "module": "dist/lens-protocol-react-web.esm.js", diff --git a/packages/react/CHANGELOG.md b/packages/react/CHANGELOG.md index af59ab21a3..90898c0fd8 100644 --- a/packages/react/CHANGELOG.md +++ b/packages/react/CHANGELOG.md @@ -1,5 +1,17 @@ # @lens-protocol/react +## 2.0.0-alpha.38 + +### Patch Changes + +- 8dcaeda61: **chore:** remove unused local-only field +- 880fb5de3: **feat:** supports Unknown Reference modules +- Updated dependencies [8dcaeda61] +- Updated dependencies [880fb5de3] + - @lens-protocol/api-bindings@0.11.0-alpha.34 + - @lens-protocol/domain@0.11.0-alpha.27 + - @lens-protocol/blockchain-bindings@0.10.0-alpha.28 + ## 2.0.0-alpha.37 ### Minor Changes diff --git a/packages/react/package.json b/packages/react/package.json index c130e7af1e..b9848f9865 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,6 +1,6 @@ { "name": "@lens-protocol/react", - "version": "2.0.0-alpha.37", + "version": "2.0.0-alpha.38", "description": "Interacting with the Lens Protocol API using React.", "main": "dist/lens-protocol-react.cjs.js", "module": "dist/lens-protocol-react.esm.js", diff --git a/packages/wagmi/CHANGELOG.md b/packages/wagmi/CHANGELOG.md index b34849429f..5ef8e94725 100644 --- a/packages/wagmi/CHANGELOG.md +++ b/packages/wagmi/CHANGELOG.md @@ -1,5 +1,13 @@ # @lens-protocol/wagmi +## 4.0.0-alpha.7 + +### Patch Changes + +- Updated dependencies [8dcaeda61] +- Updated dependencies [880fb5de3] + - @lens-protocol/react-web@2.0.0-alpha.38 + ## 4.0.0-alpha.6 ### Patch Changes diff --git a/packages/wagmi/package.json b/packages/wagmi/package.json index c175820676..e7300d5401 100644 --- a/packages/wagmi/package.json +++ b/packages/wagmi/package.json @@ -1,6 +1,6 @@ { "name": "@lens-protocol/wagmi", - "version": "4.0.0-alpha.6", + "version": "4.0.0-alpha.7", "description": "wagmi bindings for @lens-protocol/react", "repository": { "directory": "packages/wagmi",