lens-protocol / lens-sdk

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

Error in judgment : InvariantError: Expected array of to have exactly one item. #436

Closed jingledongding closed 1 year ago

jingledongding commented 1 year ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch @lens-protocol/shared-kernel@0.9.0 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/@lens-protocol/shared-kernel/dist/lens-protocol-shared-kernel.cjs.dev.js b/node_modules/@lens-protocol/shared-kernel/dist/lens-protocol-shared-kernel.cjs.dev.js
index 8df3c2b..42cc040 100644
--- a/node_modules/@lens-protocol/shared-kernel/dist/lens-protocol-shared-kernel.cjs.dev.js
+++ b/node_modules/@lens-protocol/shared-kernel/dist/lens-protocol-shared-kernel.cjs.dev.js
@@ -26,8 +26,11 @@ function assertNonEmptyArray(items) {
 function hasJustOne(items) {
   return items.length === 1;
 }
+function hasTwoOrLess(items) {
+  return items.length <= 2;
+}
 function assertJustOne(items) {
-  Amount.invariant(hasJustOne(items), 'Expected array of to have exactly one item.');
+  Amount.invariant(hasTwoOrLess(items), 'Expected array of to have exactly one item.');
 }
 function removeAtIndex(items, index) {
   return items.slice(0, index).concat(items.slice(index + 1));
diff --git a/node_modules/@lens-protocol/shared-kernel/dist/lens-protocol-shared-kernel.cjs.prod.js b/node_modules/@lens-protocol/shared-kernel/dist/lens-protocol-shared-kernel.cjs.prod.js
index 2b6c25d..28d4939 100644
--- a/node_modules/@lens-protocol/shared-kernel/dist/lens-protocol-shared-kernel.cjs.prod.js
+++ b/node_modules/@lens-protocol/shared-kernel/dist/lens-protocol-shared-kernel.cjs.prod.js
@@ -26,8 +26,11 @@ function assertNonEmptyArray(items) {
 function hasJustOne(items) {
   return items.length === 1;
 }
+function hasTwoOrLess(items) {
+  return items.length <= 2;
+}
 function assertJustOne(items) {
-  Amount.invariant(hasJustOne(items), 'Expected array of to have exactly one item.');
+  Amount.invariant(hasTwoOrLess(items), 'Expected array of to have exactly one item.');
 }
 function removeAtIndex(items, index) {
   return items.slice(0, index).concat(items.slice(index + 1));
diff --git a/node_modules/@lens-protocol/shared-kernel/dist/lens-protocol-shared-kernel.esm.js b/node_modules/@lens-protocol/shared-kernel/dist/lens-protocol-shared-kernel.esm.js
index 17a759a..87dfc26 100644
--- a/node_modules/@lens-protocol/shared-kernel/dist/lens-protocol-shared-kernel.esm.js
+++ b/node_modules/@lens-protocol/shared-kernel/dist/lens-protocol-shared-kernel.esm.js
@@ -16,8 +16,11 @@ function assertNonEmptyArray(items) {
 function hasJustOne(items) {
   return items.length === 1;
 }
+function hasTwoOrLess(items) {
+  return items.length <= 2;
+}
 function assertJustOne(items) {
-  invariant(hasJustOne(items), 'Expected array of to have exactly one item.');
+  invariant(hasTwoOrLess(items), 'Expected array of to have exactly one item.');
 }
 function removeAtIndex(items, index) {
   return items.slice(0, index).concat(items.slice(index + 1));

This issue body was partially generated by patch-package.

jingledongding commented 1 year ago

{ "typename": "Comment", "commentOn": { "typename": "Post", "id": "0x01a152-0x01b7", "stats": { "typename": "PublicationStats", "totalAmountOfMirrors": 0, "totalUpvotes": 10, "totalDownvotes": 0, "totalAmountOfCollects": 0, "totalAmountOfComments": 2, "commentsCount": 2 }, "metadata": { "typename": "MetadataOutput", "animatedUrl": null, "content": "This publication is gated", "contentWarning": null, "description": "Gated Publication", "image": "ipfs://QmZq4ozZ4ZAoPuPnujgyhQmpmsQTJnBS36KfijUCqmnhQa", "locale": "en-nl", "mainContentFocus": "IMAGE", "name": "Gated Publication", "media": [ { "typename": "MediaSet", "original": { "typename": "Media", "altTag": "This publication is gated", "cover": "ipfs://QmZq4ozZ4ZAoPuPnujgyhQmpmsQTJnBS36KfijUCqmnhQa", "mimeType": "image/jpeg", "url": "ipfs://QmZq4ozZ4ZAoPuPnujgyhQmpmsQTJnBS36KfijUCqmnhQa" } } ], "attributes": [ { "typename": "MetadataAttributeOutput", "traitType": "handle", "value": "@nicnode" }, { "typename": "MetadataAttributeOutput", "traitType": "app", "value": "orb" } ], "encryptionParams": { "typename": "EncryptionParamsOutput", "accessCondition": { "typename": "AccessConditionOutput", "or": { "typename": "OrConditionOutput", "criteria": [ { "typename": "AccessConditionOutput", "or": null, "and": null, "nft": null, "token": null, "eoa": null, "profile": { "typename": "ProfileOwnershipOutput", "profileId": "0x01a649" }, "follow": null, "collect": null }, { "typename": "AccessConditionOutput", "or": { "typename": "OrConditionOutput", "criteria": [ { "typename": "AccessConditionOutput", "nft": { "typename": "NftOwnershipOutput", "contractAddress": "0x0e18914F98bb27Cba8334a6833f595090Cc98631", "chainID": 137, "contractType": "ERC721", "tokenIds": [] }, "token": null, "eoa": null, "profile": null, "follow": null, "collect": null }, { "typename": "AccessConditionOutput", "nft": null, "token": null, "eoa": null, "profile": { "typename": "ProfileOwnershipOutput", "profileId": "0x01a152" }, "follow": null, "collect": null } ] }, "and": null, "nft": null, "token": null, "eoa": null, "profile": null, "follow": null, "collect": null } ] } }, "encryptionProvider": "LIT_PROTOCOL", "encryptedFields": { "__typename": "EncryptedFieldsOutput", "animation_url": null, "content": "9RH5lu86OfoG96rSZonc0jpMi1fDw8XQW8vbOvOMXzU=", "external_url": "22nxQ0-K4yAq0XsTmRsaLAiHdgzyvBP4Pch4c_67bYH6mYXQlXEVKaZkYBQFBM2B", "image": "c3BACf-635GC8G4q5SVaWYSbfVAzAKAFi492LQR3rV8PFFkreaDLld2DY9SaTcqm8epG8-br5mxu9NPZkERxrmRLuArwtyEgOZxndeghG5g=", "media": [ { "typename": "EncryptedMediaSet", "original": { "typename": "EncryptedMedia", "altTag": null, "cover": null, "mimeType": null, "url": "pmHGFv20PvMgnyb75uKJ6UQaAwstgbaz6u9Iziij8IR4f4DoelvxGNAdSACpyw6JSNqmk7wzvWH0IQNHYvhJ1tConmnqiAGxkclicT46a40=" } } ] }, "providerSpecificParams": { "typename": "ProviderSpecificParamsOutput", "encryptionKey": "5d1ba160642361fd3e9232904503315ef905c5340be78b2d3e207351fb96ead7a40950e7f30a51975288570b7e531f08cb403d8c3ae40df9a1291915ffc84af7ac84a562989183c9c1e438e7edfb814dea0192860d06fe16ac6c069bfd76c9b91d7cb348331cd829421727b982e662d03a33d447fc97e120694c1c5d034eda5d00000000000000201663c3d1eba4433757c47e2680b9bc576cde6646d5bfcafc84ac3b4a448b8ec7ae3640314a49182d8c8232a0719bfb91" } }, "tags": [ "gatedorbcommunitiesethcc" ] }, "profile": { "typename": "Profile", "id": "0x01a152", "name": "Nico Gallardo", "bio": "founding intern @ TroopLabs.lol 🫡 + core @ethkipu, w3blab.io, Ethereum Bolivia", "handle": "nicnode.lens", "ownedBy": "0x84e1056eD1B76fB03b43e924EF98833dBA394b2B", "interests": [], "picture": { "typename": "NftImage", "contractAddress": "0x27cC171B16FdD2224E1f93eD7DccFcc6790cA4BF", "tokenId": "2230", "uri": "https://statics-polygon-lens.s3.eu-west-1.amazonaws.com/profile/nft-0x84e1056eD1B76fB03b43e924EF98833dBA394b2B_eth_0x27cC171B16FdD2224E1f93eD7DccFcc6790cA4BF_2230.png", "verified": true }, "coverPicture": { "typename": "MediaSet", "original": { "typename": "Media", "altTag": null, "cover": null, "mimeType": null, "url": "ipfs://bafkreidow5fuo3y2lkdtrzflkc253syrbfohl2nlisjr6ujnvf7balzuma" } }, "stats": { "typename": "ProfileStats", "totalCollects": 119, "totalComments": 295, "totalFollowers": 547, "totalFollowing": 446, "totalMirrors": 109, "totalPosts": 92, "totalPublications": 496, "commentsCount": 0, "postsCount": 0, "mirrorsCount": 0 }, "followModule": null, "followPolicy": { "type": "ANYONE" }, "attributes": [ { "typename": "Attribute", "displayType": null, "key": "website", "value": "https://beacons.ai/nicnode" }, { "typename": "Attribute", "displayType": null, "key": "twitter", "value": "nicnode" }, { "typename": "Attribute", "displayType": null, "key": "statusEmoji", "value": "😶\u200d🌫️" }, { "typename": "Attribute", "displayType": null, "key": "statusMessage", "value": "Troop Labs 🫡" }, { "typename": "Attribute", "displayType": null, "key": "app", "value": "Lenster" } ], "attributes": { "website": { "attribute": { "typename": "Attribute", "displayType": null, "key": "website", "value": "https://beacons.ai/nicnode" } }, "twitter": { "attribute": { "typename": "Attribute", "displayType": null, "key": "twitter", "value": "nicnode" } }, "statusEmoji": { "attribute": { "typename": "Attribute", "displayType": null, "key": "statusEmoji", "value": "😶\u200d🌫️" } }, "statusMessage": { "attribute": { "typename": "Attribute", "displayType": null, "key": "statusMessage", "value": "Troop Labs 🫡" } }, "app": { "attribute": { "typename": "Attribute", "displayType": null, "key": "app", "value": "Lenster" } } }, "dispatcher": { "typename": "Dispatcher", "address": "0x25418Bcf53dAe1167cD5d0cad34Eec31C0C37E41", "canUseRelay": true }, "onChainIdentity": { "typename": "OnChainIdentity", "proofOfHumanity": false, "ens": { "typename": "EnsOnChainIdentity", "name": "nicnode.eth" }, "sybilDotOrg": { "typename": "SybilDotOrgIdentity", "verified": false, "source": { "typename": "SybilDotOrgIdentitySource", "twitter": { "typename": "SybilDotOrgTwitterIdentity", "handle": null } } }, "worldcoin": { "typename": "WorldcoinIdentity", "isHuman": false } }, "isFollowedByMe": false, "isFollowingObserver": false, "followStatus": null, "ownedByMe": false }, "collectedBy": null, "collectModule": { "typename": "RevertCollectModuleSettings", "contractAddress": "0xa31FF85E840ED117E172BC9Ad89E55128A999205" }, "collectNftAddress": null, "referenceModule": null, "createdAt": "2023-07-18T12:22:06.000Z", "hidden": false, "isGated": true, "reaction": null, "hasCollectedByMe": false, "canComment": { "typename": "CanCommentResponse", "result": false }, "canMirror": { "typename": "CanMirrorResponse", "result": false }, "mirrors": [], "canObserverDecrypt": { "typename": "CanDecryptResponse", "result": false, "reasons": [ "DOES_NOT_OWN_PROFILE" ] }, "hasOptimisticCollectedByMe": false, "isOptimisticMirroredByMe": false, "isMirroredByMe": false, "collectPolicy": { "type": "NO_COLLECT", "state": "CANNOT_BE_COLLECTED" }, "referencePolicy": { "type": "ANYONE" }, "decryptionCriteria": { "type": "profile-ownership", "profileId": "0x01a649" }, "contentInsight": { "type": "UNDETERMINED" } }, "mainPost": { "typename": "Post", "id": "0x01a152-0x01b7", "stats": { "typename": "PublicationStats", "totalAmountOfMirrors": 0, "totalUpvotes": 10, "totalDownvotes": 0, "totalAmountOfCollects": 0, "totalAmountOfComments": 2, "commentsCount": 2 }, "metadata": { "typename": "MetadataOutput", "animatedUrl": null, "content": "This publication is gated", "contentWarning": null, "description": "Gated Publication", "image": "ipfs://QmZq4ozZ4ZAoPuPnujgyhQmpmsQTJnBS36KfijUCqmnhQa", "locale": "en-nl", "mainContentFocus": "IMAGE", "name": "Gated Publication", "media": [ { "typename": "MediaSet", "original": { "typename": "Media", "altTag": "This publication is gated", "cover": "ipfs://QmZq4ozZ4ZAoPuPnujgyhQmpmsQTJnBS36KfijUCqmnhQa", "mimeType": "image/jpeg", "url": "ipfs://QmZq4ozZ4ZAoPuPnujgyhQmpmsQTJnBS36KfijUCqmnhQa" } } ], "attributes": [ { "typename": "MetadataAttributeOutput", "traitType": "handle", "value": "@nicnode" }, { "typename": "MetadataAttributeOutput", "traitType": "app", "value": "orb" } ], "encryptionParams": { "typename": "EncryptionParamsOutput", "accessCondition": { "typename": "AccessConditionOutput", "or": { "typename": "OrConditionOutput", "criteria": [ { "typename": "AccessConditionOutput", "or": null, "and": null, "nft": null, "token": null, "eoa": null, "profile": { "typename": "ProfileOwnershipOutput", "profileId": "0x01a649" }, "follow": null, "collect": null }, { "typename": "AccessConditionOutput", "or": { "typename": "OrConditionOutput", "criteria": [ { "typename": "AccessConditionOutput", "nft": { "typename": "NftOwnershipOutput", "contractAddress": "0x0e18914F98bb27Cba8334a6833f595090Cc98631", "chainID": 137, "contractType": "ERC721", "tokenIds": [] }, "token": null, "eoa": null, "profile": null, "follow": null, "collect": null }, { "typename": "AccessConditionOutput", "nft": null, "token": null, "eoa": null, "profile": { "typename": "ProfileOwnershipOutput", "profileId": "0x01a152" }, "follow": null, "collect": null } ] }, "and": null, "nft": null, "token": null, "eoa": null, "profile": null, "follow": null, "collect": null } ] } }, "encryptionProvider": "LIT_PROTOCOL", "encryptedFields": { "__typename": "EncryptedFieldsOutput", "animation_url": null, "content": "9RH5lu86OfoG96rSZonc0jpMi1fDw8XQW8vbOvOMXzU=", "external_url": "22nxQ0-K4yAq0XsTmRsaLAiHdgzyvBP4Pch4c_67bYH6mYXQlXEVKaZkYBQFBM2B", "image": "c3BACf-635GC8G4q5SVaWYSbfVAzAKAFi492LQR3rV8PFFkreaDLld2DY9SaTcqm8epG8-br5mxu9NPZkERxrmRLuArwtyEgOZxndeghG5g=", "media": [ { "typename": "EncryptedMediaSet", "original": { "typename": "EncryptedMedia", "altTag": null, "cover": null, "mimeType": null, "url": "pmHGFv20PvMgnyb75uKJ6UQaAwstgbaz6u9Iziij8IR4f4DoelvxGNAdSACpyw6JSNqmk7wzvWH0IQNHYvhJ1tConmnqiAGxkclicT46a40=" } } ] }, "providerSpecificParams": { "typename": "ProviderSpecificParamsOutput", "encryptionKey": "5d1ba160642361fd3e9232904503315ef905c5340be78b2d3e207351fb96ead7a40950e7f30a51975288570b7e531f08cb403d8c3ae40df9a1291915ffc84af7ac84a562989183c9c1e438e7edfb814dea0192860d06fe16ac6c069bfd76c9b91d7cb348331cd829421727b982e662d03a33d447fc97e120694c1c5d034eda5d00000000000000201663c3d1eba4433757c47e2680b9bc576cde6646d5bfcafc84ac3b4a448b8ec7ae3640314a49182d8c8232a0719bfb91" } }, "tags": [ "gatedorbcommunitiesethcc" ] }, "profile": { "typename": "Profile", "id": "0x01a152", "name": "Nico Gallardo", "bio": "founding intern @ TroopLabs.lol 🫡 + core @ethkipu, w3blab.io, Ethereum Bolivia", "handle": "nicnode.lens", "ownedBy": "0x84e1056eD1B76fB03b43e924EF98833dBA394b2B", "interests": [], "picture": { "typename": "NftImage", "contractAddress": "0x27cC171B16FdD2224E1f93eD7DccFcc6790cA4BF", "tokenId": "2230", "uri": "https://statics-polygon-lens.s3.eu-west-1.amazonaws.com/profile/nft-0x84e1056eD1B76fB03b43e924EF98833dBA394b2B_eth_0x27cC171B16FdD2224E1f93eD7DccFcc6790cA4BF_2230.png", "verified": true }, "coverPicture": { "typename": "MediaSet", "original": { "typename": "Media", "altTag": null, "cover": null, "mimeType": null, "url": "ipfs://bafkreidow5fuo3y2lkdtrzflkc253syrbfohl2nlisjr6ujnvf7balzuma" } }, "stats": { "typename": "ProfileStats", "totalCollects": 119, "totalComments": 295, "totalFollowers": 547, "totalFollowing": 446, "totalMirrors": 109, "totalPosts": 92, "totalPublications": 496, "commentsCount": 0, "postsCount": 0, "mirrorsCount": 0 }, "followModule": null, "followPolicy": { "type": "ANYONE" }, "attributes": [ { "typename": "Attribute", "displayType": null, "key": "website", "value": "https://beacons.ai/nicnode" }, { "typename": "Attribute", "displayType": null, "key": "twitter", "value": "nicnode" }, { "typename": "Attribute", "displayType": null, "key": "statusEmoji", "value": "😶\u200d🌫️" }, { "typename": "Attribute", "displayType": null, "key": "statusMessage", "value": "Troop Labs 🫡" }, { "typename": "Attribute", "displayType": null, "key": "app", "value": "Lenster" } ], "attributes": { "website": { "attribute": { "typename": "Attribute", "displayType": null, "key": "website", "value": "https://beacons.ai/nicnode" } }, "twitter": { "attribute": { "typename": "Attribute", "displayType": null, "key": "twitter", "value": "nicnode" } }, "statusEmoji": { "attribute": { "typename": "Attribute", "displayType": null, "key": "statusEmoji", "value": "😶\u200d🌫️" } }, "statusMessage": { "attribute": { "typename": "Attribute", "displayType": null, "key": "statusMessage", "value": "Troop Labs 🫡" } }, "app": { "attribute": { "typename": "Attribute", "displayType": null, "key": "app", "value": "Lenster" } } }, "dispatcher": { "typename": "Dispatcher", "address": "0x25418Bcf53dAe1167cD5d0cad34Eec31C0C37E41", "canUseRelay": true }, "onChainIdentity": { "typename": "OnChainIdentity", "proofOfHumanity": false, "ens": { "typename": "EnsOnChainIdentity", "name": "nicnode.eth" }, "sybilDotOrg": { "typename": "SybilDotOrgIdentity", "verified": false, "source": { "typename": "SybilDotOrgIdentitySource", "twitter": { "typename": "SybilDotOrgTwitterIdentity", "handle": null } } }, "worldcoin": { "typename": "WorldcoinIdentity", "isHuman": false } }, "isFollowedByMe": false, "isFollowingObserver": false, "followStatus": null, "ownedByMe": false }, "collectedBy": null, "collectModule": { "typename": "RevertCollectModuleSettings", "contractAddress": "0xa31FF85E840ED117E172BC9Ad89E55128A999205" }, "collectNftAddress": null, "referenceModule": null, "createdAt": "2023-07-18T12:22:06.000Z", "hidden": false, "isGated": true, "reaction": null, "hasCollectedByMe": false, "canComment": { "typename": "CanCommentResponse", "result": false }, "canMirror": { "typename": "CanMirrorResponse", "result": false }, "mirrors": [], "canObserverDecrypt": { "typename": "CanDecryptResponse", "result": false, "reasons": [ "DOES_NOT_OWN_PROFILE" ] }, "hasOptimisticCollectedByMe": false, "isOptimisticMirroredByMe": false, "isMirroredByMe": false, "collectPolicy": { "type": "NO_COLLECT", "state": "CANNOT_BE_COLLECTED" }, "referencePolicy": { "type": "ANYONE" }, "decryptionCriteria": { "type": "profile-ownership", "profileId": "0x01a649" }, "contentInsight": { "type": "UNDETERMINED" } }, "firstComment": null, "id": "0x5881-0x06bd", "stats": { "typename": "PublicationStats", "totalAmountOfMirrors": 0, "totalUpvotes": 0, "totalDownvotes": 0, "totalAmountOfCollects": 0, "totalAmountOfComments": 0, "commentsCount": 0 }, "metadata": { "__typename": "MetadataOutput", "animatedUrl": null, "content": "gm Nico", "contentWarning": null, "description": "gm Nico", "image": null, "locale": "en-us", "mainContentFocus": "TEXT_ONLY", "name": "gm Nico", "media": [], "attributes": [ { "typename": "MetadataAttributeOutput", "traitType": "handle", "value": "@nilesh" }, { "typename": "MetadataAttributeOutput", "traitType": "app", "value": "orb" } ], "encryptionParams": null, "tags": [] }, "profile": { "typename": "Profile", "id": "0x5881", "name": "Nilesh", "bio": "cofounder and ceo @orbapp.lens", "handle": "nilesh.lens", "ownedBy": "0xdA86780f3902EbE7A92204D939CF1e03009ecf18", "interests": [], "picture": { "typename": "MediaSet", "original": { "typename": "Media", "altTag": null, "cover": null, "mimeType": null, "url": "https://ik.imagekit.io/lens/media-snapshot/041f4a7d8e46e9f9fb82865c9ae42af896e60675685b02b87f04dbcce2375b52.jpg" } }, "coverPicture": { "typename": "MediaSet", "original": { "typename": "Media", "altTag": null, "cover": null, "mimeType": null, "url": "https://ik.imagekit.io/lens/media-snapshot/97f0b322465d4616500741e8038c91242647dc3d9278ae1f39b3aa7c46b18d62.jpg" } }, "stats": { "typename": "ProfileStats", "totalCollects": 8334, "totalComments": 1203, "totalFollowers": 9847, "totalFollowing": 657, "totalMirrors": 635, "totalPosts": 278, "totalPublications": 2116, "commentsCount": 0, "postsCount": 0, "mirrorsCount": 0 }, "followModule": null, "followPolicy": { "type": "ANYONE" }, "attributes": [ { "typename": "Attribute", "displayType": null, "key": "", "value": "San Francisco, CA" }, { "typename": "Attribute", "displayType": null, "key": "", "value": "https://orb.ac" }, { "typename": "Attribute", "displayType": null, "key": "", "value": "nileshrthr" }, { "typename": "Attribute", "displayType": null, "key": "", "value": "Orb" }, { "typename": "Attribute", "displayType": null, "key": "", "value": "[]" }, { "typename": "Attribute", "displayType": null, "key": "", "value": "[]" }, { "typename": "Attribute", "displayType": null, "key": "", "value": "[]" }, { "typename": "Attribute", "displayType": null, "key": "", "value": "[]" }, { "typename": "Attribute", "displayType": null, "key": "", "value": "0x5881-0x032e" }, { "typename": "Attribute", "displayType": "string", "key": "", "value": "orb" }, { "typename": "Attribute", "displayType": "json", "key": "", "value": "[]" }, { "typename": "Attribute", "displayType": "json", "key": "", "value": "[]" }, { "typename": "Attribute", "displayType": "json", "key": "", "value": "[]" }, { "typename": "Attribute", "displayType": "json", "key": "", "value": "[]" }, { "typename": "Attribute", "displayType": "string", "key": "", "value": "nileshrthr" } ], "attributes": { "": { "attribute": { "typename": "Attribute", "displayType": "string", "key": "", "value": "nileshrthr" } } }, "dispatcher": { "typename": "Dispatcher", "address": "0xca674628a04dA98D12147EF8bE7c3663bc0820Ff", "canUseRelay": true }, "onChainIdentity": { "typename": "OnChainIdentity", "proofOfHumanity": false, "ens": { "typename": "EnsOnChainIdentity", "name": "nileshr.eth" }, "sybilDotOrg": { "typename": "SybilDotOrgIdentity", "verified": false, "source": { "typename": "SybilDotOrgIdentitySource", "twitter": { "typename": "SybilDotOrgTwitterIdentity", "handle": null } } }, "worldcoin": { "typename": "WorldcoinIdentity", "isHuman": false } }, "isFollowedByMe": false, "isFollowingObserver": false, "followStatus": null, "ownedByMe": false }, "collectedBy": null, "collectModule": { "typename": "RevertCollectModuleSettings", "contractAddress": "0xa31FF85E840ED117E172BC9Ad89E55128A999205" }, "collectNftAddress": null, "referenceModule": null, "createdAt": "2023-07-18T14:22:10.000Z", "hidden": false, "isGated": false, "reaction": null, "hasCollectedByMe": false, "canComment": { "typename": "CanCommentResponse", "result": false }, "canMirror": { "typename": "CanMirrorResponse", "result": false }, "canObserverDecrypt": { "typename": "CanDecryptResponse", "result": false, "reasons": [ "MISSING_ENCRYPTION_PARAMS" ] }, "mirrors": [], "hasOptimisticCollectedByMe": false, "isOptimisticMirroredByMe": false, "isMirroredByMe": false, "collectPolicy": { "type": "NO_COLLECT", "state": "CANNOT_BE_COLLECTED" }, "referencePolicy": { "type": "ANYONE" }, "decryptionCriteria": null, "contentInsight": { "type": "UNDETERMINED" } }

jingledongding commented 1 year ago

image The judgment assumes there is only one item, but in reality, it could be null or two items.

cesarenaldi commented 1 year ago

Thank you @jingledongding for these details. I spotted the issue, it's a mistake in evaluating top-level criteria. Close to what you were hinting at.

Going to work on a fix for this soon.

cesarenaldi commented 1 year ago

An update... this seems a token-gate configuration on a specific publication that seems odd (the author profile id and the gated access condition that allows them to decrypt their own publication have a profile id mismatch)...

image

I am trying to assess if this is a legitimate use case and we should relax SDK invariants checks or if this should have been captured earlier in the API

cesarenaldi commented 1 year ago

@jingledongding a fix for this is now available in @1.2.2 and @next versions.

Please let me know so we can close this issue.

jingledongding commented 1 year ago

Thank you for everything you've done. I will try it soon

cesarenaldi commented 1 year ago

@jingledongding happy for me to close this issue?

jingledongding commented 1 year ago

I haven't encountered this issue again in version 1.22.

cesarenaldi commented 1 year ago

Great!