PageSourceSearch

https://lens-protocol-docs.vercel.app/docs/_next/static/chunks/pages/protocol/groups/join-188502ad67678031.js

js lens-protocol-docs.vercel.app collected 2026-10-03 07:16:36 UTC 12,651 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2467],{16181:function(e,n,i){"use strict";i.r(n),i.d(n,{meta:function(){return a}});var o=i(11527),s=i(58627),r=i(89895),a=(i(17063),{showBreadcrumbs:!1,showTableOfContents:!0,showPrev:!0,showNext:!0}),l=function(e){var n=e.children;return(0,o.jsx)(r.Z,{meta:a,children:n})};function t(e){var n=Object.assign({h1:"h1",p:"p",hr:"hr",h2:"h2",a:"a",h3:"h3",code:"code",pre:"pre",ul:"ul",li:"li",em:"em"},(0,s.a)(),e.components),i=n.Alert,r=n.Steps,a=n.Tabs,l=n.TabItem,t=n.MultiCodeBlock;return i||c("Alert",!0),t||c("MultiCodeBlock",!0),r||c("Steps",!0),l||c("TabItem",!0),a||c("Tabs",!0),(0,o.jsxs)(o.Fragment,{children:["\n",(0,o.jsx)(n.h1,{children:"Join Groups"}),"\n",(0,o.jsx)(n.p,{children:"This guide will help you manage Group membership on Lens."}),"\n",(0,o.jsx)(n.hr,{}),"\n",(0,o.jsx)(n.h2,{children:"Join a Group"}),"\n",(0,o.jsx)(n.p,{children:"To join a Group, follow these steps."}),"\n",(0,o.jsx)(i,{tone:"info",children:(0,o.jsxs)(n.p,{children:["You MUST be authenticated as ",(0,o.jsx)(n.a,{href:"../authentication",children:"Account Owner or Account Manager"})," to join a Group."]})}),"\n",(0,o.jsxs)(r,{children:[(0,o.jsx)(n.h3,{children:"Check Group Rules"}),(0,o.jsxs)(n.p,{children:["First, inspect the ",(0,o.jsx)(n.code,{children:"group.operations.canJoin"})," field to determine whether the logged-in Account is allowed to join. Some Groups may have restrictions on who can join them."]}),(0,o.jsx)(n.pre,{filename:"Check Rules",children:(0,o.jsx)(n.code,{className:"language-ts",children:'switch (group.operations.canJoin.__typename) {\n  case "GroupOperationValidationPassed":\n    // Joining the group is allowed\n    break;\n\n  case "GroupOperationValidationFailed":\n    // Joinin the group is not allowed\n    console.log(group.operations.canJoin.reason);\n    break;\n\n  case "GroupOperationValidationUnknown":\n    // Validation outcome is unknown\n    break;\n}\n'})}),(0,o.jsx)(n.p,{children:"Where:"}),(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"GroupOperationValidationPassed"}),": The logged-in Account can join the Group."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"GroupOperationValidationFailed"}),": Joining the Group is not allowed. The ",(0,o.jsx)(n.code,{children:"reason"})," field explains why, and ",(0,o.jsx)(n.code,{children:"unsatisfiedRules"})," lists the unmet requirements."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"GroupOperationValidationUnknown"}),": The Group has one or more ",(0,o.jsx)(n.em,{children:"unknown rules"})," requiring ad-hoc verification. The ",(0,o.jsx)(n.code,{children:"extraChecksRequired"})," field provides the addresses and configurations of these rules."]}),"\n"]}),(0,o.jsx)(i,{tone:"info",children:(0,o.jsxs)(n.p,{children:["Treat the ",(0,o.jsx)(n.code,{children:"GroupOperationValidationUnknown"})," as ",(0,o.jsx)(n.em,{children:"failed"})," unless you intend to\nsupport the specific rules. See ",(0,o.jsx)(n.a,{href:"./rules",children:"Group Rules"})," for more information."]})}),(0,o.jsx)(n.h3,{children:"Join the Group"}),(0,o.jsx)(n.p,{children:"Next, if allowed, join the Group."}),(0,o.jsxs)(a,{children:[(0,o.jsxs)(l,{value:"ts",label:"TypeScript",default:!0,children:[(0,o.jsxs)(n.p,{children:["Use the ",(0,o.jsx)(n.code,{children:"joinGroup"})," action to join a Group with the logged-in account."]}),(0,o.jsx)(i,{tone:"info",children:(0,o.jsxs)(n.p,{children:["You MUST be authenticated as ",(0,o.jsx)(n.a,{href:"../authentication",children:"Account Owner or Account Manager"})," to make this\nrequest."]})}),(0,o.jsx)(n.pre,{filename:"Example",children:(0,o.jsx)(n.code,{className:"language-ts",children:'import { evmAddress } from "@lens-protocol/client";\nimport { joinGroup } from "@lens-protocol/client/actions";\n\nconst result = await joinGroup(sessionClient, { group: evmAddress("0x1234") });\n'})})]}),(0,o.jsxs)(l,{value:"api",label:"GraphQL",children:[(0,o.jsxs)(n.p,{children:["Use the ",(0,o.jsx)(n.code,{children:"joinGroup"})," mutation to join a Group with the logged-in account."]}),(0,o.jsxs)(t,{children:[(0,o.jsx)(n.pre,{filename:"Mutation",children:(0,o.jsx)(n.code,{className:"language-graphql",children:'mutation {\n  joinGroup(request: { group: "0x1234\u2026" }) {\n    ... on JoinGroupResponse {\n      hash\n    }\n    ... on SponsoredTransactionRequest {\n      ...SponsoredTransactionRequest\n    }\n    ... on SelfFundedTransactionRequest {\n      ...SelfFundedTransactionRequest\n    }\n    ... on GroupOperationValidationFailed {\n      reason\n    }\n    ... on TransactionWillFail {\n      reason\n    }\n  }\n}\n'})}),(0,o.jsx)(n.pre,{filename:"JoinGroupResponse",children:(0,o.jsx)(n.code,{className:"language-json",children:'{\n  "data": {\n    "joinGroup": {\n      "hash": "0x\u2026"\n    }\n  }\n}\n'})})]})]}),(0,o.jsx)(l,{value:"react",label:"React",children:(0,o.jsx)(n.p,{children:"Coming soon"})})]}),(0,o.jsx)(n.h3,{children:"Handle Result"}),(0,o.jsxs)(a,{children:[(0,o.jsxs)(l,{value:"ts",label:"TypeScript",default:!0,children:[(0,o.jsx)(n.p,{children:"Finally, handle the result using the adapter for the library of your choice:"}),(0,o.jsxs)(t,{children:[(0,o.jsx)(n.pre,{filename:"viem",highlight:"1,7",children:(0,o.jsx)(n.code,{className:"language-ts",children:'import { handleOperationWith } from "@lens-protocol/client/viem";\n\n// \u2026\n\nconst result = await joinGroup(sessionClient, {\n  group: evmAddress("0x1234"),\n}).andThen(handleOperationWith(walletClient));\n'})}),(0,o.jsx)(n.pre,{filename:"ethers",highlight:"1,7",children:(0,o.jsx)(n.code,{className:"language-ts",children:'import { handleOperationWith } from "@lens-protocol/client/ethers";\n\n// \u2026\n\nconst result = await joinGroup(sessionClient, {\n  group: evmAddress("0x1234"),\n}).andThen(handleOperationWith(signer));\n'})})]}),(0,o.jsxs)(n.p,{children:["See the ",(0,o.jsx)(n.a,{href:"../best-practices/transaction-lifecycle",children:"Transaction Lifecycle"})," guide for more information on how to determine the status of the transaction."]})]}),(0,o.jsx)(l,{value:"api",label:"GraphQL",children:(0,o.jsxs)(n.p,{children:["Finally, handle the result as explained in the ",(0,o.jsx)(n.a,{href:"../best-practices/transaction-lifecycle",children:"Transaction Lifecycle"})," guide."]})}),(0,o.jsx)(l,{value:"react",label:"React",children:(0,o.jsx)(n.p,{children:"Coming soon"})})]})]}),"\n",(0,o.jsx)(n.h2,{children:"Leave a Group"}),"\n",(0,o.jsx)(n.p,{children:"To leave a Group, follow these steps."}),"\n",(0,o.jsx)(i,{tone:"info",children:(0,o.jsxs)(n.p,{children:["You MUST be authenticated as ",(0,o.jsx)(n.a,{href:"../authentication",children:"Account Owner or Account Manager"})," to leave a\nGroup."]})}),"\n",(0,o.jsxs)(r,{children:[(0,o.jsx)(n.h3,{children:"Check Group Rules"}),(0,o.jsxs)(n.p,{children:["First, inspect the ",(0,o.jsx)(n.code,{children:"group.operations.canLeave"})," field to determine whether the logged-in Account is allowed to leave. Some Groups may have restrictions on who can leave them."]}),(0,o.jsx)(n.pre,{filename:"Check Rules",children:(0,o.jsx)(n.code,{className:"language-ts",children:'switch (group.operations.canLeave.__typename) {\n  case "GroupOperationValidationPassed":\n    // Leaving the group is allowed\n    break;\n\n  case "GroupOperationValidationFailed":\n    // Leaving the group is not allowed\n    console.log(group.operations.canLeave.reason);\n    break;\n\n  case "GroupOperationValidationUnknown":\n    // Validation outcome is unknown\n    break;\n}\n'})}),(0,o.jsx)(n.p,{children:"Where:"}),(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"GroupOperationValidationPassed"}),": The logged-in Account can leave the Group."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"GroupOperationValidationFailed"}),": Leaving the Group is not allowed. The ",(0,o.jsx)(n.code,{children:"reason"})," field explains why, and ",(0,o.jsx)(n.code,{children:"unsatisfiedRules"})," lists the unmet requirements."]}),"\n",(0,o.jsxs)(n.li,{children:[(0,o.jsx)(n.code,{children:"GroupOperationValidationUnknown"}),": The Group has one or more ",(0,o.jsx)(n.em,{children:"unknown rules"})," requiring ad-hoc verification. The ",(0,o.jsx)(n.code,{children:"extraChecksRequired"})," field provides the addresses and configurations of these rules."]}),"\n"]}),(0,o.jsx)(i,{tone:"info",children:(0,o.jsxs)(n.p,{children:["Treat the ",(0,o.jsx)(n.code,{children:"GroupOperationValidationUnknown"})," as ",(0,o.jsx)(n.em,{children:"failed"})," unless you intend to\nsupport the specific rules. See ",(0,o.jsx)(n.a,{href:"./rules",children:"Group Rules"})," for more information."]})}),(0,o.jsx)(n.h3,{children:"Leave a Group"}),(0,o.jsx)(n.p,{children:"Next, if allowed, leave the Group."}),(0,o.jsxs)(a,{children:[(0,o.jsxs)(l,{value:"ts",label:"TypeScript",default:!0,children:[(0,o.jsxs)(n.p,{children:["Use the ",(0,o.jsx)(n.code,{children:"leaveGroup"})," action to leave a Group with the logged-in account."]}),(0,o.jsx)(i,{tone:"info",children:(0,o.jsxs)(n.p,{children:["You MUST be authenticated as ",(0,o.jsx)(n.a,{href:"../authentication",children:"Account Owner or Account Manager"})," to make this\nrequest."]})}),(0,o.jsx)(n.pre,{filename:"Example",children:(0,o.jsx)(n.code,{className:"language-ts",children:'import { evmAddress } from "@lens-protocol/client";\nimport { leaveGroup } from "@lens-protocol/client/actions";\n\nconst result = await leaveGroup(sessionClient, { group: evmAddress("0x1234") });\n'})})]}),(0,o.jsxs)(l,{value:"api",label:"GraphQL",children:[(0,o.jsxs)(n.p,{children:["Use the ",(0,o.jsx)(n.code,{children:"leaveGroup"})," mutation to leave a Group with the logged-in account."]}),(0,o.jsxs)(t,{children:[(0,o.jsx)(n.pre,{filename:"Mutation",children:(0,o.jsx)(n.code,{className:"language-graphql",children:'mutation {\n  leaveGroup(request: { group: "0x1234\u2026" }) {\n    ... on LeaveGroupResponse {\n      hash\n    }\n    ... on SponsoredTransactionRequest {\n      ...SponsoredTransactionRequest\n    }\n    ... on SelfFundedTransactionRequest {\n      ...SelfFundedTransactionRequest\n    }\n    ... on GroupOperationValidationFailed {\n      reason\n    }\n    ... on TransactionWillFail {\n      reason\n    }\n  }\n}\n'})}),(0,o.jsx)(n.pre,{filename:"LeaveGroupResponse",children:(0,o.jsx)(n.code,{className:"language-json",children:'{\n  "data": {\n    "leaveGroup": {\n      "hash": "0x\u2026"\n    }\n  }\n}\n'})})]})]}),(0,o.jsx)(l,{value:"react",label:"React",children:(0,o.jsx)(n.p,{children:"Coming soon"})})]}),(0,o.jsx)(n.h3,{children:"Handle Result"}),(0,o.jsxs)(a,{children:[(0,o.jsxs)(l,{value:"ts",label:"TypeScript",default:!0,children:[(0,o.jsx)(n.p,{children:"Finally, handle the result using the adapter for the library of your choice:"}),(0,o.jsxs)(t,{children:[(0,o.jsx)(n.pre,{filename:"viem",highlight:"1,7",children:(0,o.jsx)(n.code,{className:"language-ts",children:'import { handleOperationWith } from "@lens-protocol/client/viem";\n\n// \u2026\n\nconst result = await leaveGroup(sessionClient, {\n  account: evmAddress("0x1234"),\n}).andThen(handleOperationWith(walletClient));\n'})}),(0,o.jsx)(n.pre,{filename:"ethers",highlight:"1,7",children:(0,o.jsx)(n.code,{className:"language-ts",children:'import { handleOperationWith } from "@lens-protocol/client/ethers";\n\n// \u2026\n\nconst result = await leaveGroup(sessionClient, {\n  account: evmAddress("0x1234"),\n}).andThen(handleOperationWith(signer));\n'})})]}),(0,o.jsxs)(n.p,{children:["See the ",(0,o.jsx)(n.a,{href:"../best-practices/transaction-lifecycle",children:"Transaction Lifecycle"})," guide for more information on how to determine the status of the transaction."]})]}),(0,o.jsx)(l,{value:"api",label:"GraphQL",children:(0,o.jsxs)(n.p,{children:["Finally, handle the result as explained in the ",(0,o.jsx)(n.a,{href:"../best-practices/transaction-lifecycle",children:"Transaction Lifecycle"})," guide."]})}),(0,o.jsx)(l,{value:"react",label:"React",children:(0,o.jsx)(n.p,{children:"Coming soon"})})]})]})]})}function c(e,n){throw new Error("Expected "+(n?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}n.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,o.jsx)(l,Object.assign({},e,{children:(0,o.jsx)(t,e)}))}},57553:function(e,n,i){(window.__NEXT_P=window.__NEXT_P||[]).push(["/protocol/groups/join",function(){return i(16181)}])}},function(e){e.O(0,[9774,3788,9895,2888,179],(function(){return n=57553,e(e.s=n);var n}));var n=e.O();_N_E=n}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.