From 4183f686a23e8503c0d3f1295f265b6b34d7cca3 Mon Sep 17 00:00:00 2001 From: Kris Urbas <605420+krzysu@users.noreply.github.com> Date: Mon, 25 Mar 2024 10:04:36 +0100 Subject: [PATCH] chore: react - export missing types (#886) --- .changeset/three-books-sit.md | 10 ++++ .../api-bindings/src/lens/ReferenceModule.ts | 2 +- packages/blockchain-bindings/src/data.ts | 4 +- packages/client/src/graphql/index.ts | 1 + packages/react/src/discovery/index.ts | 12 ++++- packages/react/src/discovery/useFeed.ts | 4 +- .../react/src/discovery/useFeedHighlights.ts | 4 +- .../react/src/discovery/useSearchProfiles.ts | 1 - packages/react/src/index.ts | 19 ++++++- packages/react/src/misc/index.ts | 2 +- packages/react/src/notifications/index.ts | 6 +++ .../src/profile/useRecommendProfileToggle.ts | 1 - packages/react/src/publication/index.ts | 49 +++++++++++++++++++ .../src/publication/useBookmarkToggle.ts | 3 -- .../src/publication/useHideCommentToggle.ts | 1 - .../src/publication/useHidePublication.ts | 1 - .../src/publication/useNotInterestedToggle.ts | 4 +- .../src/transactions/useBlockProfiles.ts | 27 +++++----- .../react/src/transactions/useLinkHandle.ts | 1 - .../src/transactions/useSetProfileMetadata.ts | 3 +- .../src/transactions/useUnblockProfiles.ts | 27 +++++----- .../react/src/transactions/useUnfollow.ts | 1 - .../react/src/transactions/useUnlinkHandle.ts | 1 - .../src/transactions/useUpdateFollowPolicy.ts | 1 - .../transactions/useUpdateProfileManagers.ts | 1 - 25 files changed, 129 insertions(+), 57 deletions(-) create mode 100644 .changeset/three-books-sit.md diff --git a/.changeset/three-books-sit.md b/.changeset/three-books-sit.md new file mode 100644 index 0000000000..e99a4d748b --- /dev/null +++ b/.changeset/three-books-sit.md @@ -0,0 +1,10 @@ +--- +"@lens-protocol/blockchain-bindings": patch +"@lens-protocol/api-bindings": patch +"@lens-protocol/client": patch +"@lens-protocol/react": patch +"@lens-protocol/react-native": patch +"@lens-protocol/react-web": patch +--- + +**chore:** exported missing gql types diff --git a/packages/api-bindings/src/lens/ReferenceModule.ts b/packages/api-bindings/src/lens/ReferenceModule.ts index d15f80a726..2e9104e407 100644 --- a/packages/api-bindings/src/lens/ReferenceModule.ts +++ b/packages/api-bindings/src/lens/ReferenceModule.ts @@ -81,7 +81,7 @@ export type ReferencePolicy = * } * ``` * - * @param args - The {@link AnyPublication} to resolve {@link ReferencePolicy} from + * @param publication - The {@link AnyPublication} to resolve {@link ReferencePolicy} from * @returns {@link ReferencePolicy} */ export function resolveReferencePolicy(publication: AnyPublication): ReferencePolicy { diff --git a/packages/blockchain-bindings/src/data.ts b/packages/blockchain-bindings/src/data.ts index 8cc89863fb..22b5d6d6ca 100644 --- a/packages/blockchain-bindings/src/data.ts +++ b/packages/blockchain-bindings/src/data.ts @@ -76,7 +76,7 @@ export function encodeData(abi: ModuleParam[], data: ModuleData): Data { * ); * ``` */ -export function decodeData(abi: ModuleParam[], encoded: string): ModuleData { +export function decodeData(abi: ModuleParam[], calldata: string): ModuleData { const types = abi.map((param) => { return ParamType.fromObject({ name: param.name, @@ -85,5 +85,5 @@ export function decodeData(abi: ModuleParam[], encoded: string): ModuleData { }); }); - return defaultAbiCoder.decode(types, encoded) as ModuleData; + return defaultAbiCoder.decode(types, calldata) as ModuleData; } diff --git a/packages/client/src/graphql/index.ts b/packages/client/src/graphql/index.ts index 6aadbbbdee..ff13cc4f6d 100644 --- a/packages/client/src/graphql/index.ts +++ b/packages/client/src/graphql/index.ts @@ -297,6 +297,7 @@ export { LensTransactionFailureType, LensTransactionStatusType, LimitType, + ManagedProfileVisibility, MarketplaceMetadataAttributeDisplayType, ModuleType, MomokaValidatorError, diff --git a/packages/react/src/discovery/index.ts b/packages/react/src/discovery/index.ts index 050b109b1a..61ce3a7d86 100644 --- a/packages/react/src/discovery/index.ts +++ b/packages/react/src/discovery/index.ts @@ -7,4 +7,14 @@ export * from './useRecommendedProfiles'; export * from './useSearchProfiles'; export * from './useSearchPublications'; -export type { FeedItem, FeedHighlight, ExplorePublication } from '@lens-protocol/api-bindings'; +export type { + ExploreProfilesWhere, + ExplorePublication, + ExplorePublicationsWhere, + FeedHighlight, + FeedHighlightsWhere, + FeedItem, + FeedWhere, + ProfileSearchWhere, + PublicationSearchWhere, +} from '@lens-protocol/api-bindings'; diff --git a/packages/react/src/discovery/useFeed.ts b/packages/react/src/discovery/useFeed.ts index 97cde00d03..0242833469 100644 --- a/packages/react/src/discovery/useFeed.ts +++ b/packages/react/src/discovery/useFeed.ts @@ -2,10 +2,10 @@ import { FeedItem, FeedRequest, useFeed as useBaseFeedQuery } from '@lens-protoc import { SessionType, useSession } from '../authentication'; import { useLensApolloClient } from '../helpers/arguments'; -import { OmitCursor, PaginatedReadResult, usePaginatedReadResult } from '../helpers/reads'; +import { PaginatedArgs, PaginatedReadResult, usePaginatedReadResult } from '../helpers/reads'; import { useFragmentVariables } from '../helpers/variables'; -export type UseFeedArgs = OmitCursor; +export type UseFeedArgs = PaginatedArgs; /** * Fetch a the feed of a given profile and filters. diff --git a/packages/react/src/discovery/useFeedHighlights.ts b/packages/react/src/discovery/useFeedHighlights.ts index d7c5654dae..b9baf57fe2 100644 --- a/packages/react/src/discovery/useFeedHighlights.ts +++ b/packages/react/src/discovery/useFeedHighlights.ts @@ -6,10 +6,10 @@ import { import { SessionType, useSession } from '../authentication'; import { useLensApolloClient } from '../helpers/arguments'; -import { OmitCursor, PaginatedReadResult, usePaginatedReadResult } from '../helpers/reads'; +import { PaginatedArgs, PaginatedReadResult, usePaginatedReadResult } from '../helpers/reads'; import { useFragmentVariables } from '../helpers/variables'; -export type UseFeedHighlightsArgs = OmitCursor; +export type UseFeedHighlightsArgs = PaginatedArgs; /** * Fetch a the highlights of a feed for given profile and filters. diff --git a/packages/react/src/discovery/useSearchProfiles.ts b/packages/react/src/discovery/useSearchProfiles.ts index db15a00b34..ed720bd663 100644 --- a/packages/react/src/discovery/useSearchProfiles.ts +++ b/packages/react/src/discovery/useSearchProfiles.ts @@ -15,7 +15,6 @@ export type UseSearchProfilesArgs = PaginatedArgs; * * @category Discovery * @group Hooks - * @param args - {@link UseSearchProfilesArgs} * * @example * ```tsx diff --git a/packages/react/src/index.ts b/packages/react/src/index.ts index e135f46a90..21f31f59f8 100644 --- a/packages/react/src/index.ts +++ b/packages/react/src/index.ts @@ -42,6 +42,7 @@ export type { CryptoAsset, CryptoNativeAmount, CryptoNativeAsset, + Data, Erc20, Erc20Amount, Erc20Info, @@ -83,13 +84,21 @@ export * from './helpers/tasks'; /** * GQL common types */ -export type { App, OptimisticStatusResult } from '@lens-protocol/api-bindings'; +export type { + App, + ImageSizeTransform, + ImageTransform, + NetworkAddress, + OptimisticStatusResult, +} from '@lens-protocol/api-bindings'; // GQL enums export { + CollectOpenActionModuleType, CommentRankingFilterType, ComparisonOperatorConditionType, CustomFiltersType, + DecryptFailReasonType, ExploreProfilesOrderByType, ExplorePublicationsOrderByType, ExplorePublicationType, @@ -97,13 +106,17 @@ export { FollowModuleType, HiddenCommentsType, LimitType, + ManagedProfileVisibility, MarketplaceMetadataAttributeDisplayType, + MetadataAttributeType, + ModuleType, NftContractType, NotificationType, OpenActionCategoryType, OpenActionModuleType, ProfileActionHistoryType, ProfileInterestTypes, + ProfilesOrderBy, PublicationContentWarningType, PublicationMetadataLicenseType, PublicationMetadataMainFocusType, @@ -124,14 +137,18 @@ export { TransactionError, UserRejectedError, WalletConnectionError, + TransactionErrorReason, + WalletConnectionErrorReason, } from '@lens-protocol/domain/entities'; export { BroadcastingError, BroadcastingErrorReason, } from '@lens-protocol/domain/use-cases/transactions'; +export { ClaimHandleError } from '@lens-protocol/domain/use-cases/profile'; export { InsufficientAllowanceError, InsufficientFundsError, + WalletAlreadyInvitedError, } from '@lens-protocol/domain/use-cases/wallets'; export { InvariantError } from '@lens-protocol/shared-kernel'; export { NotFoundError } from './NotFoundError'; diff --git a/packages/react/src/misc/index.ts b/packages/react/src/misc/index.ts index a81c884b42..f197dcd9a1 100644 --- a/packages/react/src/misc/index.ts +++ b/packages/react/src/misc/index.ts @@ -6,4 +6,4 @@ export * from './useResolveAddress'; export * from './useValidateHandle'; export * from './useWasWalletInvited'; -export type { InvitedResult } from '@lens-protocol/api-bindings'; +export type { InvitedResult, ModuleMetadata } from '@lens-protocol/api-bindings'; diff --git a/packages/react/src/notifications/index.ts b/packages/react/src/notifications/index.ts index 68231f3292..34d111b824 100644 --- a/packages/react/src/notifications/index.ts +++ b/packages/react/src/notifications/index.ts @@ -6,6 +6,12 @@ export type { FollowNotification, MentionNotification, MirrorNotification, + NotificationWhere, + OpenActionProfileActed, + ProfileMirrorResult, + ProfileReactedResult, QuoteNotification, + ReactedResult, + ReactionEvent, ReactionNotification, } from '@lens-protocol/api-bindings'; diff --git a/packages/react/src/profile/useRecommendProfileToggle.ts b/packages/react/src/profile/useRecommendProfileToggle.ts index 60debe2915..2faf1cdd30 100644 --- a/packages/react/src/profile/useRecommendProfileToggle.ts +++ b/packages/react/src/profile/useRecommendProfileToggle.ts @@ -31,7 +31,6 @@ export type UseRecommendProfileToggleArgs = { * * @category Profiles * @group Hooks - * @param args - {@link UseRecommendProfileToggleArgs} */ export function useRecommendProfileToggle(): UseDeferredTask< void, diff --git a/packages/react/src/publication/index.ts b/packages/react/src/publication/index.ts index 53179f73b5..eefb1c1dcb 100644 --- a/packages/react/src/publication/index.ts +++ b/packages/react/src/publication/index.ts @@ -19,12 +19,30 @@ export * from './useWhoReactedToPublication'; */ export type { AnyPublication, + ArticleMetadataV3, + Audio, + AudioMetadataV3, + CheckingInMetadataV3, Comment, DegreesOfSeparationReferenceModuleSettings, + EmbedMetadataV3, + EncryptableAudio, + EncryptableAudioSet, + EncryptableImage, + EncryptableImageSet, + EncryptableVideo, + EncryptableVideoSet, + EventMetadataV3, FollowOnlyReferenceModuleSettings, + GeoLocation, + Image, + ImageMetadataV3, + ImageSet, LegacyAaveFeeCollectModuleSettings, + LegacyDegreesOfSeparationReferenceModuleSettings, LegacyErc4626FeeCollectModuleSettings, LegacyFeeCollectModuleSettings, + LegacyFollowOnlyReferenceModuleSettings, LegacyFreeCollectModuleSettings, LegacyLimitedFeeCollectModuleSettings, LegacyLimitedTimedFeeCollectModuleSettings, @@ -32,20 +50,49 @@ export type { LegacyRevertCollectModuleSettings, LegacySimpleCollectModuleSettings, LegacyTimedFeeCollectModuleSettings, + LinkMetadataV3, + LiveStreamMetadataV3, + MarketplaceMetadata, + MintMetadataV3, Mirror, MomokaInfo, MultirecipientFeeCollectOpenActionSettings, + OpenActionFilter, Post, PrimaryPublication, + ProfileCoverSet, + ProfileMentioned, ProfileWhoReactedResult, + PublicationBookmarksWhere, + PublicationCommentOn, + PublicationCommentOnRanking, + PublicationMarketplaceMetadataAttribute, PublicationMetadata, + PublicationMetadataContentWarningFilter, + PublicationMetadataFilters, + PublicationMetadataLitEncryption, PublicationMetadataMedia, + PublicationMetadataMediaAudio, + PublicationMetadataMediaImage, + PublicationMetadataMediaVideo, + PublicationMetadataTagsFilter, PublicationOperations, PublicationStats, + PublicationsWhere, Quote, SimpleCollectOpenActionSettings, + SpaceMetadataV3, + StoryMetadataV3, + TextOnlyMetadataV3, + ThreeDMetadataV3, + ThreeDMetadataV3Asset, + TransactionMetadataV3, UnknownOpenActionModuleSettings, UnknownReferenceModuleSettings, + Video, + VideoMetadataV3, + WhoActedOnPublicationWhere, + WhoReactedPublicationWhere, } from '@lens-protocol/api-bindings'; /** @@ -65,10 +112,12 @@ export { } from '@lens-protocol/api-bindings'; export type { AnyoneReferencePolicy, + CollectFee, CollectModuleSettings, CollectPolicy, DegreesOfSeparationReferencePolicy, FollowersOnlyReferencePolicy, + MultirecipientCollectFee, NoReferencePolicy, ReferenceModule, ReferencePolicy, diff --git a/packages/react/src/publication/useBookmarkToggle.ts b/packages/react/src/publication/useBookmarkToggle.ts index 9ae8fe2105..4f29cdc204 100644 --- a/packages/react/src/publication/useBookmarkToggle.ts +++ b/packages/react/src/publication/useBookmarkToggle.ts @@ -9,8 +9,6 @@ export type UseBookmarkToggleArgs = { publication: AnyPublication; }; -export type BookmarkOperation = UseDeferredTask; - /** * `useBookmarkToggle` hook lets the user save or remove a publication from their bookmarks. * @@ -21,7 +19,6 @@ export type BookmarkOperation = UseDeferredTask { const { data: session } = useSession(); diff --git a/packages/react/src/publication/useHidePublication.ts b/packages/react/src/publication/useHidePublication.ts index 5110f11ba4..3bd172c030 100644 --- a/packages/react/src/publication/useHidePublication.ts +++ b/packages/react/src/publication/useHidePublication.ts @@ -35,7 +35,6 @@ export type UseHidePublicationArgs = { * * @category Publications * @group Hooks - * @param args - {@link UseHidePublicationArgs} */ export function useHidePublication(): UseDeferredTask { const { data: session } = useSession(); diff --git a/packages/react/src/publication/useNotInterestedToggle.ts b/packages/react/src/publication/useNotInterestedToggle.ts index e805f105c6..16e0adafd2 100644 --- a/packages/react/src/publication/useNotInterestedToggle.ts +++ b/packages/react/src/publication/useNotInterestedToggle.ts @@ -9,8 +9,6 @@ export type UseNotInterestedToggleArgs = { publication: AnyPublication; }; -export type NotInterestedOperation = UseDeferredTask; - /** * `useNotInterestedToggle` hook let's the active profile toggle the not interested status of a publication. * @@ -37,7 +35,7 @@ export type NotInterestedOperation = UseDeferredTask { const { data: session } = useSession(); const { add, remove } = useNotInterestedController(); diff --git a/packages/react/src/transactions/useBlockProfiles.ts b/packages/react/src/transactions/useBlockProfiles.ts index c6c33c7f43..0ed993efad 100644 --- a/packages/react/src/transactions/useBlockProfiles.ts +++ b/packages/react/src/transactions/useBlockProfiles.ts @@ -41,19 +41,6 @@ export type BlockProfileArgs = { sponsored?: boolean; }; -export type BlockOperation = UseDeferredTask< - AsyncTransactionResult, - | BroadcastingError - | InsufficientAllowanceError - | InsufficientFundsError - | InsufficientGasError - | PendingSigningRequestError - | TransactionError - | UserRejectedError - | WalletConnectionError, - BlockProfileArgs ->; - /** * Block one or many profiles. * @@ -61,7 +48,6 @@ export type BlockOperation = UseDeferredTask< * * @category Profiles * @group Hooks - * @param args - {@link BlockProfileArgs} * * @example * ```ts @@ -246,7 +232,18 @@ export type BlockOperation = UseDeferredTask< * whitelisted one (e.g. localhost). * */ -export function useBlockProfiles(): BlockOperation { +export function useBlockProfiles(): UseDeferredTask< + AsyncTransactionResult, + | BroadcastingError + | InsufficientAllowanceError + | InsufficientFundsError + | InsufficientGasError + | PendingSigningRequestError + | TransactionError + | UserRejectedError + | WalletConnectionError, + BlockProfileArgs +> { const { data: session } = useSession(); const blockProfile = useBlockProfilesController(); const configureRequest = useSponsoredConfig(); diff --git a/packages/react/src/transactions/useLinkHandle.ts b/packages/react/src/transactions/useLinkHandle.ts index 2b8ac4f9b3..5ae289932e 100644 --- a/packages/react/src/transactions/useLinkHandle.ts +++ b/packages/react/src/transactions/useLinkHandle.ts @@ -43,7 +43,6 @@ export type LinkHandleArgs = { * * @category Profiles * @group Hooks - * @param args - {@link LinkHandleArgs} * * @example * ```tsx diff --git a/packages/react/src/transactions/useSetProfileMetadata.ts b/packages/react/src/transactions/useSetProfileMetadata.ts index 9b1e3bec65..e0bf38d983 100644 --- a/packages/react/src/transactions/useSetProfileMetadata.ts +++ b/packages/react/src/transactions/useSetProfileMetadata.ts @@ -219,7 +219,6 @@ export type UseSetProfileMetadataArgs = { * * @category Profiles * @group Hooks - * @param args - {@link UseSetProfileMetadataArgs} */ export function useSetProfileMetadata(): UseDeferredTask< AsyncTransactionResult, @@ -234,7 +233,7 @@ export function useSetProfileMetadata(): UseDeferredTask< const { data: session } = useSession(); const configureRequest = useSponsoredConfig(); - return useDeferredTask(async (args: UseSetProfileMetadataArgs) => { + return useDeferredTask(async (args) => { invariant( session?.type === SessionType.WithProfile, 'You must be authenticated to set profile metadata. Use `useLogin` hook to authenticate.', diff --git a/packages/react/src/transactions/useUnblockProfiles.ts b/packages/react/src/transactions/useUnblockProfiles.ts index 3aa39c7a18..774757513c 100644 --- a/packages/react/src/transactions/useUnblockProfiles.ts +++ b/packages/react/src/transactions/useUnblockProfiles.ts @@ -40,18 +40,6 @@ export type UnblockProfileArgs = { sponsored?: boolean; }; -export type UnblockOperation = UseDeferredTask< - AsyncTransactionResult, - | BroadcastingError - | InsufficientAllowanceError - | InsufficientFundsError - | InsufficientGasError - | PendingSigningRequestError - | UserRejectedError - | WalletConnectionError, - UnblockProfileArgs ->; - /** * Unblock one or many profiles. * @@ -59,7 +47,6 @@ export type UnblockOperation = UseDeferredTask< * * @category Profiles * @group Hooks - * @param args - {@link UnblockProfileArgs} * * @example * ```ts @@ -83,7 +70,7 @@ export type UnblockOperation = UseDeferredTask< * * ## Unblock multiple profiles * - * Unbblock multiple profiles. + * Unblock multiple profiles. * * ```tsx * const { execute, loading, error } = useUnblockProfiles(); @@ -244,7 +231,17 @@ export type UnblockOperation = UseDeferredTask< * whitelisted one (e.g. localhost). * */ -export function useUnblockProfiles(): UnblockOperation { +export function useUnblockProfiles(): UseDeferredTask< + AsyncTransactionResult, + | BroadcastingError + | InsufficientAllowanceError + | InsufficientFundsError + | InsufficientGasError + | PendingSigningRequestError + | UserRejectedError + | WalletConnectionError, + UnblockProfileArgs +> { const { data: session } = useSession(); const unblockProfile = useUnblockProfilesController(); const configureRequest = useSponsoredConfig(); diff --git a/packages/react/src/transactions/useUnfollow.ts b/packages/react/src/transactions/useUnfollow.ts index 4b8b5d8939..2855f338a9 100644 --- a/packages/react/src/transactions/useUnfollow.ts +++ b/packages/react/src/transactions/useUnfollow.ts @@ -50,7 +50,6 @@ export type UnfollowArgs = { * * @category Profiles * @group Hooks - * @param args - {@link UnfollowArgs} * * @example * ```tsx diff --git a/packages/react/src/transactions/useUnlinkHandle.ts b/packages/react/src/transactions/useUnlinkHandle.ts index 3d57b70d29..12093ca9cb 100644 --- a/packages/react/src/transactions/useUnlinkHandle.ts +++ b/packages/react/src/transactions/useUnlinkHandle.ts @@ -43,7 +43,6 @@ export type UnlinkHandleArgs = { * * @category Profiles * @group Hooks - * @param args - {@link UnlinkHandleArgs} * * @example * ```tsx diff --git a/packages/react/src/transactions/useUpdateFollowPolicy.ts b/packages/react/src/transactions/useUpdateFollowPolicy.ts index 825d63c0fc..e20c521d34 100644 --- a/packages/react/src/transactions/useUpdateFollowPolicy.ts +++ b/packages/react/src/transactions/useUpdateFollowPolicy.ts @@ -47,7 +47,6 @@ export type UpdateFollowPolicyArgs = { * * @category Profiles * @group Hooks - * @param args - {@link UpdateFollowPolicyArgs} * * @example * ```tsx diff --git a/packages/react/src/transactions/useUpdateProfileManagers.ts b/packages/react/src/transactions/useUpdateProfileManagers.ts index 2340329e2d..47bb5c2320 100644 --- a/packages/react/src/transactions/useUpdateProfileManagers.ts +++ b/packages/react/src/transactions/useUpdateProfileManagers.ts @@ -194,7 +194,6 @@ export type UpdateProfileManagersArgs = AtLeastOneOf<{ * * @category Profiles * @group Hooks - * @param args - {@link UpdateProfileManagersArgs} */ export function useUpdateProfileManagers(): UseDeferredTask< void,