diff --git a/.changeset/hip-baboons-camp.md b/.changeset/hip-baboons-camp.md new file mode 100644 index 0000000000..28819da8b6 --- /dev/null +++ b/.changeset/hip-baboons-camp.md @@ -0,0 +1,8 @@ +--- +"@lens-protocol/api-bindings": patch +"@lens-protocol/react": patch +"@lens-protocol/react-native": patch +"@lens-protocol/react-web": patch +--- + +**Fixed**: missing export of `findCollectModuleSettings` and `isCollectModuleSettings` helpers diff --git a/.changeset/shaggy-colts-turn.md b/.changeset/shaggy-colts-turn.md new file mode 100644 index 0000000000..26213bbb76 --- /dev/null +++ b/.changeset/shaggy-colts-turn.md @@ -0,0 +1,7 @@ +--- +"@lens-protocol/react": patch +"@lens-protocol/react-native": patch +"@lens-protocol/react-web": patch +--- + +**fixed:** return type of `useLazyModuleMetadata` diff --git a/.changeset/silent-mangos-yawn.md b/.changeset/silent-mangos-yawn.md new file mode 100644 index 0000000000..a75f617025 --- /dev/null +++ b/.changeset/silent-mangos-yawn.md @@ -0,0 +1,7 @@ +--- +"@lens-protocol/react": patch +"@lens-protocol/react-native": patch +"@lens-protocol/react-web": patch +--- + +**fix:** exports missing `AsyncTransactionResult` diff --git a/.changeset/witty-roses-burn.md b/.changeset/witty-roses-burn.md new file mode 100644 index 0000000000..18c148ede5 --- /dev/null +++ b/.changeset/witty-roses-burn.md @@ -0,0 +1,7 @@ +--- +"@lens-protocol/react": patch +"@lens-protocol/react-native": patch +"@lens-protocol/react-web": patch +--- + +**fix:** exports missing `ProfileFields` type diff --git a/examples/web/src/publications/UseOpenAction.tsx b/examples/web/src/publications/UseOpenAction.tsx index 519788d5d5..99d896c7e7 100644 --- a/examples/web/src/publications/UseOpenAction.tsx +++ b/examples/web/src/publications/UseOpenAction.tsx @@ -89,13 +89,6 @@ function TestScenario({ id }: { id: PublicationId }) { -
-

- At the time of this example writing there is a known API issue resulting in{' '} - PublicationOperations.canCollect (SDK alias of canAct) returning - always 'NO'. -

-
); } diff --git a/packages/api-bindings/src/lens/utils/KnownCollectModuleSettings.ts b/packages/api-bindings/src/lens/utils/CollectModuleSettings.ts similarity index 71% rename from packages/api-bindings/src/lens/utils/KnownCollectModuleSettings.ts rename to packages/api-bindings/src/lens/utils/CollectModuleSettings.ts index 3f61cb6650..6d31e5e5bf 100644 --- a/packages/api-bindings/src/lens/utils/KnownCollectModuleSettings.ts +++ b/packages/api-bindings/src/lens/utils/CollectModuleSettings.ts @@ -1,7 +1,7 @@ import * as gql from '../graphql/generated'; import { OpenActionModuleSettings, PrimaryPublication } from '../publication'; -export type KnownCollectModuleSettings = +export type CollectModuleSettings = | gql.LegacyAaveFeeCollectModuleSettings | gql.LegacyErc4626FeeCollectModuleSettings | gql.LegacyFeeCollectModuleSettings @@ -31,16 +31,26 @@ const ModulesWithKnownCollectCapability: Record { describe.each<{ name: string; - mockPublicationWith: (settings: KnownCollectModuleSettings) => AnyPublication; + mockPublicationWith: (settings: CollectModuleSettings) => AnyPublication; }>([ { name: 'Post', diff --git a/packages/api-bindings/src/lens/utils/index.ts b/packages/api-bindings/src/lens/utils/index.ts index 11ce79948c..9b7df414a1 100644 --- a/packages/api-bindings/src/lens/utils/index.ts +++ b/packages/api-bindings/src/lens/utils/index.ts @@ -1,4 +1,5 @@ export * from './amount'; +export * from './CollectModuleSettings'; export * from './isValidHandle'; export * from './omitTypename'; export * from './open-actions'; diff --git a/packages/api-bindings/src/lens/utils/open-actions.ts b/packages/api-bindings/src/lens/utils/open-actions.ts index 7c5ab72c89..a89ea538eb 100644 --- a/packages/api-bindings/src/lens/utils/open-actions.ts +++ b/packages/api-bindings/src/lens/utils/open-actions.ts @@ -10,7 +10,7 @@ import { Data, EvmAddress, invariant, never } from '@lens-protocol/shared-kernel import * as gql from '../graphql/generated'; import { AnyPublication, OpenActionModuleSettings } from '../publication'; -import { findCollectActionModuleSettings } from './KnownCollectModuleSettings'; +import { findCollectModuleSettings } from './CollectModuleSettings'; import { erc20Amount } from './amount'; /** @@ -76,7 +76,7 @@ function resolveCollectRequestFor( context: OpenActionContext, ): CollectRequest { const collectable = publication.__typename === 'Mirror' ? publication.mirrorOn : publication; - const settings = findCollectActionModuleSettings(collectable); + const settings = findCollectModuleSettings(collectable); invariant(settings, 'No open action module settings found for publication'); diff --git a/packages/api-bindings/src/lens/utils/token-allowance.ts b/packages/api-bindings/src/lens/utils/token-allowance.ts index 6675268b12..d7936ee93d 100644 --- a/packages/api-bindings/src/lens/utils/token-allowance.ts +++ b/packages/api-bindings/src/lens/utils/token-allowance.ts @@ -7,14 +7,14 @@ import { assertNever, invariant, never } from '@lens-protocol/shared-kernel'; import { Profile } from '../graphql/generated'; import { AnyPublication, PrimaryPublication } from '../publication'; -import { findCollectActionModuleSettings } from './KnownCollectModuleSettings'; +import { findCollectModuleSettings } from './CollectModuleSettings'; import { erc20Amount } from './amount'; export function resolveTokenAllowanceRequestForCollect( publication: PrimaryPublication, limit: TokenAllowanceLimit, ): TokenAllowanceRequest { - const module = findCollectActionModuleSettings(publication); + const module = findCollectModuleSettings(publication); invariant(module, `Publication ${publication.id} has no collect module`); diff --git a/packages/client/src/submodules/modules/index.ts b/packages/client/src/submodules/modules/index.ts index fe8fc9da84..ecc5a22b86 100644 --- a/packages/client/src/submodules/modules/index.ts +++ b/packages/client/src/submodules/modules/index.ts @@ -6,5 +6,6 @@ export type { GenerateModuleCurrencyApprovalResultFragment, KnownSupportedModuleFragment, ModuleInfoFragment, + ModuleMetadataResultFragment, UnknownSupportedModuleFragment, } from './graphql/modules.generated'; diff --git a/packages/domain/src/use-cases/publications/OpenActionConfig.ts b/packages/domain/src/use-cases/publications/OpenActionConfig.ts index 13c6cb1c9d..7f70eb7fc8 100644 --- a/packages/domain/src/use-cases/publications/OpenActionConfig.ts +++ b/packages/domain/src/use-cases/publications/OpenActionConfig.ts @@ -8,7 +8,7 @@ export type RecipientWithSplit = { /** * The split of the collect fee. * - * Number between 0-1 with up to 2 decimals of precision (e.g. 0.5 for 50%) + * Number between 1-100 with up to 2 decimals of precision (e.g. 10.5 for 10.5%) */ split: number; }; diff --git a/packages/react/src/misc/useModuleMetadata.ts b/packages/react/src/misc/useModuleMetadata.ts index 5201b8e590..e8cf3ddf9a 100644 --- a/packages/react/src/misc/useModuleMetadata.ts +++ b/packages/react/src/misc/useModuleMetadata.ts @@ -11,6 +11,8 @@ import { useLensApolloClient } from '../helpers/arguments'; import { ReadResult, useReadResult } from '../helpers/reads'; import { useDeferredTask, UseDeferredTask } from '../helpers/tasks'; +export type { ModuleMetadataResult }; + /** * {@link useModuleMetadata} hook arguments */ @@ -69,7 +71,7 @@ export type FetchModuleMetadataArgs = { * @group Hooks */ export function useLazyModuleMetadata(): UseDeferredTask< - ModuleMetadataResult | null, + ModuleMetadataResult, NotFoundError | UnspecifiedError, UseModuleMetadataArgs > { diff --git a/packages/react/src/profile/index.ts b/packages/react/src/profile/index.ts index acdcc02a02..1dee71b491 100644 --- a/packages/react/src/profile/index.ts +++ b/packages/react/src/profile/index.ts @@ -21,6 +21,7 @@ export type { HandleInfo, NftImage, Profile, + ProfileFields, ProfileActionHistory, ProfileGuardianResult, ProfileManager, diff --git a/packages/react/src/publication/index.ts b/packages/react/src/publication/index.ts index 1e461b819a..0b02818d13 100644 --- a/packages/react/src/publication/index.ts +++ b/packages/react/src/publication/index.ts @@ -53,4 +53,6 @@ export { isMirrorPublication, isQuotePublication, isPrimaryPublication, + findCollectModuleSettings, + isCollectModuleSettings, } from '@lens-protocol/api-bindings'; diff --git a/packages/react/src/transactions/adapters/SelfFundedProtocolTransactionRequest.ts b/packages/react/src/transactions/adapters/SelfFundedProtocolTransactionRequest.ts deleted file mode 100644 index f730305da1..0000000000 --- a/packages/react/src/transactions/adapters/SelfFundedProtocolTransactionRequest.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { ProtocolTransactionRequestModel } from '@lens-protocol/domain/entities'; -import { Data, Distribute, EvmAddress } from '@lens-protocol/shared-kernel'; - -/** - * @internal - * @privateRemarks intentionally not exported - */ -type RawTransactionDetails = { - contractAddress: EvmAddress; - encodedData: Data; -}; - -/** - * @deprecated this is going to be removed soon - */ -export type SelfFundedProtocolTransactionRequest = - Distribute; diff --git a/packages/react/src/transactions/adapters/__helpers__/mocks.ts b/packages/react/src/transactions/adapters/__helpers__/mocks.ts index 5a89c2c9d4..dc90d4a065 100644 --- a/packages/react/src/transactions/adapters/__helpers__/mocks.ts +++ b/packages/react/src/transactions/adapters/__helpers__/mocks.ts @@ -11,7 +11,7 @@ import { mockProtocolTransactionRequestModel, mockTransactionHash, } from '@lens-protocol/domain/mocks'; -import { ChainType, Data } from '@lens-protocol/shared-kernel'; +import { ChainType } from '@lens-protocol/shared-kernel'; import { mockEvmAddress } from '@lens-protocol/shared-kernel/mocks'; import { MockProvider } from 'ethereum-waffle'; import { mock } from 'jest-mock-extended'; @@ -19,7 +19,6 @@ import { mock } from 'jest-mock-extended'; import { UnsignedProtocolCall } from '../../../wallet/adapters/ConcreteWallet'; import { ITransactionObserver, TransactionFactory } from '../../infrastructure/TransactionFactory'; import { MetaTransactionData, NativeTransactionData } from '../ITransactionFactory'; -import { SelfFundedProtocolTransactionRequest } from '../SelfFundedProtocolTransactionRequest'; export function mockITransactionFactory( transactionObserver: ITransactionObserver = mock(), @@ -86,16 +85,6 @@ export function mockNativeTransactionDataWithRelayerTxId< }; } -export function mockSelfFundedProtocolTransactionRequest< - TRequest extends ProtocolTransactionRequestModel, ->(): SelfFundedProtocolTransactionRequest { - return { - contractAddress: mockEvmAddress(), - encodedData: faker.datatype.hexadecimal({ length: 32 }) as Data, - ...mockAnyTransactionRequestModel(), - } as SelfFundedProtocolTransactionRequest; -} - export function assertUnsignedProtocolCallCorrectness( unsignedProtocolCall: UnsignedProtocolCall, broadcastResult: { diff --git a/packages/react/src/transactions/index.ts b/packages/react/src/transactions/index.ts index fca4854381..9bb3b52979 100644 --- a/packages/react/src/transactions/index.ts +++ b/packages/react/src/transactions/index.ts @@ -1,3 +1,5 @@ +export type { AsyncTransactionResult } from './adapters/AsyncTransactionResult'; + export * from './useApproveModule'; export * from './useClaimHandle'; export * from './useCreateComment'; diff --git a/packages/react/src/transactions/useCreateComment.ts b/packages/react/src/transactions/useCreateComment.ts index 89ed8e28c8..a0789f9dac 100644 --- a/packages/react/src/transactions/useCreateComment.ts +++ b/packages/react/src/transactions/useCreateComment.ts @@ -233,11 +233,11 @@ export type CreateCommentArgs = { * recipients: [ * { * recipient: '0x4f94FAFEE38F545920485fC747467EFc85C302E0', - * split: 0.3, // 30% + * split: 30, // 30% * }, * { * recipient: '0x097A4fE5cfFf0360438990b88549d4288748f6cB', - * split: 0.7, // 70% + * split: 70, // 70% * }, * ], * endsAt: new Date('2025-12-31T00:00:00.000Z'), diff --git a/packages/react/src/transactions/useCreatePost.ts b/packages/react/src/transactions/useCreatePost.ts index 383b6081cf..4cb7d1111a 100644 --- a/packages/react/src/transactions/useCreatePost.ts +++ b/packages/react/src/transactions/useCreatePost.ts @@ -222,11 +222,11 @@ export type CreatePostArgs = { * recipients: [ * { * recipient: '0x4f94FAFEE38F545920485fC747467EFc85C302E0', - * split: 0.3, // 30% + * split: 30, // 30% * }, * { * recipient: '0x097A4fE5cfFf0360438990b88549d4288748f6cB', - * split: 0.7, // 70% + * split: 70, // 70% * }, * ], * endsAt: new Date('2025-12-31T00:00:00.000Z'), @@ -390,7 +390,7 @@ export type CreatePostArgs = { * case 'BroadcastingError': * if ([BroadcastingErrorReason.NOT_SPONSORED, BroadcastingErrorReason.RATE_LIMITED].includes(sponsoredResult.error.reason)) { * - * const chargedResult = = await execute({ + * const chargedResult = await execute({ * metadata: uri, * sponsored: false, * }); @@ -460,17 +460,13 @@ export function useCreatePost(): UseDeferredTask< return useDeferredTask(async (args: CreatePostArgs) => { invariant( - session?.authenticated, - 'You must be authenticated to create a post. Use `useLogin` hook to authenticate.', - ); - invariant( - session.type === SessionType.WithProfile, - 'You must have a profile to create a post.', + session?.type === SessionType.WithProfile, + 'You must be authenticated with a Profile to post. Use `useLogin` hook to authenticate.', ); const request = createPostRequest({ signless: session.profile.signless, - sponsored: args.sponsored ?? true, + sponsored: args.sponsored ?? session.profile.sponsor, ...args, }); diff --git a/packages/react/src/transactions/useCreateQuote.ts b/packages/react/src/transactions/useCreateQuote.ts index 52e52f939e..b75f901980 100644 --- a/packages/react/src/transactions/useCreateQuote.ts +++ b/packages/react/src/transactions/useCreateQuote.ts @@ -231,11 +231,11 @@ export type CreateQuoteArgs = { * recipients: [ * { * recipient: '0x4f94FAFEE38F545920485fC747467EFc85C302E0', - * split: 0.3, // 30% + * split: 30, // 30% * }, * { * recipient: '0x097A4fE5cfFf0360438990b88549d4288748f6cB', - * split: 0.7, // 70% + * split: 70, // 70% * }, * ], * endsAt: new Date('2025-12-31T00:00:00.000Z'), diff --git a/packages/react/src/wallet/adapters/ConcreteWallet.ts b/packages/react/src/wallet/adapters/ConcreteWallet.ts index 106fc9b29c..ee4ec9258f 100644 --- a/packages/react/src/wallet/adapters/ConcreteWallet.ts +++ b/packages/react/src/wallet/adapters/ConcreteWallet.ts @@ -34,7 +34,6 @@ import { z } from 'zod'; import { UnsignedVote } from '../../polls/adapters/SnapshotVoteFactory'; import { ISnapshotVote } from '../../polls/adapters/SnapshotVoteRelayer'; import { ITransactionFactory } from '../../transactions/adapters/ITransactionFactory'; -import { SelfFundedProtocolTransactionRequest } from '../../transactions/adapters/SelfFundedProtocolTransactionRequest'; import { assertErrorObjectWithCode } from './errors'; export type RequiredSigner = Signer & TypedDataSigner; @@ -72,7 +71,6 @@ export class UnsignedProtocolCall id: string; request: T; typedData: TypedData; - fallback?: SelfFundedProtocolTransactionRequest; // TODO remove fallback }): UnsignedProtocolCall { return new UnsignedProtocolCall(id, request, typedData); } diff --git a/packages/react/src/wallet/adapters/__helpers__/mocks.ts b/packages/react/src/wallet/adapters/__helpers__/mocks.ts index 7f260cc1d6..699175d5bc 100644 --- a/packages/react/src/wallet/adapters/__helpers__/mocks.ts +++ b/packages/react/src/wallet/adapters/__helpers__/mocks.ts @@ -19,10 +19,7 @@ import { mock } from 'jest-mock-extended'; import { when } from 'jest-when'; import { ITransactionFactory } from '../../../transactions/adapters/ITransactionFactory'; -import { - mockSelfFundedProtocolTransactionRequest, - mockTypedData, -} from '../../../transactions/adapters/__helpers__/mocks'; +import { mockTypedData } from '../../../transactions/adapters/__helpers__/mocks'; import { ConcreteWallet, ISignerFactory, @@ -64,7 +61,6 @@ export function mockUnsignedProtocolCall(), }); }