lens-protocol / lens-sdk

The official SDK to interact with the Lens Protocol
https://docs.lens.xyz/docs/what-is-lens
MIT License
235 stars 75 forks source link

usePublications failed to execute if one of publication on scope have an invalid encryption condition #926

Open Djangoz1 opened 7 months ago

Djangoz1 commented 7 months ago

Describe the bug With usePublications react hook, if profile post a publications encrypted with invalid currency object/address condition, we can't retrieve any publications and I can't retrieve publications at all

To Reproduce

Expected behaviuor Perhaps a modifier would be needed to verify the validity of the conditions before encryption

If using the React bindings, what is the essence of your React app?

Version of the packages you are using "@lens-protocol/client": "2.0.0-alpha.37", "@lens-protocol/metadata": "^1.1.6", "@lens-protocol/react-web": "latest", "@lens-protocol/wagmi":"latest",`

Additional context In all applications, the profile page returns UnspecifiedError: { "name": "ApolloError", "graphQLErrors": [ { "message": "Currency not found for contract 0xD13c7342e1ef687C5ad21b27c2b65D772cAb5C8c:137", "locations": [ { "line": 1782, "column": 3 } ], "path": [ "result", "items", 2, "metadata" ], "extensions": { "code": "GRAPHQL_VALIDATION_FAILED", "stacktrace": [ "GraphQLError: Currency not found for contract 0xD13c7342e1ef687C5ad21b27c2b65D772cAb5C8c:137", " at new ValidationError (/usr/src/app/packages/apollo-server-errors/lib/index.js:40:9)", " at getModuleCurrency (/usr/src/app/packages/api-lens/lib/currency/operations/get-module-currency.js:14:15)", " at process.processTicksAndRejections (node:internal/process/task_queues:95:5)", " at async Amount.fromValueAndCurrency (/usr/src/app/packages/api-lens/lib/shared/types/amount.js:35:23)", " at async Erc20OwnershipCondition.fromMetadataErc20OwnershipCondition (/usr/src/app/packages/api-lens/lib/shared/types/gated.js:86:25)", " at async Promise.all (index 1)", " at async OrCondition.fromMetadataSimpleConditionList (/usr/src/app/packages/api-lens/lib/shared/types/gated.js:286:27)", " at async Promise.all (index 1)", " at async RootCondition.fromMetadataRootConditionCriteria (/usr/src/app/packages/api-lens/lib/shared/types/gated.js:263:27)", " at async PublicationMetadataLitEncryption.fromPublicationMetadata (/usr/src/app/packages/api-lens/lib/publication/types/metadata.js:73:34)", " at async TextOnlyMetadataV3.resolveModernPublicationMetadata (/usr/src/app/packages/api-lens/lib/publication/types/metadata.js:159:32)", " at async TextOnlyMetadataV3.fromTextOnlyMetadata (/usr/src/app/packages/api-lens/lib/publication/types/metadata.js:877:24)" ] } } ], "message": "Currency not found for contract 0xD13c7342e1ef687C5ad21b27c2b65D772cAb5C8c:137" }

cesarenaldi commented 7 months ago

@Djangoz1 thank you for reporting this issue. Can you please clarify "invalid currency object/address condition"? What makes it invalid?

Can you also clarify what you mean by "modifier" here?

Perhaps a modifier would be needed to verify the validity of the conditions before encryption