Showing preview only (2,021K chars total). Download the full file or copy to clipboard to get everything.
Repository: lens-protocol/lens-sdk
Branch: main
Commit: 342abd5efb3b
Files: 423
Total size: 1.9 MB
Directory structure:
gitextract_d8sflke8/
├── .changeset/
│ ├── README.md
│ ├── config.json
│ ├── giant-buckets-melt.md
│ ├── nice-baboons-protect.md
│ └── pre.json
├── .editorconfig
├── .github/
│ ├── actions/
│ │ ├── setup/
│ │ │ └── action.yml
│ │ └── tests/
│ │ └── action.yml
│ └── workflows/
│ ├── dependency-review.yml
│ ├── pull-request.yml
│ ├── snapshot.yml
│ ├── trigger-tests.yml
│ └── verify.yml
├── .gitignore
├── .npmrc
├── .nvmrc
├── .prettierignore
├── .vscode/
│ └── settings.json
├── LICENSE
├── README.md
├── biome.json
├── examples/
│ ├── create-app/
│ │ ├── README.md
│ │ ├── index.html
│ │ ├── index.ts
│ │ ├── package.json
│ │ └── tsconfig.json
│ ├── custom-fragments/
│ │ ├── README.md
│ │ ├── index.html
│ │ ├── index.ts
│ │ ├── package.json
│ │ └── tsconfig.json
│ ├── nextjs-client/
│ │ ├── .gitignore
│ │ ├── .stackblitzrc
│ │ ├── README.md
│ │ ├── next.config.ts
│ │ ├── package.json
│ │ ├── src/
│ │ │ └── app/
│ │ │ ├── Web3Providers.tsx
│ │ │ ├── client.ts
│ │ │ ├── globals.css
│ │ │ ├── layout.tsx
│ │ │ └── page.tsx
│ │ └── tsconfig.json
│ ├── react-follow/
│ │ ├── README.md
│ │ ├── index.html
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── AccountToFollow.tsx
│ │ │ ├── App.tsx
│ │ │ ├── FollowButton.tsx
│ │ │ ├── Web3Providers.tsx
│ │ │ ├── client.ts
│ │ │ ├── config.ts
│ │ │ ├── main.tsx
│ │ │ ├── vite-env.d.ts
│ │ │ └── wallet.ts
│ │ ├── tsconfig.json
│ │ └── vite.config.ts
│ ├── react-login/
│ │ ├── README.md
│ │ ├── index.html
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── App.tsx
│ │ │ ├── LoginForm.tsx
│ │ │ ├── LogoutButton.tsx
│ │ │ ├── MyAccount.tsx
│ │ │ ├── Web3Providers.tsx
│ │ │ ├── client.ts
│ │ │ ├── config.ts
│ │ │ ├── main.tsx
│ │ │ └── vite-env.d.ts
│ │ ├── tsconfig.json
│ │ └── vite.config.ts
│ ├── react-post/
│ │ ├── README.md
│ │ ├── index.html
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── App.tsx
│ │ │ ├── client.ts
│ │ │ ├── config.ts
│ │ │ ├── main.tsx
│ │ │ ├── vite-env.d.ts
│ │ │ └── wallet.ts
│ │ ├── tsconfig.json
│ │ └── vite.config.ts
│ ├── react-post-action/
│ │ ├── README.md
│ │ ├── index.html
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── App.tsx
│ │ │ ├── client.ts
│ │ │ ├── config.ts
│ │ │ ├── main.tsx
│ │ │ ├── vite-env.d.ts
│ │ │ └── wallet.ts
│ │ ├── tsconfig.json
│ │ └── vite.config.ts
│ ├── sponsored-tx/
│ │ ├── .stackblitzrc
│ │ ├── README.md
│ │ ├── index.ts
│ │ ├── package.json
│ │ └── tsconfig.json
│ ├── sponsored-tx-poc/
│ │ ├── README.md
│ │ ├── index.html
│ │ ├── index.ts
│ │ ├── package.json
│ │ └── tsconfig.json
│ ├── thirdweb-onramp/
│ │ ├── README.md
│ │ ├── index.html
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── App.tsx
│ │ │ └── main.tsx
│ │ ├── tsconfig.json
│ │ └── vite.config.ts
│ └── user-onboarding/
│ ├── README.md
│ ├── index.html
│ ├── index.ts
│ ├── package.json
│ └── tsconfig.json
├── jest-extended.d.ts
├── package.json
├── packages/
│ ├── client/
│ │ ├── CHANGELOG.md
│ │ ├── README.md
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── AuthenticatedUser.ts
│ │ │ ├── actions/
│ │ │ │ ├── account.test.ts
│ │ │ │ ├── account.ts
│ │ │ │ ├── accountManager.test.ts
│ │ │ │ ├── accountManager.ts
│ │ │ │ ├── actions.ts
│ │ │ │ ├── admins.ts
│ │ │ │ ├── app.ts
│ │ │ │ ├── authentication.ts
│ │ │ │ ├── feed.ts
│ │ │ │ ├── follow.ts
│ │ │ │ ├── frames.ts
│ │ │ │ ├── funds.e2e.ts
│ │ │ │ ├── funds.ts
│ │ │ │ ├── graph.ts
│ │ │ │ ├── group.e2e.ts
│ │ │ │ ├── group.ts
│ │ │ │ ├── helpers.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── metadata.test.ts
│ │ │ │ ├── metadata.ts
│ │ │ │ ├── misc.ts
│ │ │ │ ├── ml.e2e.ts
│ │ │ │ ├── ml.ts
│ │ │ │ ├── namespace.ts
│ │ │ │ ├── notifications.test.ts
│ │ │ │ ├── notifications.ts
│ │ │ │ ├── onboarding.e2e.ts
│ │ │ │ ├── post.test.ts
│ │ │ │ ├── post.ts
│ │ │ │ ├── posts.test.ts
│ │ │ │ ├── posts.ts
│ │ │ │ ├── sns.ts
│ │ │ │ ├── sponsorship.ts
│ │ │ │ ├── timeline.ts
│ │ │ │ ├── tipping.e2e.ts
│ │ │ │ ├── transactions.ts
│ │ │ │ ├── transfer.ts
│ │ │ │ └── username.ts
│ │ │ ├── authorization.ts
│ │ │ ├── batch.ts
│ │ │ ├── cache.ts
│ │ │ ├── clients.test.ts
│ │ │ ├── clients.ts
│ │ │ ├── config.ts
│ │ │ ├── context.ts
│ │ │ ├── crossRegion.e2e.ts
│ │ │ ├── errors.ts
│ │ │ ├── ethers/
│ │ │ │ ├── __snapshots__/
│ │ │ │ │ └── encoding.test.ts.snap
│ │ │ │ ├── encoding.test.ts
│ │ │ │ ├── encoding.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── signer.test.ts
│ │ │ │ ├── signer.ts
│ │ │ │ ├── sponsorship.test.ts
│ │ │ │ └── sponsorship.ts
│ │ │ ├── fragments.test.ts
│ │ │ ├── fragments.ts
│ │ │ ├── index.ts
│ │ │ ├── logger.ts
│ │ │ ├── sponsorship.ts
│ │ │ ├── test-utils.ts
│ │ │ ├── tokens.ts
│ │ │ ├── types.ts
│ │ │ ├── utils.ts
│ │ │ └── viem/
│ │ │ ├── __snapshots__/
│ │ │ │ └── encoding.test.ts.snap
│ │ │ ├── authorization.test.ts
│ │ │ ├── authorization.ts
│ │ │ ├── encoding.test.ts
│ │ │ ├── encoding.ts
│ │ │ ├── index.ts
│ │ │ ├── signer.test.ts
│ │ │ ├── signer.ts
│ │ │ ├── sponsorship.test.ts
│ │ │ ├── sponsorship.ts
│ │ │ └── types.ts
│ │ ├── tsconfig.build.json
│ │ ├── tsconfig.json
│ │ └── tsup.config.ts
│ ├── env/
│ │ ├── CHANGELOG.md
│ │ ├── README.md
│ │ ├── package.json
│ │ ├── src/
│ │ │ └── index.ts
│ │ ├── tsconfig.build.json
│ │ ├── tsconfig.json
│ │ └── tsup.config.ts
│ ├── graphql/
│ │ ├── .gitignore
│ │ ├── CHANGELOG.md
│ │ ├── README.md
│ │ ├── package.json
│ │ ├── schema.d.ts
│ │ ├── schema.graphql
│ │ ├── scripts/
│ │ │ └── fetch-schema.ts
│ │ ├── src/
│ │ │ ├── accounts/
│ │ │ │ ├── account.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── managers.ts
│ │ │ │ └── signless.ts
│ │ │ ├── actions.ts
│ │ │ ├── admins.ts
│ │ │ ├── app.ts
│ │ │ ├── authentication.ts
│ │ │ ├── common.ts
│ │ │ ├── enums.ts
│ │ │ ├── feed.ts
│ │ │ ├── follow.ts
│ │ │ ├── fragments/
│ │ │ │ ├── account.ts
│ │ │ │ ├── common.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── media.ts
│ │ │ │ ├── metadata.ts
│ │ │ │ ├── pagination.ts
│ │ │ │ ├── post.ts
│ │ │ │ ├── primitives.ts
│ │ │ │ ├── transactions.ts
│ │ │ │ └── username.ts
│ │ │ ├── frames.ts
│ │ │ ├── funds.ts
│ │ │ ├── graph.ts
│ │ │ ├── graphql-env.d.ts
│ │ │ ├── graphql.ts
│ │ │ ├── group.ts
│ │ │ ├── index.ts
│ │ │ ├── metadata.ts
│ │ │ ├── misc.ts
│ │ │ ├── ml.ts
│ │ │ ├── namespace.ts
│ │ │ ├── notifications.ts
│ │ │ ├── post.ts
│ │ │ ├── refinements.ts
│ │ │ ├── scalars.ts
│ │ │ ├── schema.json
│ │ │ ├── schema.ts
│ │ │ ├── sns.ts
│ │ │ ├── sponsorship.ts
│ │ │ ├── test-utils.ts
│ │ │ ├── timeline.ts
│ │ │ ├── transactions.ts
│ │ │ ├── transferOwnership.ts
│ │ │ └── username.ts
│ │ ├── tsconfig.build.json
│ │ ├── tsconfig.json
│ │ └── tsup.config.ts
│ ├── react/
│ │ ├── CHANGELOG.md
│ │ ├── README.md
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── LensProvider.tsx
│ │ │ ├── account/
│ │ │ │ ├── index.ts
│ │ │ │ ├── useAccount.ts
│ │ │ │ ├── useAccountFeedsStats.ts
│ │ │ │ ├── useAccountManagers.ts
│ │ │ │ ├── useAccountStats.ts
│ │ │ │ ├── useAccounts.ts
│ │ │ │ ├── useAccountsBlocked.ts
│ │ │ │ ├── useAccountsBulk.ts
│ │ │ │ ├── useAddAccountManager.ts
│ │ │ │ ├── useBalancesBulk.ts
│ │ │ │ ├── useCreateAccountWithFreeUsername.ts
│ │ │ │ ├── useCreateAccountWithRestrictedUsername.ts
│ │ │ │ ├── useEnableSignless.ts
│ │ │ │ ├── useRemoveAccountManager.ts
│ │ │ │ ├── useRemoveSignless.ts
│ │ │ │ ├── useSetAccountMetadata.ts
│ │ │ │ └── useWhoExecutedActionOnAccount.ts
│ │ │ ├── app/
│ │ │ │ ├── index.ts
│ │ │ │ └── useAppUsers.ts
│ │ │ ├── authentication/
│ │ │ │ ├── index.ts
│ │ │ │ ├── useAccountsAvailable.ts
│ │ │ │ ├── useAuthenticatedUser.test.ts
│ │ │ │ ├── useAuthenticatedUser.ts
│ │ │ │ ├── useLogin.test.ts
│ │ │ │ ├── useLogin.ts
│ │ │ │ ├── useLogout.ts
│ │ │ │ ├── useMeDetails.ts
│ │ │ │ ├── usePublicClient.ts
│ │ │ │ ├── useSessionClient.test.ts
│ │ │ │ ├── useSessionClient.ts
│ │ │ │ └── useSwitchAccount.ts
│ │ │ ├── context.tsx
│ │ │ ├── ethers/
│ │ │ │ ├── index.ts
│ │ │ │ └── useUnknownPostActionEncoder.ts
│ │ │ ├── feed/
│ │ │ │ ├── index.ts
│ │ │ │ ├── useFeed.ts
│ │ │ │ └── useFeeds.ts
│ │ │ ├── follow/
│ │ │ │ ├── index.ts
│ │ │ │ ├── useFollow.ts
│ │ │ │ ├── useFollowStatus.ts
│ │ │ │ ├── useFollowers.ts
│ │ │ │ ├── useFollowersYouKnow.ts
│ │ │ │ ├── useFollowing.ts
│ │ │ │ └── useUnfollow.ts
│ │ │ ├── graph/
│ │ │ │ ├── index.ts
│ │ │ │ └── useGraph.ts
│ │ │ ├── group/
│ │ │ │ ├── index.ts
│ │ │ │ ├── useGroup.ts
│ │ │ │ ├── useGroupBannedAccounts.ts
│ │ │ │ ├── useGroupMembers.ts
│ │ │ │ ├── useGroupMembershipRequests.ts
│ │ │ │ └── useGroups.ts
│ │ │ ├── helpers/
│ │ │ │ ├── index.ts
│ │ │ │ ├── reads.ts
│ │ │ │ ├── results.ts
│ │ │ │ ├── tasks.test.ts
│ │ │ │ └── tasks.ts
│ │ │ ├── index.ts
│ │ │ ├── ml/
│ │ │ │ ├── index.ts
│ │ │ │ ├── useAccountRecommendations.ts
│ │ │ │ ├── useDismissRecommendedAccounts.ts
│ │ │ │ ├── usePostsForYou.ts
│ │ │ │ └── usePostsToExplore.ts
│ │ │ ├── notification/
│ │ │ │ ├── index.ts
│ │ │ │ └── useNotifications.ts
│ │ │ ├── post/
│ │ │ │ ├── index.ts
│ │ │ │ ├── useBookmarkPost.ts
│ │ │ │ ├── useCreatePost.test.ts
│ │ │ │ ├── useCreatePost.ts
│ │ │ │ ├── useExecutePostAction.ts
│ │ │ │ ├── usePost.ts
│ │ │ │ ├── usePostBookmarks.ts
│ │ │ │ ├── usePostReactions.ts
│ │ │ │ ├── usePostReferences.ts
│ │ │ │ ├── usePostTags.ts
│ │ │ │ ├── usePosts.ts
│ │ │ │ ├── useUndoBookmarkPost.ts
│ │ │ │ ├── useWhoExecutedActionOnPost.ts
│ │ │ │ └── useWhoReferencedPost.ts
│ │ │ ├── test-utils.tsx
│ │ │ ├── timeline/
│ │ │ │ ├── index.ts
│ │ │ │ ├── useTimeline.ts
│ │ │ │ └── useTimelineHighlights.ts
│ │ │ ├── tokenDistribution/
│ │ │ │ ├── index.ts
│ │ │ │ └── useTokenDistributions.ts
│ │ │ ├── username/
│ │ │ │ ├── index.ts
│ │ │ │ ├── useCanCreateUsername.ts
│ │ │ │ ├── useNamespace.ts
│ │ │ │ └── useUsernames.ts
│ │ │ └── viem/
│ │ │ ├── index.ts
│ │ │ └── useUnknownPostActionEncoder.ts
│ │ ├── tsconfig.build.json
│ │ ├── tsconfig.json
│ │ ├── tsup.config.ts
│ │ └── vitest.setup.ts
│ ├── storage/
│ │ ├── CHANGELOG.md
│ │ ├── README.md
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── BaseStorageSchema.ts
│ │ │ ├── CredentialsStorageSchema.ts
│ │ │ ├── IStorage.ts
│ │ │ ├── InMemoryStorageProvider.ts
│ │ │ ├── Storage.test.ts
│ │ │ ├── Storage.ts
│ │ │ ├── __helpers__/
│ │ │ │ └── mocks.ts
│ │ │ └── index.ts
│ │ ├── tsconfig.build.json
│ │ ├── tsconfig.json
│ │ └── tsup.config.ts
│ └── types/
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── package.json
│ ├── src/
│ │ ├── errors.ts
│ │ ├── helpers/
│ │ │ ├── Deferred.ts
│ │ │ ├── assertions.ts
│ │ │ ├── fail.ts
│ │ │ ├── identity.ts
│ │ │ ├── index.ts
│ │ │ ├── invariant.ts
│ │ │ ├── never.ts
│ │ │ ├── refinements.ts
│ │ │ └── typeguards.ts
│ │ ├── hex.ts
│ │ ├── id.ts
│ │ ├── index.ts
│ │ ├── jwt.ts
│ │ ├── misc.ts
│ │ ├── number.ts
│ │ ├── tag.ts
│ │ └── uri.ts
│ ├── tsconfig.build.json
│ ├── tsconfig.json
│ └── tsup.config.ts
├── plopfile.ts
├── pnpm-workspace.yaml
├── renovate.json
├── templates/
│ ├── example-react/
│ │ ├── README.md
│ │ ├── index.html
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── App.tsx
│ │ │ ├── client.ts
│ │ │ ├── main.tsx
│ │ │ └── vite-env.d.ts
│ │ ├── tsconfig.json
│ │ └── vite.config.ts
│ └── lib/
│ ├── README.md.hbs
│ ├── package.json.hbs
│ ├── src/
│ │ └── index.ts
│ ├── tsconfig.build.json
│ ├── tsconfig.json
│ └── tsup.config.ts
├── tsconfig.base.json
├── tsconfig.json
├── turbo.json
├── vite-env.d.ts
├── vitest.config.ts
├── vitest.d.ts
└── vitest.setup.ts
================================================
FILE CONTENTS
================================================
================================================
FILE: .changeset/README.md
================================================
# Changesets
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
================================================
FILE: .changeset/config.json
================================================
{
"$schema": "https://unpkg.com/@changesets/config@3.0.4/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [["@lens-protocol/client", "@lens-protocol/react"]],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
================================================
FILE: .changeset/giant-buckets-melt.md
================================================
---
"@lens-protocol/client": minor
"@lens-protocol/react": minor
---
**feat**: add post action encoder and execution hooks
================================================
FILE: .changeset/nice-baboons-protect.md
================================================
---
"@lens-protocol/client": major
"@lens-protocol/react": major
"@lens-protocol/storage": minor
"@lens-protocol/env": minor
"@lens-protocol/graphql": minor
"@lens-protocol/types": minor
---
**chore**: transition to new major release
================================================
FILE: .changeset/pre.json
================================================
{
"mode": "pre",
"tag": "alpha",
"initialVersions": {
"@lens-protocol/client": "2.3.2",
"@lens-protocol/env": "0.0.1",
"@lens-protocol/graphql": "0.0.1",
"@lens-protocol/react": "2.3.2",
"@lens-protocol/storage": "0.8.1",
"@lens-protocol/types": "0.0.1"
},
"changesets": [
"nice-baboons-protect"
]
}
================================================
FILE: .editorconfig
================================================
root = true
[*]
charset = utf-8
insert_final_newline = true
end_of_line = lf
indent_style = space
indent_size = 2
max_line_length = 100
================================================
FILE: .github/actions/setup/action.yml
================================================
name: 'Setup'
description: 'Setup repo and install dependencies'
runs:
using: 'composite'
steps:
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Install Dependencies
shell: bash
run: pnpm install --frozen-lockfile
================================================
FILE: .github/actions/tests/action.yml
================================================
name: 'Test Workflow'
description: 'Run tests against a specified environment'
inputs:
environment:
description: 'Environment to run tests against'
required: true
default: 'staging'
private_key:
description: 'Private key for authentication'
required: true
global_sponsorship:
description: 'The Global Sponsorship address'
required: true
sponsorship_approver_private_key:
description: 'Private key for a Global Sponsorship Signer'
required: true
publish_results:
description: 'Publish test results'
required: false
default: 'false'
test_app:
description: 'A valid Lens App address'
required: true
test_account:
description: 'A Lens Account address'
required: true
test_erc20:
description: 'An ERC20 token address'
required: true
runs:
using: 'composite'
steps:
- uses: actions/checkout@v4
- name: Setup Repository
uses: ./.github/actions/setup
- name: Build
shell: bash
run: pnpm build
- name: Setup Environment Variables
shell: bash
run: |
echo "PRIVATE_KEY=${{ inputs.private_key }}" >> .env
echo "TEST_APP=${{ inputs.test_app }}" >> .env
echo "TEST_ACCOUNT=${{ inputs.test_account }}" >> .env
echo "TEST_ERC20=${{ inputs.test_erc20 }}" >> .env
echo "ENVIRONMENT=${{ inputs.environment }}" >> .env
echo "GLOBAL_SPONSORSHIP=${{ inputs.global_sponsorship }}" >> .env
echo "SPONSORSHIP_APPROVER_PRIVATE_KEY=${{ inputs.sponsorship_approver_private_key }}" >> .env
- name: Run Tests
shell: bash
run: pnpm test
- name: Publish Test Results
if: ${{ inputs.publish_results == 'true' }}
shell: bash
run: |
echo "Publishing test results..."
# Add logic to upload test results to a service or save artifacts
echo "Test results published."
================================================
FILE: .github/workflows/dependency-review.yml
================================================
name: Dependency Review
on:
- pull_request
permissions:
contents: read
pull-requests: write
jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v5
- name: Dependency Review
uses: actions/dependency-review-action@v4
with:
comment-summary-in-pr: on-failure
fail-on-severity: moderate
license-check: false
================================================
FILE: .github/workflows/pull-request.yml
================================================
name: Pull Request
on:
workflow_dispatch:
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
verify:
name: Verify
uses: ./.github/workflows/verify.yml
secrets: inherit
================================================
FILE: .github/workflows/snapshot.yml
================================================
name: Canary Release
on:
push:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
verify:
name: Verify
uses: ./.github/workflows/verify.yml
secrets: inherit
publish:
name: Publish Snapshot
runs-on: ubuntu-latest
needs: verify
steps:
- uses: actions/checkout@v4
- name: Setup Repository
uses: ./.github/actions/setup
- name: Configure NPM Auth Token
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NODE_AUTH_TOKEN }}" >> ~/.npmrc
- name: Create Snapshot
id: create_snapshot
run: pnpm changeset version --snapshot canary || echo "No unreleased changesets found"
- name: Check for Changeset
id: check_changeset
run: echo "changeset_exists=$(grep -q 'No unreleased changesets found' <<< '${{ steps.create_snapshot.outputs.stdout }}' && echo false || echo true)" >> $GITHUB_ENV
- name: Build
if: env.changeset_exists == 'true'
run: pnpm build
- name: Publish Snapshot
if: env.changeset_exists == 'true'
run: pnpm changeset publish --snapshot --tag canary --no-git-tag
================================================
FILE: .github/workflows/trigger-tests.yml
================================================
name: Run Tests on Demand
on:
repository_dispatch:
types: [on-demand-test]
workflow_dispatch:
inputs:
environment:
description: 'Environment to run tests against'
required: true
default: 'staging'
type: choice
options:
- staging
- testnet
publish_results:
description: 'Publish test results'
required: false
default: 'true'
type: string
jobs:
tests:
name: Full Test Suite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Tests
uses: ./.github/actions/tests
with:
environment: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.environment || github.event.client_payload.lens_env || 'staging' }}
private_key: ${{ secrets.PRIVATE_KEY }}
test_app: ${{ vars.TEST_APP }}
test_account: ${{ vars.TEST_ACCOUNT }}
test_erc20: ${{ vars.TEST_ERC20 }}
global_sponsorship: ${{ secrets.GLOBAL_SPONSORSHIP }}
sponsorship_approver_private_key: ${{ secrets.SPONSORSHIP_APPROVER_PRIVATE_KEY }}
publish_results: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.publish_results || 'true' }}
================================================
FILE: .github/workflows/verify.yml
================================================
name: 'Verify'
on:
workflow_call:
workflow_dispatch:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Biome
uses: biomejs/setup-biome@v2
with:
version: 2.0.6
- name: Run Biome
run: biome ci .
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Tests
uses: ./.github/actions/tests
with:
environment: 'staging'
private_key: ${{ secrets.PRIVATE_KEY }}
test_app: ${{ vars.TEST_APP }}
test_account: ${{ vars.TEST_ACCOUNT }}
test_erc20: ${{ vars.TEST_ERC20 }}
global_sponsorship: ${{ secrets.GLOBAL_SPONSORSHIP }}
sponsorship_approver_private_key: ${{ secrets.SPONSORSHIP_APPROVER_PRIVATE_KEY }}
publish_results: 'false'
================================================
FILE: .gitignore
================================================
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
node_modules
.pnp
.pnp.js
# build output
**/dist
/docs
*/graphql-cache.d.ts
# misc
.DS_Store
*.pem
# turbo
.turbo
# lockfiles
package-lock.json
yarn.lock
examples/*/pnpm-lock.yaml
# debug
.pnpm-debug.log*
# local env files
.env
# typescript
*.tsbuildinfo
# cursor
.cursorignore
================================================
FILE: .npmrc
================================================
engine-strict=true
auto-install-peers=false
strict-peer-dependencies=false
link-workspace-packages=false
================================================
FILE: .nvmrc
================================================
20.13.1
================================================
FILE: .prettierignore
================================================
# use biome instead
*
================================================
FILE: .vscode/settings.json
================================================
{
"[graphql]": {
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": false
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome",
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.removeUnused.ts": "never",
"source.removeUnusedImports": "never",
"source.organizeImports.biome": "explicit"
},
"editor.formatOnSave": true
},
"[typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome",
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.removeUnused.ts": "never",
"source.removeUnusedImports": "never",
"source.organizeImports.biome": "explicit"
},
"editor.formatOnSave": true
},
"[json]": {
"editor.defaultFormatter": "biomejs.biome",
"editor.quickSuggestions": {
"strings": true
},
"editor.formatOnSave": true,
"editor.suggest.insertMode": "replace"
},
"disabledExtensions": ["Orta.vscode-jest"],
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) Avara Labs Cayman Holdings SEZC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
# Lens SDK
The official SDK for the Lens 🌿.
## Table of Contents <!-- omit in toc -->
- [Installation](#installation)
- [Development Workflow](#development-workflow)
- [Troubleshooting](#troubleshooting)
- [Contributing](#contributing)
- [License](#license)
## Installation
## Development Workflow
This section is for developers who want to contribute to the SDK.
### Initial Setup <!-- omit in toc -->
Clone the repository:
```bash
git clone https://github.com/lens-network/sdk.git
```
Install the dependencies:
```bash
pnpm install
```
### Pre-requisites: <!-- omit in toc -->
- Node.js: >= v20. See [installation guide](https://nodejs.org/en/download/package-manager).
- pnpm: v9.1.2. See [installation guide](https://pnpm.io/installation).
Use [nvm](https://github.com/nvm-sh/nvm) to manage your Node.js versions. Run the following command in the project root folder:
```bash
nvm use
```
to switch to the correct Node.js version.
Enable [corepack](https://www.totaltypescript.com/how-to-use-corepack) to use the the correct version of `pnpm`.
Run the following command in the project root folder:
```bash
corepack install
```
to install the correct version once. After that corepack will automatically use the correct version of `pnpm` when entering the project folder.
### Usage <!-- omit in toc -->
Run the tests:
- `pnpm test:client`: Run the tests for the `@lens-protocol/client` package.
Lint the code:
```bash
pnpm lint
```
Compile the code:
```bash
pnpm build
```
Clean the build:
```bash
pnpm clean
```
Create a new package:
```bash
pnpm new:package
```
### IDE Setup <!-- omit in toc -->
The project uses [Biome](https://biomejs.dev/) to format and lint the code. You can install the Biome extension for your IDE: https://biomejs.dev/guides/editors/first-party-extensions/
### Publishing <!-- omit in toc -->
1. Create a new release branch using the `release/X.Y.Z` naming convention.
2. Bumps up version number and updates the changelog.
```bash
pnpm changeset version
```
3. Commit the changes using `chore: bumps up version number` as the commit message.
4. Push the changes to the remote repository.
5. Open a pull request to the `main` branch.
6. Wait for all checks to pass and for the pull request to be approved.
7. Publish the package.
```bash
pnpm changeset publish
```
8. Push tags to the remote repository.
```bash
git push --follow-tags
```
9. Merge the pull request to the `main` branch.
## Troubleshooting
### Incompatible Types Across Packages <!-- omit in toc -->
Working within a monorepo can sometimes lead to type incompatibilities across packages. If you encounter an error like:
```bash
Type 'import("[...]/packages/client/dist/index").PublicClient<import("[...]/packages/client/dist/index").Context>' is not assignable to type 'import("[...]/packages/client/src/clients").PublicClient<import("[...]/packages/client/src/context").Context>'.
```
This usually indicates that TypeScript is picking up types from different versions of the same package. To resolve this, make sure you have configured the entry points correctly as aliases in the top level `tsconfig.json` file.
```json
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"skipLibCheck": true,
"types": ["node"],
"paths": {
"@lens-protocol/client": ["./packages/client/src"],
"@lens-protocol/client/actions": ["./packages/client/src/actions"],
"@lens-protocol/client/test-utils": ["./packages/client/src/test-utils"],
"@lens-protocol/env": ["./packages/env/src"],
"@lens-protocol/graphql": ["./packages/graphql/src"],
"@lens-protocol/react": ["./packages/react/src"],
"@lens-protocol/storage": ["./packages/storage/src"],
"@lens-protocol/types": ["./packages/types/src"]
}
},
"include": ["**/*.ts"],
"exclude": ["dist", "node_modules"]
}
```
## Contributing
We are currently focused on launching Lens Network mainnet and Lens Protocol v3. We are not able to accept contributions at this time. We will update this section in due course.
If you have a pressing issue or feature request, please open an issue on GitHub.
## License
Lens SDK is [MIT licensed](./LICENSE).
================================================
FILE: biome.json
================================================
{
"$schema": "https://biomejs.dev/schemas/2.0.6/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"ignoreUnknown": false,
"includes": ["**"]
},
"formatter": {
"enabled": true,
"useEditorconfig": true
},
"assist": { "actions": { "source": { "organizeImports": "on" } } },
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"style": {
"noParameterAssign": "error",
"useAsConstAssertion": "error",
"useDefaultParameterLast": "error",
"useEnumInitializers": "error",
"useSelfClosingElements": "error",
"useSingleVarDeclarator": "error",
"noUnusedTemplateLiteral": "error",
"useNumberNamespace": "error",
"noInferrableTypes": "error",
"noUselessElse": "error"
}
}
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"jsxQuoteStyle": "single"
}
},
"json": {
"formatter": {
"enabled": false
},
"linter": {
"enabled": false
}
},
"overrides": [
{
"includes": ["**/*.tsx"],
"linter": {
"domains": {
"react": "all"
}
}
},
{
"includes": ["templates/**/*"],
"formatter": {
"enabled": false
},
"linter": {
"enabled": false
}
},
{
"includes": ["packages/**/*/dist/**"],
"formatter": {
"enabled": false
},
"linter": {
"enabled": false
}
},
{
"includes": ["packages/**/*.e2e.ts","packages/**/*.test.ts"],
"linter": {
"rules": {
"style": {
"noNonNullAssertion": "off"
}
}
}
},
{
"includes": ["packages/graphql/**/*.graphql"],
"formatter": {
"enabled": false
},
"linter": {
"enabled": false
}
},
{
"includes": ["packages/graphql/src/graphql-*.d.ts"],
"formatter": {
"enabled": false
},
"linter": {
"enabled": false
},
"assist": { "actions": { "source": { "organizeImports": "off" } } }
},
{
"includes": ["examples/**/*.ts", "examples/**/*.tsx"],
"linter": {
"rules": {
"style": {
"noNonNullAssertion": "off"
}
}
}
}
]
}
================================================
FILE: examples/create-app/README.md
================================================
# Create an App
[](https://stackblitz.com/github/lens-protocol/lens-sdk/tree/main/examples/create-app)
================================================
FILE: examples/create-app/index.html
================================================
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="https://cdn.simplecss.org/simple.min.css">
</head>
<body>
<h1>Create an App</h1>
<div id="app">Loading...</div>
<script type="module">
import out from './index.ts';
document.querySelector('#app').innerHTML = Array.isArray(out)
? out.map((x) => `<div style="margin-bottom: 16px;">${x}</div>`).join('')
: out;
</script>
</body>
</html>
================================================
FILE: examples/create-app/index.ts
================================================
import 'viem/window';
import { chains } from '@lens-chain/sdk/viem';
import { immutable, StorageClient } from '@lens-chain/storage-client';
import { PublicClient, testnet, uri } from '@lens-protocol/client';
import { createApp, fetchApp } from '@lens-protocol/client/actions';
import { handleOperationWith } from '@lens-protocol/client/viem';
import { app, Platform } from '@lens-protocol/metadata';
import { type Address, createWalletClient, custom } from 'viem';
const chain = chains.testnet;
// hoist account
const [address] = (await window.ethereum!.request({
method: 'eth_requestAccounts',
})) as [Address];
const walletClient = createWalletClient({
account: address,
chain,
transport: custom(window.ethereum!),
});
const client = PublicClient.create({
environment: testnet,
});
const sessionClient = await client
.login({
builder: {
address: walletClient.account.address,
},
signMessage: async (message) => walletClient.signMessage({ message }),
})
.match(
(result) => result,
(error) => {
throw error;
},
);
const storageClient = StorageClient.create();
const metadata = app({
name: 'My App',
url: 'https://example.com',
description: 'My app description',
platforms: [Platform.WEB],
developer: 'me@example.com',
});
const resource = await storageClient.uploadAsJson(metadata, {
acl: immutable(chain.id),
});
const created = await createApp(sessionClient, {
metadataUri: uri(resource.uri),
defaultFeed: {
globalFeed: true,
},
graph: {
globalGraph: true,
},
namespace: {
globalNamespace: true,
},
})
.andThen(handleOperationWith(walletClient))
.andThen(sessionClient.waitForTransaction)
.andThen((txHash) => fetchApp(sessionClient, { txHash }))
.match(
(result) => result,
(error) => {
throw error;
},
);
export default [
`<h2>${created?.metadata?.name}</h2>`,
`<p>Address: ${await created?.address}</p>`,
];
================================================
FILE: examples/create-app/package.json
================================================
{
"name": "example-create-app",
"private": true,
"type": "module",
"scripts": {
"dev": "vite"
},
"dependencies": {
"@lens-chain/sdk": "latest",
"@lens-protocol/client": "canary",
"@lens-protocol/metadata": "latest",
"@lens-chain/storage-client": "latest",
"viem": "^2.21.55"
},
"devDependencies": {
"typescript": "^5.6.3",
"vite": "^5.4.11"
}
}
================================================
FILE: examples/create-app/tsconfig.json
================================================
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["ESNext", "DOM"],
"module": "ESNext",
"moduleResolution": "Bundler",
"strict": true,
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true,
"noEmit": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"skipLibCheck": true
},
"include": ["./"]
}
================================================
FILE: examples/custom-fragments/README.md
================================================
# Custom Fragments
[](https://stackblitz.com/github/lens-protocol/lens-sdk/tree/main/examples/custom-fragments)
================================================
FILE: examples/custom-fragments/index.html
================================================
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="https://cdn.simplecss.org/simple.min.css">
</head>
<body>
<h1>Custom Fragments</h1>
<div id="app">Loading...</div>
<script type="module">
import out from './index.ts';
document.querySelector('#app').innerHTML = Array.isArray(out)
? out.map((x) => `<div style="margin-bottom: 16px;">${x}</div>`).join('')
: out;
</script>
</body>
</html>
================================================
FILE: examples/custom-fragments/index.ts
================================================
import {
type Account,
ArticleMetadataFragment,
AudioMetadataFragment,
evmAddress,
type FragmentOf,
graphql,
ImageMetadataFragment,
PublicClient,
TextOnlyMetadataFragment,
testnet,
UsernameFragment,
VideoMetadataFragment,
} from '@lens-protocol/client';
import { fetchAccount } from '@lens-protocol/client/actions';
const AccountFragment = graphql(
`fragment Account on Account {
__typename
handle: username {
...Username
}
}`,
[UsernameFragment],
);
const PostMetadataFragment = graphql(
`fragment PostMetadata on PostMetadata {
__typename
... on ArticleMetadata {
content
}
... on AudioMetadata {
content
}
... on TextOnlyMetadata {
content
}
... on ImageMetadata {
content
}
... on VideoMetadata {
content
}
}`,
[
ArticleMetadataFragment,
AudioMetadataFragment,
TextOnlyMetadataFragment,
ImageMetadataFragment,
VideoMetadataFragment,
],
);
const PostFieldsFragment = graphql(
`fragment PostFields on Post {
metadata {
...PostMetadata
}
}`,
[PostMetadataFragment],
);
declare module '@lens-protocol/client' {
export interface Account extends FragmentOf<typeof AccountFragment> {}
export interface PostFields extends FragmentOf<typeof PostFieldsFragment> {}
export type PostMetadata = FragmentOf<typeof PostMetadataFragment>;
}
const client = PublicClient.create({
environment: testnet,
fragments: [AccountFragment, PostFieldsFragment],
});
const account: Account | null = await fetchAccount(client, {
address: evmAddress('0x57b62a1571F4F09CDB4C3d93dA542bfe142D9F81'),
}).unwrapOr(null);
export default [
`<h2>${account?.handle?.value}</h2>`,
`<pre>${JSON.stringify(account, null, 2)}</pre>`,
];
================================================
FILE: examples/custom-fragments/package.json
================================================
{
"name": "example-custom-fragments",
"private": true,
"type": "module",
"scripts": {
"dev": "vite"
},
"dependencies": {
"@lens-protocol/client": "canary",
"viem": "^2.21.55"
},
"devDependencies": {
"typescript": "^5.6.3",
"vite": "^5.4.11"
}
}
================================================
FILE: examples/custom-fragments/tsconfig.json
================================================
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["ESNext", "DOM"],
"module": "ESNext",
"moduleResolution": "Bundler",
"strict": true,
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true,
"noEmit": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"skipLibCheck": true
},
"include": ["./"]
}
================================================
FILE: examples/nextjs-client/.gitignore
================================================
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
# env files (can opt-in for committing if needed)
.env*
# vercel
.vercel
# typescript
*.tsbuildinfo
next-env.d.ts
================================================
FILE: examples/nextjs-client/.stackblitzrc
================================================
{
"startCommand": "npm run dev",
"env": {}
}
================================================
FILE: examples/nextjs-client/README.md
================================================
# Next.js - Lens Client Integration Example
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
[](https://stackblitz.com/github/lens-protocol/lens-sdk/tree/main/examples/nextjs-client)
================================================
FILE: examples/nextjs-client/next.config.ts
================================================
import type { NextConfig } from 'next';
const nextConfig: NextConfig = {
/* config options here */
};
export default nextConfig;
================================================
FILE: examples/nextjs-client/package.json
================================================
{
"name": "nextjs-client",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@lens-protocol/react": "canary",
"next": "15.4.2",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"simpledotcss": "^2.3.3"
},
"devDependencies": {
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"typescript": "^5"
}
}
================================================
FILE: examples/nextjs-client/src/app/Web3Providers.tsx
================================================
'use client';
import { LensProvider } from '@lens-protocol/react';
import { client } from './client';
export function Web3Providers({ children }: { children: React.ReactNode }) {
return <LensProvider client={client}>{children}</LensProvider>;
}
================================================
FILE: examples/nextjs-client/src/app/client.ts
================================================
import { PublicClient, testnet } from '@lens-protocol/react';
export const client = PublicClient.create({
environment: testnet,
});
================================================
FILE: examples/nextjs-client/src/app/globals.css
================================================
:root {
--background: #ffffff;
--foreground: #171717;
}
@media (prefers-color-scheme: dark) {
:root {
--background: #0a0a0a;
--foreground: #ededed;
}
}
html,
body {
max-width: 100vw;
overflow-x: hidden;
}
body {
color: var(--foreground);
background: var(--background);
font-family: Arial, Helvetica, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
* {
box-sizing: border-box;
padding: 0;
margin: 0;
}
a {
color: inherit;
text-decoration: none;
}
@media (prefers-color-scheme: dark) {
html {
color-scheme: dark;
}
}
================================================
FILE: examples/nextjs-client/src/app/layout.tsx
================================================
import type { Metadata } from 'next';
import { Geist, Geist_Mono } from 'next/font/google';
import 'simpledotcss/simple.min.css';
import './globals.css';
import { Suspense } from 'react';
import { Web3Providers } from './Web3Providers';
const geistSans = Geist({
variable: '--font-geist-sans',
subsets: ['latin'],
});
const geistMono = Geist_Mono({
variable: '--font-geist-mono',
subsets: ['latin'],
});
export const metadata: Metadata = {
title: 'Next.js - Lens Client Integration',
description: 'Generated by create next app',
};
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang='en'>
<body className={`${geistSans.variable} ${geistMono.variable}`}>
<Web3Providers>
<Suspense fallback={<div>Loading...</div>}>{children}</Suspense>
</Web3Providers>
</body>
</html>
);
}
================================================
FILE: examples/nextjs-client/src/app/page.tsx
================================================
'use client';
import { AccountsOrderBy, PageSize, useAccounts } from '@lens-protocol/react';
export default function Home() {
const { data } = useAccounts({
orderBy: AccountsOrderBy.AccountScore,
pageSize: PageSize.Ten,
suspense: true,
});
return (
<div>
<p>Top 10 Accounts by Account Score:</p>
<ul>
{data.items.map((account) => (
<li key={account.address}>{account.username?.value}</li>
))}
</ul>
</div>
);
}
================================================
FILE: examples/nextjs-client/tsconfig.json
================================================
{
"compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
================================================
FILE: examples/react-follow/README.md
================================================
# Follow/Unfollow Accounts on Lens
[](https://stackblitz.com/github/lens-protocol/lens-sdk/tree/main/examples/react-follow)
================================================
FILE: examples/react-follow/index.html
================================================
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/lens.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.classless.min.css">
<title>Log in to Lens</title>
</head>
<body>
<main id="root"></main>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
================================================
FILE: examples/react-follow/package.json
================================================
{
"name": "react-follow",
"description": "Follow/Unfollow accounts on Lens",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite"
},
"dependencies": {
"@lens-chain/sdk": "latest",
"@lens-protocol/react": "canary",
"@tanstack/react-query": "^5.63.0",
"connectkit": "^1.9.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"viem": "^2.22.4",
"wagmi": "^2.14.6"
},
"devDependencies": {
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@vitejs/plugin-react-swc": "^3.8.1",
"typescript": "^5.6.3",
"vite": "^5.4.9"
}
}
================================================
FILE: examples/react-follow/src/AccountToFollow.tsx
================================================
import { PageSize, useAccounts } from '@lens-protocol/react';
import { FollowButton } from './FollowButton';
export function AccountsToFollow() {
const { data } = useAccounts({
filter: { searchBy: { localNameQuery: 'test' } },
pageSize: PageSize.Ten,
suspense: true,
});
return (
<div>
<h2>Accounts to Follow</h2>
<ul>
{data?.items.map((account) => (
<li key={account.address}>
<p>
<span>{account.username?.localName ?? account.address}</span>
<span>
{account.operations?.isFollowedByMe
? 'Following'
: 'Not Following'}
</span>
<FollowButton account={account} />
</p>
</li>
))}
</ul>
</div>
);
}
================================================
FILE: examples/react-follow/src/App.tsx
================================================
import { AccountsToFollow } from './AccountToFollow';
export function App() {
return (
<div style={{ padding: '20px', maxWidth: '800px', margin: '0 auto' }}>
<h1>Lens Follow Example</h1>
<hr style={{ margin: '30px 0' }} />
<AccountsToFollow />
</div>
);
}
================================================
FILE: examples/react-follow/src/FollowButton.tsx
================================================
import { type Account, useFollow, useUnfollow } from '@lens-protocol/react';
import { handleOperationWith } from '@lens-protocol/react/viem';
import { useWalletClient } from 'wagmi';
export function FollowButton({ account }: { account: Account }) {
const { data: wallet } = useWalletClient();
const { execute: follow, loading: followLoading } = useFollow({
handler: handleOperationWith(wallet),
});
const { execute: unfollow, loading: unfollowLoading } = useUnfollow({
handler: handleOperationWith(wallet),
});
const loading = followLoading || unfollowLoading;
const handleFollowToggle = async () => {
const result = account.operations?.isFollowedByMe
? await unfollow({ account: account.address })
: await follow({ account: account.address });
if (result.isErr()) {
alert(result.error.message);
return;
}
};
return (
<button type='button' onClick={handleFollowToggle} disabled={loading}>
{loading
? 'Loading...'
: account.operations?.isFollowedByMe
? 'Unfollow'
: 'Follow'}
</button>
);
}
================================================
FILE: examples/react-follow/src/Web3Providers.tsx
================================================
import { LensProvider } from '@lens-protocol/react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ConnectKitProvider } from 'connectkit';
import type React from 'react';
import { WagmiProvider } from 'wagmi';
import { client } from './client';
import { config } from './config';
const queryClient = new QueryClient();
export function Web3Providers({ children }: { children: React.ReactNode }) {
return (
<WagmiProvider config={config}>
<QueryClientProvider client={queryClient}>
<LensProvider client={client}>
<ConnectKitProvider>{children}</ConnectKitProvider>
</LensProvider>
</QueryClientProvider>
</WagmiProvider>
);
}
================================================
FILE: examples/react-follow/src/client.ts
================================================
import { fetchAccountsAvailable } from '@lens-protocol/client/actions';
import {
assertOk,
cache,
invariant,
PublicClient,
testnet,
} from '@lens-protocol/react';
import { signMessageWith } from '@lens-protocol/react/viem';
import { walletClient } from './wallet';
export const client = PublicClient.create({
environment: testnet,
cache: cache,
storage: window.localStorage,
});
const result = await client.resumeSession().orElse(() =>
fetchAccountsAvailable(client, {
managedBy: walletClient.account.address,
}).andThen(({ items }) => {
invariant(items.length > 0, 'No available accounts found');
const loginAs =
items[0].__typename === 'AccountOwned'
? {
accountOwner: {
owner: walletClient.account.address,
account: items[0].account.address,
},
}
: {
accountManager: {
manager: walletClient.account.address,
account: items[0].account.address,
},
};
return client.login({
...loginAs,
signMessage: signMessageWith(walletClient),
});
}),
);
assertOk(result);
================================================
FILE: examples/react-follow/src/config.ts
================================================
import { chains } from '@lens-chain/sdk/viem';
import { getDefaultConfig } from 'connectkit';
import { createConfig, http } from 'wagmi';
export const config = createConfig(
getDefaultConfig({
chains: [chains.testnet],
transports: {
// [chains.mainnet.id]: http(chains.mainnet.rpcUrls.default.http[0]!),
[chains.testnet.id]: http(chains.testnet.rpcUrls.default.http[0]!),
},
walletConnectProjectId: '',
appName: 'Lens + ConnectKit Example',
appDescription: 'A sample app integrating ConnectKit and Lens React SDK.',
appUrl: `${import.meta.env.BASE_URL}`,
appIcon: `${import.meta.env.BASE_URL}/lens.svg`,
}),
);
================================================
FILE: examples/react-follow/src/main.tsx
================================================
import { Suspense } from 'react';
import { createRoot } from 'react-dom/client';
import { App } from './App';
import { Web3Providers } from './Web3Providers';
createRoot(document.getElementById('root')!).render(
<Web3Providers>
<Suspense fallback={<p>Loading...</p>}>
<App />
</Suspense>
</Web3Providers>,
);
================================================
FILE: examples/react-follow/src/vite-env.d.ts
================================================
/// <reference types="vite/client" />
================================================
FILE: examples/react-follow/src/wallet.ts
================================================
import { chains } from '@lens-chain/sdk/viem';
import { type Address, createWalletClient, custom } from 'viem';
const chain = chains.testnet;
// hoist account
const [address] = (await window.ethereum!.request({
method: 'eth_requestAccounts',
})) as [Address];
export const walletClient = createWalletClient({
account: address,
chain,
transport: custom(window.ethereum!),
});
const chainId = await walletClient.getChainId();
if (chainId !== chain.id) {
try {
await walletClient.switchChain({ id: chain.id });
} catch {
await walletClient.addChain({ chain });
}
}
================================================
FILE: examples/react-follow/tsconfig.json
================================================
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"jsx": "react-jsx",
"module": "ESNext",
"moduleResolution": "Bundler",
"strict": true,
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true,
"noEmit": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"skipLibCheck": true
},
"include": ["src", "vite.config.ts"]
}
================================================
FILE: examples/react-follow/vite.config.ts
================================================
import react from '@vitejs/plugin-react-swc';
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [react()],
});
================================================
FILE: examples/react-login/README.md
================================================
# Log in to Lens
[](https://stackblitz.com/github/lens-protocol/lens-sdk/tree/main/examples/react-login)
================================================
FILE: examples/react-login/index.html
================================================
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/lens.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.classless.min.css">
<title>Log in to Lens</title>
</head>
<body>
<main id="root"></main>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
================================================
FILE: examples/react-login/package.json
================================================
{
"name": "react-login",
"description": "Log in to Lens",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite"
},
"dependencies": {
"@lens-chain/sdk": "latest",
"@lens-protocol/react": "canary",
"@tanstack/react-query": "^5.63.0",
"connectkit": "^1.9.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"viem": "^2.22.4",
"wagmi": "^2.14.6"
},
"devDependencies": {
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@vitejs/plugin-react-swc": "^3.8.1",
"typescript": "^5.6.3",
"vite": "^5.4.9"
}
}
================================================
FILE: examples/react-login/src/App.tsx
================================================
import { useAuthenticatedUser } from '@lens-protocol/react';
import { LoginForm } from './LoginForm';
import { MyAccount } from './MyAccount';
export function App() {
const { data } = useAuthenticatedUser({ suspense: true });
if (data) {
return <MyAccount address={data.address} />;
}
return <LoginForm />;
}
================================================
FILE: examples/react-login/src/LoginForm.tsx
================================================
import {
type AccountAvailable,
type EvmAddress,
evmAddress,
useAccountsAvailable,
useLogin,
} from '@lens-protocol/react';
import { signMessageWith } from '@lens-protocol/react/viem';
import { useModal } from 'connectkit';
import { useAccount, useWalletClient } from 'wagmi';
function LoginWith({
signer,
value,
}: {
signer: EvmAddress;
value: AccountAvailable;
}) {
const { execute } = useLogin();
const { data } = useWalletClient();
const loginAs =
value.__typename === 'AccountManaged'
? {
accountManager: {
account: value.account.address,
manager: signer,
},
}
: {
accountOwner: {
account: value.account.address,
owner: signer,
},
};
return (
<button
type='button'
onClick={() => {
execute({
...loginAs,
signMessage: signMessageWith(data!),
});
}}
>
{value.account.username?.value ?? value.account.address}
</button>
);
}
function LoginOptions({ address }: { address: string }) {
const { data } = useAccountsAvailable({
managedBy: evmAddress(address),
suspense: true,
});
return (
<>
<p>Select an account</p>
<ul>
{data.items.map((item) => (
<li key={item.account.address}>
<LoginWith signer={evmAddress(address)} value={item} />
</li>
))}
</ul>
</>
);
}
export function LoginForm() {
const { address } = useAccount();
const { setOpen } = useModal();
if (!address) {
return (
<button type='button' onClick={() => setOpen(true)}>
Connect
</button>
);
}
return <LoginOptions address={address} />;
}
================================================
FILE: examples/react-login/src/LogoutButton.tsx
================================================
import { useLogout } from '@lens-protocol/react';
import { useDisconnect } from 'wagmi';
export function LogoutButton() {
const { execute } = useLogout();
const { disconnectAsync } = useDisconnect();
const onClick = async () => {
await execute();
await disconnectAsync();
};
return (
<button type='button' onClick={onClick}>
Logout
</button>
);
}
================================================
FILE: examples/react-login/src/MyAccount.tsx
================================================
import { type EvmAddress, useAccount } from '@lens-protocol/react';
import { LogoutButton } from './LogoutButton';
export function MyAccount({ address }: { address: EvmAddress }) {
const { data } = useAccount({ address, suspense: true });
return (
<div>
<h1>
Welcome,{' '}
{data?.metadata?.name ?? data?.username?.value ?? data?.address}!
</h1>
<p>Created on: {data?.createdAt}</p>
<p>Account Score: {data?.score}</p>
<LogoutButton />
</div>
);
}
================================================
FILE: examples/react-login/src/Web3Providers.tsx
================================================
import { LensProvider } from '@lens-protocol/react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ConnectKitProvider } from 'connectkit';
import type React from 'react';
import { WagmiProvider } from 'wagmi';
import { client } from './client';
import { config } from './config';
const queryClient = new QueryClient();
export function Web3Providers({ children }: { children: React.ReactNode }) {
return (
<WagmiProvider config={config}>
<QueryClientProvider client={queryClient}>
<LensProvider client={client}>
<ConnectKitProvider>{children}</ConnectKitProvider>
</LensProvider>
</QueryClientProvider>
</WagmiProvider>
);
}
================================================
FILE: examples/react-login/src/client.ts
================================================
import { mainnet, PublicClient } from '@lens-protocol/react';
export const client = PublicClient.create({
environment: mainnet,
storage: window.localStorage,
});
================================================
FILE: examples/react-login/src/config.ts
================================================
import { chains } from '@lens-chain/sdk/viem';
import { getDefaultConfig } from 'connectkit';
import { createConfig, http } from 'wagmi';
export const config = createConfig(
getDefaultConfig({
chains: [chains.mainnet, chains.testnet],
transports: {
[chains.mainnet.id]: http(chains.mainnet.rpcUrls.default.http[0]!),
[chains.testnet.id]: http(chains.testnet.rpcUrls.default.http[0]!),
},
walletConnectProjectId: '',
appName: 'Lens + ConnectKit Example',
appDescription: 'A sample app integrating ConnectKit and Lens React SDK.',
appUrl: `${import.meta.env.BASE_URL}`,
appIcon: `${import.meta.env.BASE_URL}/lens.svg`,
}),
);
================================================
FILE: examples/react-login/src/main.tsx
================================================
import { Suspense } from 'react';
import { createRoot } from 'react-dom/client';
import { App } from './App';
import { Web3Providers } from './Web3Providers';
createRoot(document.getElementById('root')!).render(
<Web3Providers>
<Suspense fallback={<p>Loading...</p>}>
<App />
</Suspense>
</Web3Providers>,
);
================================================
FILE: examples/react-login/src/vite-env.d.ts
================================================
/// <reference types="vite/client" />
================================================
FILE: examples/react-login/tsconfig.json
================================================
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"jsx": "react-jsx",
"module": "ESNext",
"moduleResolution": "Bundler",
"strict": true,
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true,
"noEmit": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"skipLibCheck": true
},
"include": ["src", "vite.config.ts"]
}
================================================
FILE: examples/react-login/vite.config.ts
================================================
import react from '@vitejs/plugin-react-swc';
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [react()],
});
================================================
FILE: examples/react-post/README.md
================================================
# Create a Lens Post with Lens React Hooks
[](https://stackblitz.com/github/lens-protocol/lens-sdk/tree/main/examples/react-post)
================================================
FILE: examples/react-post/index.html
================================================
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/lens.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.classless.min.css">
<title>Create a Lens Post with Lens React Hooks</title>
</head>
<body>
<main id="root"></main>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
================================================
FILE: examples/react-post/package.json
================================================
{
"name": "react-post",
"description": "Create a Lens Post with Lens React Hooks",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite"
},
"dependencies": {
"@lens-chain/sdk": "^1.0.3",
"@lens-protocol/client": "canary",
"@lens-protocol/metadata": "^2.0.0",
"@lens-protocol/react": "canary",
"@tanstack/react-query": "^5.74.3",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"viem": "2.x",
"wagmi": "^2.14.16"
},
"devDependencies": {
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@vitejs/plugin-react-swc": "^3.7.2",
"typescript": "^5.6.3",
"vite": "^5.4.9"
}
}
================================================
FILE: examples/react-post/src/App.tsx
================================================
import { textOnly } from '@lens-protocol/metadata';
import { useCreatePost } from '@lens-protocol/react';
import { handleOperationWith } from '@lens-protocol/react/viem';
import { useWalletClient } from 'wagmi';
export function App() {
const { data: wallet } = useWalletClient();
const {
execute,
loading,
data: post,
} = useCreatePost({ handler: handleOperationWith(wallet) });
const onSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
const formData = new FormData(event.currentTarget);
const content = formData.get('content') as string;
const metadata = textOnly({
content,
});
const result = await execute({
contentUri: `data:application/json,${JSON.stringify(metadata)}`,
});
if (result.isErr()) {
alert(result.error.message);
}
};
return (
<div>
<h1>Post Example</h1>
{post && (
<div>
<h2>Post Created</h2>
<p>Slug: {post.slug}</p>
<p>Created At: {post.timestamp.toString()}</p>
<p>
Content:{' '}
{post.metadata.__typename === 'TextOnlyMetadata' &&
post.metadata.content}
</p>
</div>
)}
<form onSubmit={onSubmit}>
<label>
Content:
<textarea name='content' required />
</label>
<button type='submit' disabled={loading}>
{loading ? 'Posting...' : 'Post'}
</button>
</form>
</div>
);
}
================================================
FILE: examples/react-post/src/client.ts
================================================
import { fetchAccountsAvailable } from '@lens-protocol/client/actions';
import {
assertOk,
invariant,
PublicClient,
testnet,
} from '@lens-protocol/react';
import { signMessageWith } from '@lens-protocol/react/viem';
import { walletClient } from './wallet';
export const client = PublicClient.create({
environment: testnet,
storage: window.localStorage,
});
const result = await client.resumeSession().orElse(() =>
fetchAccountsAvailable(client, {
managedBy: walletClient.account.address,
}).andThen(({ items }) => {
invariant(items.length > 0, 'No available accounts found');
const loginAs =
items[0].__typename === 'AccountOwned'
? {
accountOwner: {
owner: walletClient.account.address,
account: items[0].account.address,
},
}
: {
accountManager: {
manager: walletClient.account.address,
account: items[0].account.address,
},
};
return client.login({
...loginAs,
signMessage: signMessageWith(walletClient),
});
}),
);
assertOk(result);
================================================
FILE: examples/react-post/src/config.ts
================================================
import { chains } from '@lens-chain/sdk/viem';
import { createConfig, http, injected } from 'wagmi';
export const config = createConfig({
chains: [chains.testnet],
connectors: [injected()],
transports: {
[chains.testnet.id]: http(),
},
});
================================================
FILE: examples/react-post/src/main.tsx
================================================
import { LensProvider } from '@lens-protocol/react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { createRoot } from 'react-dom/client';
import { WagmiProvider } from 'wagmi';
import { App } from './App';
import { client } from './client';
import { config } from './config';
const queryClient = new QueryClient();
createRoot(document.getElementById('root')!).render(
<WagmiProvider config={config}>
<QueryClientProvider client={queryClient}>
<LensProvider client={client}>
<App />
</LensProvider>
</QueryClientProvider>
</WagmiProvider>,
);
================================================
FILE: examples/react-post/src/vite-env.d.ts
================================================
/// <reference types="vite/client" />
import 'viem/window';
================================================
FILE: examples/react-post/src/wallet.ts
================================================
import { chains } from '@lens-chain/sdk/viem';
import { type Address, createWalletClient, custom } from 'viem';
const chain = chains.testnet;
// hoist account
const [address] = (await window.ethereum!.request({
method: 'eth_requestAccounts',
})) as [Address];
export const walletClient = createWalletClient({
account: address,
chain,
transport: custom(window.ethereum!),
});
const chainId = await walletClient.getChainId();
if (chainId !== chain.id) {
try {
await walletClient.switchChain({ id: chain.id });
} catch {
await walletClient.addChain({ chain });
}
}
================================================
FILE: examples/react-post/tsconfig.json
================================================
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"jsx": "react-jsx",
"module": "ESNext",
"moduleResolution": "Bundler",
"strict": true,
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true,
"noEmit": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"skipLibCheck": true
},
"include": ["src", "vite.config.ts"]
}
================================================
FILE: examples/react-post/vite.config.ts
================================================
import react from '@vitejs/plugin-react-swc';
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [react()],
});
================================================
FILE: examples/react-post-action/README.md
================================================
# Execute a Lens Post Action with Lens React Hooks
[](https://stackblitz.com/github/lens-protocol/lens-sdk/tree/main/examples/react-post-action)
================================================
FILE: examples/react-post-action/index.html
================================================
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/lens.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.classless.min.css">
<title>Create a Lens Post with Lens React Hooks</title>
</head>
<body>
<main id="root"></main>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
================================================
FILE: examples/react-post-action/package.json
================================================
{
"name": "react-post-action",
"description": "Execute a Lens Post Action with Lens React Hooks",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite"
},
"dependencies": {
"@lens-chain/sdk": "^1.0.3",
"@lens-protocol/client": "workspace:*",
"@lens-protocol/metadata": "^2.0.0",
"@lens-protocol/react": "workspace:*",
"@tanstack/react-query": "^5.74.3",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"viem": "^2.23.0",
"wagmi": "^2.14.6"
},
"devDependencies": {
"@types/react": "^19.1.0",
"@types/react-dom": "^19.1.0",
"@vitejs/plugin-react-swc": "^3.7.2",
"typescript": "^5.6.3",
"vite": "^5.4.9"
}
}
================================================
FILE: examples/react-post-action/src/App.tsx
================================================
import {
evmAddress,
type Post,
postId,
useExecutePostAction,
usePost,
} from '@lens-protocol/react';
import {
handleOperationWith,
useUnknownPostActionEncoder,
} from '@lens-protocol/react/viem';
import { useWalletClient } from 'wagmi';
const POST_SLUG = 'b84rn3awqztera37ek';
const ACTION_ADDRESS = '0xE34b5bF6e385084F43F827077E49EdAa33a3c9Dd';
export function App() {
const { data: wallet } = useWalletClient();
const { data: post, loading } = usePost({
post: postId(POST_SLUG),
}) as { data: Post | null; loading: boolean };
const { execute: executePostAction, loading: executing } =
useExecutePostAction({
handler: handleOperationWith(wallet),
});
const encodeParams = useUnknownPostActionEncoder(
post,
evmAddress(ACTION_ADDRESS),
);
const handleVote = async (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
if (!post || !wallet) return;
const formData = new FormData(event.currentTarget);
const params = {
'lens.param.vote': formData.get('lens.param.vote') === 'true',
};
const encodedParams = encodeParams(params);
const result = await executePostAction({
post: postId(post.id),
action: {
unknown: {
address: evmAddress(ACTION_ADDRESS),
params: encodedParams,
},
},
});
if (result.isErr()) {
console.error(result.error);
alert(`Failed to vote: ${result.error.message}`);
return;
}
alert(
`Successfully voted!\nVote: ${formData.get('lens.param.vote') === 'true' ? 'Yes' : 'No'}`,
);
};
return (
<div>
<h1>Custom Action Example</h1>
{loading && <p>Loading post...</p>}
{!post && !loading && <p>Post not found</p>}
{post && (
<div>
<h2>Post: {post.slug}</h2>
<p>
Content:{' '}
{post.metadata?.__typename === 'TextOnlyMetadata' &&
post.metadata.content}
</p>
<h3>Vote on this poll:</h3>
<form onSubmit={handleVote}>
<div>
<h4>Choose your vote:</h4>
<label>
<input
type='radio'
name='lens.param.vote'
value='true'
required
disabled={executing}
defaultChecked
/>
Yes
</label>
<label>
<input
type='radio'
name='lens.param.vote'
value='false'
required
disabled={executing}
/>
No
</label>
</div>
<br />
<button type='submit' disabled={executing}>
{executing ? 'Voting...' : 'Vote'}
</button>
</form>
</div>
)}
</div>
);
}
================================================
FILE: examples/react-post-action/src/client.ts
================================================
import { fetchAccountsAvailable } from '@lens-protocol/client/actions';
import {
assertOk,
invariant,
PublicClient,
testnet,
} from '@lens-protocol/react';
import { signMessageWith } from '@lens-protocol/react/viem';
import { walletClient } from './wallet';
export const client = PublicClient.create({
environment: testnet,
storage: window.localStorage,
});
const result = await client.resumeSession().orElse(() =>
fetchAccountsAvailable(client, {
managedBy: walletClient.account.address,
}).andThen(({ items }) => {
invariant(items.length > 0, 'No available accounts found');
const loginAs =
items[0].__typename === 'AccountOwned'
? {
accountOwner: {
owner: walletClient.account.address,
account: items[0].account.address,
},
}
: {
accountManager: {
manager: walletClient.account.address,
account: items[0].account.address,
},
};
return client.login({
...loginAs,
signMessage: signMessageWith(walletClient),
});
}),
);
assertOk(result);
================================================
FILE: examples/react-post-action/src/config.ts
================================================
import { chains } from '@lens-chain/sdk/viem';
import { createConfig, http, injected } from 'wagmi';
export const config = createConfig({
chains: [chains.testnet],
connectors: [injected()],
transports: {
[chains.testnet.id]: http(),
},
});
================================================
FILE: examples/react-post-action/src/main.tsx
================================================
import { LensProvider } from '@lens-protocol/react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { createRoot } from 'react-dom/client';
import { WagmiProvider } from 'wagmi';
import { App } from './App';
import { client } from './client';
import { config } from './config';
const queryClient = new QueryClient();
createRoot(document.getElementById('root')!).render(
<WagmiProvider config={config}>
<QueryClientProvider client={queryClient}>
<LensProvider client={client}>
<App />
</LensProvider>
</QueryClientProvider>
</WagmiProvider>,
);
================================================
FILE: examples/react-post-action/src/vite-env.d.ts
================================================
/// <reference types="vite/client" />
import 'viem/window';
================================================
FILE: examples/react-post-action/src/wallet.ts
================================================
import { chains } from '@lens-chain/sdk/viem';
import { type Address, createWalletClient, custom } from 'viem';
const chain = chains.testnet;
// hoist account
const [address] = (await window.ethereum!.request({
method: 'eth_requestAccounts',
})) as [Address];
export const walletClient = createWalletClient({
account: address,
chain,
transport: custom(window.ethereum!),
});
const chainId = await walletClient.getChainId();
if (chainId !== chain.id) {
try {
await walletClient.switchChain({ id: chain.id });
} catch {
await walletClient.addChain({ chain });
}
}
================================================
FILE: examples/react-post-action/tsconfig.json
================================================
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"jsx": "react-jsx",
"module": "ESNext",
"moduleResolution": "Bundler",
"strict": true,
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true,
"noEmit": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"skipLibCheck": true
},
"include": ["src", "vite.config.ts"]
}
================================================
FILE: examples/react-post-action/vite.config.ts
================================================
import react from '@vitejs/plugin-react-swc';
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [react()],
});
================================================
FILE: examples/sponsored-tx/.stackblitzrc
================================================
{
"startCommand": "pnpm start",
"env": {
"ENVIRONMENT": "testnet",
"WALLET_PRIVATE_KEY": "0x…",
"SPONSORSHIP_ADDRESS": "0x…",
"SPONSORSHIP_SIGNER_PRIVATE_KEY": "0x…"
}
}
================================================
FILE: examples/sponsored-tx/README.md
================================================
# Sponsored Transaction Example
This example demonstrates how to sponsor a transaction on Lens Chain using the Lens Protocol SDK.
[](https://stackblitz.com/github/lens-protocol/lens-sdk/tree/main/examples/sponsored-tx)
================================================
FILE: examples/sponsored-tx/index.ts
================================================
import { chains } from '@lens-chain/sdk/viem';
import { evmAddress } from '@lens-protocol/client';
import { SponsorshipApprovalSigner } from '@lens-protocol/client/viem';
import {
type Address,
createWalletClient,
type Hash,
type Hex,
http,
} from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
import { waitForTransactionReceipt } from 'viem/actions';
import { sendTransaction } from 'viem/zksync';
const chain =
process.env.ENVIRONMENT === 'mainnet' ? chains.mainnet : chains.testnet;
console.log(`Network: ${chain.name}`);
const wallet = createWalletClient({
account: privateKeyToAccount(process.env.WALLET_PRIVATE_KEY as Hex),
chain: chain,
transport: http(),
});
console.log(`Wallet: ${wallet.account.address}`);
const signer = createWalletClient({
account: privateKeyToAccount(
process.env.SPONSORSHIP_SIGNER_PRIVATE_KEY as Hex,
),
chain: chain,
transport: http(),
});
console.log(`Sponsorship Signer: ${signer.account.address}`);
const approver = new SponsorshipApprovalSigner({
signer,
sponsorship: evmAddress(process.env.SPONSORSHIP_ADDRESS as Address),
});
export interface SponsorRequest {
to: Address;
value: string | number;
data?: Hex;
}
async function sendSponsoredTransaction({
to,
value,
data,
}: SponsorRequest): Promise<Hash> {
const tx = await approver.approveSponsorship({
account: wallet.account,
to,
value,
data,
});
// biome-ignore lint/suspicious/noExplicitAny: keep it simple
return await sendTransaction(wallet, tx as any);
}
const hash = await sendSponsoredTransaction({
to: wallet.account.address,
value: 1, // 1 wei
});
console.log(`Transaction hash: ${hash}`);
await waitForTransactionReceipt(wallet, { hash });
================================================
FILE: examples/sponsored-tx/package.json
================================================
{
"name": "example-sponsored-tx",
"private": true,
"type": "module",
"scripts": {
"start": "vite-node index.ts"
},
"dependencies": {
"@lens-chain/sdk": "latest",
"@lens-protocol/client": "canary",
"viem": "~2.22.4"
},
"devDependencies": {
"typescript": "^5.8.3",
"vite-node": "^1.6.1"
}
}
================================================
FILE: examples/sponsored-tx/tsconfig.json
================================================
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["ESNext"],
"module": "NodeNext",
"moduleResolution": "NodeNext",
"strict": true,
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true,
"noEmit": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"skipLibCheck": true
},
"include": ["./"]
}
================================================
FILE: examples/sponsored-tx-poc/README.md
================================================
# Sponsored Transaction via RPC Wallet
[](https://stackblitz.com/github/lens-protocol/lens-sdk/tree/main/examples/sponsored-tx-poc)
================================================
FILE: examples/sponsored-tx-poc/index.html
================================================
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="https://cdn.simplecss.org/simple.min.css">
</head>
<body>
<h1>Sponsored Transaction</h1>
<div id="app">Loading...</div>
<script type="module">
import out from './index.ts';
document.querySelector('#app').innerHTML = Array.isArray(out)
? out.map((x) => `<div style="margin-bottom: 16px;">${x}</div>`).join('')
: out;
</script>
</body>
</html>
================================================
FILE: examples/sponsored-tx-poc/index.ts
================================================
import 'viem/window';
import { chains } from '@lens-chain/sdk/viem';
import { evmAddress } from '@lens-protocol/client';
import { SponsorshipApprovalSigner } from '@lens-protocol/client/viem';
import { createWalletClient, custom, http } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
import { sendTransaction } from 'viem/zksync';
const chain = chains.testnet;
const [address] = (await window.ethereum!.request({
method: 'eth_requestAccounts',
})) as [Address];
const wallet = createWalletClient({
account: address,
chain,
transport: custom(window.ethereum!),
});
const signer = createWalletClient({
account: privateKeyToAccount(window.prompt('Sponsorship Signer PK')),
chain: chain,
transport: http(),
});
const approver = new SponsorshipApprovalSigner({
signer,
sponsorship: evmAddress(window.prompt('Sponsorship Address')),
});
const tx = await approver.approveSponsorship({
account: wallet.account,
to: wallet.account.address,
data: '0x',
value: 1, // 1 wei
});
console.log('tx', tx);
const hash = await sendTransaction(wallet, tx);
export default [
`<p>Network: ${chain.name}</p>`,
`<p>Wallet: ${wallet.account.address}</p>`,
`<p>Sponsorship Signer: ${signer.account.address}</p>`,
`<p>Transaction hash: ${hash}</p>`,
];
================================================
FILE: examples/sponsored-tx-poc/package.json
================================================
{
"name": "example-sponsored-tx-poc",
"private": true,
"type": "module",
"scripts": {
"dev": "vite"
},
"dependencies": {
"@lens-chain/sdk": "latest",
"@lens-protocol/client": "canary",
"viem": "^2.21.55"
},
"devDependencies": {
"typescript": "^5.6.3",
"vite": "^5.4.11"
}
}
================================================
FILE: examples/sponsored-tx-poc/tsconfig.json
================================================
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["ESNext", "DOM"],
"module": "ESNext",
"moduleResolution": "Bundler",
"strict": true,
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true,
"noEmit": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"skipLibCheck": true
},
"include": ["./"]
}
================================================
FILE: examples/thirdweb-onramp/README.md
================================================
# thirdweb On-Ramp
[](https://stackblitz.com/github/lens-protocol/lens-sdk/tree/main/examples/thirdweb-onramp)
================================================
FILE: examples/thirdweb-onramp/index.html
================================================
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/svg+xml" href="/lens.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.classless.min.css">
<title>thirdweb On-Ramp</title>
</head>
<body>
<main id="root"></main>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
================================================
FILE: examples/thirdweb-onramp/package.json
================================================
{
"name": "example-thirdweb-onramp",
"private": true,
"type": "module",
"scripts": {
"dev": "vite"
},
"dependencies": {
"@lens-chain/sdk": "latest",
"@lens-protocol/client": "canary",
"@lens-protocol/metadata": "latest",
"@lens-protocol/storage-node-client": "next",
"@tanstack/react-query": "^5.66.8",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"thirdweb": "^5.89.0",
"viem": "^2.21.55",
"wagmi": "^2.14.11"
},
"devDependencies": {
"@types/react": "18",
"@types/react-dom": "18",
"@vitejs/plugin-react-swc": "^3.8.0",
"typescript": "^5.6.3",
"vite": "^5.4.11"
},
"resolutions": {
"viem": "^2.21.55"
},
"pnpm": {
"overrides": {
"viem": "^2.21.55"
}
}
}
================================================
FILE: examples/thirdweb-onramp/src/App.tsx
================================================
import 'viem/window';
import { chains } from '@lens-chain/sdk/viem';
import { createThirdwebClient } from 'thirdweb';
import { viemAdapter } from 'thirdweb/adapters/viem';
import { ethereum } from 'thirdweb/chains';
import { PayEmbed } from 'thirdweb/react';
import { type Address, createWalletClient, custom } from 'viem';
const chain = chains.testnet;
// hoist account
const [address] = (await window.ethereum!.request({
method: 'eth_requestAccounts',
})) as [Address];
// create wallet client
// this example assume you might not use thirdweb wallet already, if you
// do you can skip this step and use the wallet from thirdweb
const walletClient = createWalletClient({
account: address,
chain: chain,
transport: custom(window.ethereum!),
});
// create thirdweb wallet
const thirdwebWallet = await viemAdapter.wallet.fromViem({
walletClient: walletClient,
});
const client = createThirdwebClient({
clientId: '44323e7868feac3bd3ea4d91c9e879d4',
});
await thirdwebWallet.connect({ client });
export function App() {
return (
<PayEmbed
activeWallet={thirdwebWallet}
client={client}
payOptions={{
mode: 'direct_payment',
buyWithFiat: {
preferredProvider: 'COINBASE',
testMode: true, // <<<<<<<<< IMPORTANT!!! enable test mode
},
buyWithCrypto: false,
paymentInfo: {
amount: '5', // amount of token to buy
chain: ethereum, // workaround for getting quotes working
sellerAddress: address,
token: {
// Using GHO on Ethereum to get quotes working
address: '0x40d16fc0246ad3160ccc09b8d0d3a2cd28ae6c2f',
// Making it look like GRASS token
name: 'GRASS',
symbol: 'GRASS',
icon: 'https://block-explorer.testnet.lens.dev/images/grass.png',
},
},
onPurchaseSuccess: (purchase) => {
console.log('Purchase success', purchase);
},
}}
/>
);
}
================================================
FILE: examples/thirdweb-onramp/src/main.tsx
================================================
import { chains } from '@lens-chain/sdk/viem';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { createRoot } from 'react-dom/client';
import { ThirdwebProvider } from 'thirdweb/react';
import { createConfig, http, injected, WagmiProvider } from 'wagmi';
import { App } from './App';
export const config = createConfig({
chains: [chains.testnet],
connectors: [injected()],
transports: {
[chains.testnet.id]: http(),
},
});
const queryClient = new QueryClient();
createRoot(document.getElementById('root')!).render(
<WagmiProvider config={config}>
<QueryClientProvider client={queryClient}>
<ThirdwebProvider>
<App />
</ThirdwebProvider>
</QueryClientProvider>
</WagmiProvider>,
);
================================================
FILE: examples/thirdweb-onramp/tsconfig.json
================================================
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"jsx": "react-jsx",
"module": "ESNext",
"moduleResolution": "Bundler",
"strict": true,
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true,
"noEmit": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"skipLibCheck": true
},
"include": ["src", "vite.config.ts"]
}
================================================
FILE: examples/thirdweb-onramp/vite.config.ts
================================================
import react from '@vitejs/plugin-react-swc';
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [react()],
});
================================================
FILE: examples/user-onboarding/README.md
================================================
# User Onboarding
[](https://stackblitz.com/github/lens-protocol/lens-sdk/tree/main/examples/user-onboarding)
================================================
FILE: examples/user-onboarding/index.html
================================================
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="https://cdn.simplecss.org/simple.min.css">
</head>
<body>
<h1>User Onboarding Example</h1>
<div id="app">Loading...</div>
<script type="module">
import out from './index.ts';
document.querySelector('#app').innerHTML = Array.isArray(out)
? out.map((x) => `<div style="margin-bottom: 16px;">${x}</div>`).join('')
: out;
</script>
</body>
</html>
================================================
FILE: examples/user-onboarding/index.ts
================================================
import 'viem/window';
import { chains } from '@lens-chain/sdk/viem';
import { immutable, StorageClient } from '@lens-chain/storage-client';
import { PublicClient, testnet } from '@lens-protocol/client';
import {
createAccountWithUsername,
fetchAccount,
} from '@lens-protocol/client/actions';
import { handleOperationWith } from '@lens-protocol/client/viem';
import { account } from '@lens-protocol/metadata';
import { type Address, createWalletClient, custom } from 'viem';
const chain = chains.testnet;
// hoist account
const [address] = (await window.ethereum!.request({
method: 'eth_requestAccounts',
})) as [Address];
const walletClient = createWalletClient({
account: address,
chain,
transport: custom(window.ethereum!),
});
const client = PublicClient.create({
environment: testnet,
});
const sessionClient = await client
.login({
onboardingUser: {
wallet: walletClient.account.address,
app: '0xe5439696f4057aF073c0FB2dc6e5e755392922e1',
},
signMessage: async (message) => walletClient.signMessage({ message }),
})
.match(
(result) => result,
(error) => {
throw error;
},
);
const storageClient = StorageClient.create();
const metadata = account({
name: 'John Doe',
});
const { uri } = await storageClient.uploadFile(
new File([JSON.stringify(metadata)], 'metadata.json', {
type: 'application/json',
}),
{ acl: immutable(chain.id) },
);
const created = await createAccountWithUsername(sessionClient, {
metadataUri: uri,
username: {
localName: `john-doe-${Date.now()}`,
},
})
.andThen(handleOperationWith(walletClient))
.andThen(sessionClient.waitForTransaction)
.andThen((txHash) => fetchAccount(sessionClient, { txHash }))
.match(
(result) => result,
(error) => {
throw error;
},
);
export default [
`<h2>${created?.username?.value}</h2>`,
`<p>Address: ${await created?.address}</p>`,
];
================================================
FILE: examples/user-onboarding/package.json
================================================
{
"name": "example-user-onboarding",
"private": true,
"type": "module",
"scripts": {
"dev": "vite"
},
"dependencies": {
"@lens-chain/sdk": "latest",
"@lens-protocol/client": "canary",
"@lens-protocol/metadata": "latest",
"@lens-chain/storage-client": "latest",
"viem": "^2.21.55"
},
"devDependencies": {
"typescript": "^5.6.3",
"vite": "^5.4.11"
}
}
================================================
FILE: examples/user-onboarding/tsconfig.json
================================================
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["ESNext", "DOM"],
"module": "ESNext",
"moduleResolution": "Bundler",
"strict": true,
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true,
"noEmit": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"skipLibCheck": true
},
"include": ["./"]
}
================================================
FILE: jest-extended.d.ts
================================================
import type CustomMatchers from 'jest-extended';
import 'vitest';
declare module 'vitest' {
interface Assertion<T = unknown> extends CustomMatchers<T> {}
interface AsymmetricMatchersContaining<T = unknown>
extends CustomMatchers<T> {}
interface ExpectStatic extends CustomMatchers<T> {}
}
================================================
FILE: package.json
================================================
{
"name": "lens-sdk",
"version": "0.0.0",
"description": "The quickest way to build on top of Lens.",
"private": true,
"type": "module",
"workspaces": [
"packages/*"
],
"engines": {
"node": ">=20",
"pnpm": ">=9.1.2"
},
"scripts": {
"build": "turbo build",
"dev": "turbo watch build",
"clean": "rimraf .turbo packages/*/dist",
"lint": "biome check",
"lint:fix": "biome check --write",
"new:package": "NODE_OPTIONS='--import tsx' plop --plopfile=plopfile.ts",
"prepublish": "pnpm run build",
"test:client": "vitest --project client",
"test:e2e": "vitest --project e2e",
"test:react": "vitest --project react",
"test:storage": "vitest --project storage",
"test": "vitest"
},
"devDependencies": {
"@biomejs/biome": "2.0.6",
"@changesets/cli": "^2.29.1",
"@types/node": "^22.15.29",
"jest-extended": "^4.0.2",
"plop": "^4.0.1",
"rimraf": "^6.0.1",
"tsx": "^4.19.3",
"turbo": "^2.2.3",
"typescript": "^5.6.3",
"vite": "^6.3.5",
"vite-tsconfig-paths": "^5.0.1",
"vitest": "^3.2.0"
},
"license": "MIT",
"packageManager": "pnpm@9.12.2+sha512.22721b3a11f81661ae1ec68ce1a7b879425a1ca5b991c975b074ac220b187ce56c708fe5db69f4c962c989452eee76c82877f4ee80f474cebd61ee13461b6228"
}
================================================
FILE: packages/client/CHANGELOG.md
================================================
# @lens-protocol/client
## 3.0.0-alpha.0
### Major Changes
- 8073fb7: **chore**: transition to new major release
### Patch Changes
- Updated dependencies [8073fb7]
- @lens-protocol/storage@0.9.0-alpha.0
- @lens-protocol/env@0.1.0-alpha.0
- @lens-protocol/graphql@0.1.0-alpha.0
- @lens-protocol/types@0.1.0-alpha.0
================================================
FILE: packages/client/README.md
================================================
# Lens JavaScript SDK
The official framework-agnostic JavaScript SDK for Lens Protocol.
---
This package enables you to interact with the Lens API via a type safe interface that abstracts away some of the GraphQL intricacies.
================================================
FILE: packages/client/package.json
================================================
{
"name": "@lens-protocol/client",
"version": "3.0.0-alpha.0",
"description": "Low-level Lens API client",
"repository": {
"directory": "packages/client",
"type": "git",
"url": "git://github.com/lens-protocol/lens-sdk.git"
},
"type": "module",
"types": "dist/index.d.ts",
"main": "dist/index.cjs",
"module": "dist/index.js",
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"./actions": {
"import": "./dist/actions/index.js",
"require": "./dist/actions/index.cjs",
"types": "./dist/actions/index.d.cts"
},
"./ethers": {
"import": "./dist/ethers/index.js",
"require": "./dist/ethers/index.cjs",
"types": "./dist/ethers/index.d.cts"
},
"./viem": {
"import": "./dist/viem/index.js",
"require": "./dist/viem/index.cjs",
"types": "./dist/viem/index.d.cts"
},
"./test-utils": {
"import": "./dist/test-utils.js",
"require": "./dist/test-utils.cjs",
"types": "./dist/test-utils.d.cts"
}
},
"typesVersions": {
"*": {
"actions": [
"./dist/actions/index.d.ts"
],
"ethers": [
"./dist/ethers/index.d.ts"
],
"viem": [
"./dist/viem/index.d.ts"
],
"test-utils": [
"./dist/test-utils.d.ts"
]
}
},
"files": [
"dist"
],
"sideEffects": false,
"scripts": {
"build": "tsup",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@lens-chain/sdk": "^1.0.0",
"@lens-protocol/env": "workspace:*",
"@lens-protocol/graphql": "workspace:*",
"@lens-protocol/storage": "workspace:*",
"@lens-protocol/types": "workspace:*",
"@urql/core": "^5.0.8",
"@urql/exchange-auth": "^2.2.0",
"@urql/exchange-graphcache": "^7.2.4",
"graphql": "^16.9.0",
"jwt-decode": "^4.0.0"
},
"peerDependencies": {
"ethers": "^6.13.4",
"viem": "^2.21.53",
"zksync-ethers": "^6.15.3"
},
"peerDependenciesMeta": {
"ethers": {
"optional": true
},
"viem": {
"optional": true
},
"zksync-ethers": {
"optional": true
}
},
"devDependencies": {
"@lens-chain/storage-client": "^1.0.5",
"@lens-protocol/metadata": "^2.0.0",
"@types/big.js": "^6.2.2",
"big.js": "^7.0.1",
"ethers": "^6.13.4",
"msw": "^2.7.0",
"tsup": "^8.3.5",
"typescript": "^5.6.3",
"viem": "^2.22.4",
"zksync-ethers": "^6.15.3",
"zod": "^3.23.8"
},
"license": "MIT"
}
================================================
FILE: packages/client/src/AuthenticatedUser.ts
================================================
import { Role } from '@lens-protocol/graphql';
import {
type EvmAddress,
err,
never,
ok,
type Result,
type UUID,
} from '@lens-protocol/types';
import { UnexpectedError } from './errors';
import { type IdTokenClaims, ROLE_CLAIM, SPONSORED_CLAIM } from './tokens';
export type AuthenticatedUser = {
address: EvmAddress;
app: EvmAddress;
authenticationId: UUID;
role: Role;
signer: EvmAddress;
sponsored: boolean;
};
/**
* @internal
*/
export function authenticatedUser(
claims: IdTokenClaims,
): Result<AuthenticatedUser, UnexpectedError> {
switch (claims[ROLE_CLAIM]) {
case Role.AccountManager:
return ok({
address:
claims.act?.sub ?? never('Account Manager must have an Actor Claim'),
app: claims.aud,
authenticationId: claims.sid,
role: Role.AccountManager,
signer: claims.sub,
sponsored: claims[SPONSORED_CLAIM],
});
case Role.AccountOwner:
return ok({
address:
claims.act?.sub ?? never('Account Owner must have an Actor Claim'),
app: claims.aud,
authenticationId: claims.sid,
role: Role.AccountOwner,
signer: claims.sub,
sponsored: claims[SPONSORED_CLAIM],
});
case Role.OnboardingUser:
case Role.Builder:
return ok({
address: claims.sub,
app: claims.aud,
authenticationId: claims.sid,
role: claims[ROLE_CLAIM],
signer: claims.sub,
sponsored: claims[SPONSORED_CLAIM],
});
default:
return err(
UnexpectedError.from(`Unexpected role: ${claims[ROLE_CLAIM]}`),
);
}
}
================================================
FILE: packages/client/src/actions/account.test.ts
================================================
import { assertOk, evmAddress } from '@lens-protocol/types';
import { describe, it } from 'vitest';
import { createPublicClient } from '../test-utils';
import { fetchAccount } from './account';
describe('Given the Account query actions', () => {
const client = createPublicClient();
describe(`When invoking the '${fetchAccount.name}' action`, () => {
it('Then it should not fail w/ a GQL BadRequest error', async () => {
const result = await fetchAccount(client, {
address: evmAddress(import.meta.env.TEST_ACCOUNT),
});
assertOk(result);
});
});
});
================================================
FILE: packages/client/src/actions/account.ts
================================================
import type {
Account,
AccountAvailable,
AccountBlocked,
AccountFeedsStats,
AccountFeedsStatsRequest,
AccountGraphsFollowStats,
AccountGraphsStatsRequest,
AccountRequest,
AccountStats,
AccountStatsRequest,
AccountsAvailableRequest,
AccountsBlockedRequest,
AccountsBulkRequest,
AccountsRequest,
BlockRequest,
BlockResult,
CreateAccountRequest,
CreateAccountResult,
CreateAccountWithUsernameRequest,
CreateAccountWithUsernameResult,
EnableSignlessResult,
MuteRequest,
Paginated,
RecommendAccountRequest,
RemoveSignlessResult,
ReportAccountRequest,
SetAccountMetadataRequest,
SetAccountMetadataResult,
UnblockRequest,
UnblockResult,
UndoRecommendAccountRequest,
UnmuteRequest,
UpdateAccountFollowRulesRequest,
UpdateAccountFollowRulesResult,
} from '@lens-protocol/graphql';
import {
AccountFeedsStatsQuery,
AccountGraphsStatsQuery,
AccountQuery,
AccountStatsQuery,
AccountsAvailableQuery,
AccountsBlockedQuery,
AccountsBulkQuery,
AccountsQuery,
BlockMutation,
CreateAccountMutation,
CreateAccountWithUsernameMutation,
EnableSignlessMutation,
MuteAccountMutation,
RecommendAccountMutation,
RemoveSignlessMutation,
ReportAccountMutation,
SetAccountMetadataMutation,
UnblockMutation,
UndoRecommendAccountMutation,
UnmuteAccountMutation,
UpdateAccountFollowRulesMutation,
} from '@lens-protocol/graphql';
import type { ResultAsync } from '@lens-protocol/types';
import type { AnyClient, SessionClient } from '../clients';
import type { UnauthenticatedError, UnexpectedError } from '../errors';
/**
* Fetch an Account.
*
* Using a {@link SessionClient} will yield {@link Account#operations} specific to the authenticated Account.
*
* ```ts
* const result = await fetchAccount(anyClient, {
* address?: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - Any Lens client.
* @param request - The Account query request.
* @returns The Account or `null` if it does not exist.
*/
export function fetchAccount(
client: AnyClient,
request: AccountRequest,
): ResultAsync<Account | null, UnexpectedError> {
return client.query(AccountQuery, { request });
}
/**
* Fetch an Accounts.
*
* Using a {@link SessionClient} will yield {@link Account#operations} specific to the authenticated Account.
*
* ```ts
* const result = await fetchAccounts(anyClient);
* ```
*
* @param client - Any Lens client.
* @param request - The query request.
* @returns The list of accounts.
*/
export function fetchAccounts(
client: AnyClient,
request: AccountsRequest = {},
): ResultAsync<Paginated<Account>, UnexpectedError> {
return client.query(AccountsQuery, { request });
}
/**
* Fetch an Accounts Bulk.
*
* ```ts
* const result = await fetchAccountsBulk(anyClient, {
* addresses: [evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5')],
* });
* ```
*
* @param client - Any Lens client.
* @param request - The query request.
* @returns The list of accounts.
*/
export function fetchAccountsBulk(
client: AnyClient,
request: AccountsBulkRequest = {},
): ResultAsync<Account[], UnexpectedError> {
return client.query(AccountsBulkQuery, { request });
}
/**
* Fetch an Account Stats.
*
* ```ts
* const result = await fetchAccountStats(anyClient, {
* account: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - Any Lens client.
* @param request - The query request.
* @returns The stats for the account or `null` if it does not exist.
*/
export function fetchAccountStats(
client: AnyClient,
request: AccountStatsRequest,
): ResultAsync<AccountStats | null, UnexpectedError> {
return client.query(AccountStatsQuery, { request });
}
/**
* Fetch an Account Feed Stats.
*
* ```ts
* const result = await fetchAccountFeedStats(anyClient, {
* account: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - Any Lens client.
* @param request - The query request.
* @returns The feed stats for the account or `null` if it does not exist.
*/
export function fetchAccountFeedStats(
client: AnyClient,
request: AccountFeedsStatsRequest,
): ResultAsync<AccountFeedsStats | null, UnexpectedError> {
return client.query(AccountFeedsStatsQuery, { request });
}
/**
* Fetch an Account Graph Stats.
*
* ```ts
* const result = await fetchAccountGraphStats(anyClient, {
* account: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - Any Lens client.
* @param request - The query request.
* @returns The follow stats for the account or `null` if it does not exist.
*/
export function fetchAccountGraphStats(
client: AnyClient,
request: AccountGraphsStatsRequest,
): ResultAsync<AccountGraphsFollowStats | null, UnexpectedError> {
return client.query(AccountGraphsStatsQuery, { request });
}
/**
* Fetch Accounts Available.
*
* ```ts
* const result = await fetchAccountsAvailable(anyClient, {
* managedBy: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - Any Lens client.
* @param request - The query request.
* @returns The list of available accounts.
*/
export function fetchAccountsAvailable(
client: AnyClient,
request: AccountsAvailableRequest,
): ResultAsync<Paginated<AccountAvailable>, UnexpectedError> {
return client.query(AccountsAvailableQuery, { request });
}
/**
* Fetch Blocked Accounts.
*
* ```ts
* const result = await fetchAccountsBlocked(sessionClient);
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The query request.
* @returns The list of blocked accounts.
*/
export function fetchAccountsBlocked(
client: SessionClient,
request: AccountsBlockedRequest = {},
): ResultAsync<Paginated<AccountBlocked>, UnexpectedError> {
return client.query(AccountsBlockedQuery, { request });
}
/**
* Set Account metadata for the authenticated Account.
*
* ```ts
* const result = await setAccountMetadata(sessionClient, {
* metadataURI: uri('ar://abc123def456gh…'),
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function setAccountMetadata(
client: SessionClient,
request: SetAccountMetadataRequest,
): ResultAsync<
SetAccountMetadataResult,
UnexpectedError | UnauthenticatedError
> {
return client.mutation(SetAccountMetadataMutation, { request });
}
/**
* Create an account with a given username.
*
* ```ts
* const result = await createAccountWithUsername(sessionClient, {
* username: {
* localname: 'wagmi'
* },
* metadataUri: uri('lens://bafybxiky5jf…'),
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function createAccountWithUsername(
client: SessionClient,
request: CreateAccountWithUsernameRequest,
): ResultAsync<
CreateAccountWithUsernameResult,
UnexpectedError | UnauthenticatedError
> {
return client.mutation(CreateAccountWithUsernameMutation, { request });
}
/**
* Create an account without username.
*
* @alpha This is an alpha API and may be subject to breaking changes.
*
* ```ts
* const result = await createAccount(sessionClient, {
* metadataUri: uri('lens://bafybxiky5jf…'),
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function createAccount(
client: SessionClient,
request: CreateAccountRequest,
): ResultAsync<CreateAccountResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(CreateAccountMutation, { request });
}
/**
* Get transaction to enable signless.
*
* ```ts
* const result = await enableSignless(sessionClient);
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function enableSignless(
client: SessionClient,
): ResultAsync<EnableSignlessResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(EnableSignlessMutation, {});
}
/**
* Get transaction to remove signless.
*
* ```ts
* const result = await removeSignless(sessionClient);
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function removeSignless(
client: SessionClient,
): ResultAsync<RemoveSignlessResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(RemoveSignlessMutation, {});
}
/**
* Mute an account.
*
* ```ts
* const result = await muteAccount(sessionClient, {
* account: evmAddress("0xe5439696f4057aF073c0FB2dc6e5e755392922e1"),
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns void.
*/
export function muteAccount(
client: SessionClient,
request: MuteRequest,
): ResultAsync<void, UnexpectedError | UnauthenticatedError> {
return client.mutation(MuteAccountMutation, { request });
}
/**
* Unmute an account.
*
* ```ts
* const result = await unmuteAccount(sessionClient, {
* account: evmAddress("0xe5439696f4057aF073c0FB2dc6e5e755392922e1"),
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns void.
*/
export function unmuteAccount(
client: SessionClient,
request: UnmuteRequest,
): ResultAsync<void, UnexpectedError | UnauthenticatedError> {
return client.mutation(UnmuteAccountMutation, { request });
}
/**
* Report an account.
*
* ```ts
* const result = await reportAccount(sessionClient, {
* account: evmAddress("0xe5439696f4057aF073c0FB2dc6e5e755392922e1"),
* reason: AccountReportReason.RepetitiveSpam,
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns void.
*/
export function reportAccount(
client: SessionClient,
request: ReportAccountRequest,
): ResultAsync<void, UnexpectedError | UnauthenticatedError> {
return client.mutation(ReportAccountMutation, { request });
}
/**
* Block an account.
*
* ```ts
* const result = await blockAccount(sessionClient, {
* account: evmAddress("0xe5439696f4057aF073c0FB2dc6e5e755392922e1"),
* });
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function blockAccount(
client: SessionClient,
request: BlockRequest,
): ResultAsync<BlockResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(BlockMutation, { request });
}
/**
* Unblock an account.
*
* ```ts
* const result = await unblockAccount(sessionClient, {
* account: evmAddress("0xe5439696f4057aF073c0FB2dc6e5e755392922e1"),
* });
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function unblockAccount(
client: SessionClient,
request: UnblockRequest,
): ResultAsync<UnblockResult, UnauthenticatedError | UnexpectedError> {
return client.mutation(UnblockMutation, { request });
}
/**
* Recommend an account.
*
* ```ts
* const result = await recommendAccount(sessionClient, {
* account: evmAddress("0xe5439696f4057aF073c0FB2dc6e5e755392922e1"),
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns void.
*/
export function recommendAccount(
client: SessionClient,
request: RecommendAccountRequest,
): ResultAsync<void, UnexpectedError | UnauthenticatedError> {
return client.mutation(RecommendAccountMutation, { request });
}
/**
* Undo recommendation of an account.
*
* ```ts
* const result = await undoRecommendAccount(sessionClient, {
* account: evmAddress("0xe5439696f4057aF073c0FB2dc6e5e755392922e1"),
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns void.
*/
export function undoRecommendAccount(
client: SessionClient,
request: UndoRecommendAccountRequest,
): ResultAsync<void, UnexpectedError | UnauthenticatedError> {
return client.mutation(UndoRecommendAccountMutation, { request });
}
/**
* Update account follow rules
*
* ```ts
* const result = await updateAccountFollowRules(sessionClient, {
* toRemove: ['1234'],
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function updateAccountFollowRules(
client: SessionClient,
request: UpdateAccountFollowRulesRequest,
): ResultAsync<
UpdateAccountFollowRulesResult,
UnauthenticatedError | UnexpectedError
> {
return client.mutation(UpdateAccountFollowRulesMutation, { request });
}
================================================
FILE: packages/client/src/actions/accountManager.test.ts
================================================
import { immutable } from '@lens-chain/storage-client';
import { type Account, assertTypename } from '@lens-protocol/graphql';
import * as metadata from '@lens-protocol/metadata';
import { assertOk, never, uri } from '@lens-protocol/types';
import { beforeAll, describe, expect, it } from 'vitest';
import type { SessionClient } from '../clients';
import {
CHAIN,
loginAsOnboardingUser,
storageClient,
wallet,
} from '../test-utils';
import { handleOperationWith } from '../viem';
import {
createAccountWithUsername,
fetchAccount,
setAccountMetadata,
} from './account';
import { fetchMeDetails } from './authentication';
describe(
`Given the '${createAccountWithUsername.name}' action`,
{ timeout: 10000 },
() => {
let newAccount: Account;
let sessionClient: SessionClient;
beforeAll(async () => {
const initialMetadata = metadata.account({
name: 'John Doe',
});
const result = await loginAsOnboardingUser().andThen((sessionClient) =>
createAccountWithUsername(sessionClient, {
username: { localName: `testname${Date.now()}` },
metadataUri: uri(
`data:application/json,${JSON.stringify(initialMetadata)}`,
), // empty at first
})
.andThen(handleOperationWith(wallet))
.andThen(sessionClient.waitForTransaction)
.andThen((txHash) => fetchAccount(sessionClient, { txHash }))
.andThen((account) => {
newAccount = account ?? never('Account not found');
return sessionClient.switchAccount({
account: newAccount.address,
});
}),
);
assertOk(result);
sessionClient = result.value;
});
describe('When creating a new Account', () => {
it('Then it should have Signless enabled by default', async () => {
const result = await fetchMeDetails(sessionClient);
assertOk(result);
expect(result.value).toMatchObject({
isSignless: true,
});
});
it('Then it should be able to perform social operations in a signless fashion (e.g., updating Account metadata)', async () => {
const updated = metadata.account({
name: 'Bruce Wayne',
});
const resource = await storageClient.uploadAsJson(updated, {
acl: immutable(CHAIN.id),
});
const result = await setAccountMetadata(sessionClient, {
metadataUri: resource.uri,
});
assertOk(result);
assertTypename(result.value, 'SetAccountMetadataResponse');
await sessionClient.waitForTransaction(result.value.hash);
const account = await fetchAccount(sessionClient, {
address: newAccount.address,
}).unwrapOr(null);
expect(account).toMatchObject({
metadata: {
name: 'Bruce Wayne',
},
});
});
});
},
);
================================================
FILE: packages/client/src/actions/accountManager.ts
================================================
import type {
AccountManager,
AccountManagerPermissionsInput,
AccountManagersRequest,
AddAccountManagerResult,
HideManagedAccountRequest,
Paginated,
RemoveAccountManagerRequest,
RemoveAccountManagerResult,
UnhideManagedAccountRequest,
UpdateAccountManagerRequest,
UpdateAccountManagerResult,
} from '@lens-protocol/graphql';
import {
AccountManagersQuery,
AddAccountManagerMutation,
HideManagedAccountMutation,
RemoveAccountManagerMutation,
UnhideManagedAccountMutation,
UpdateAccountManagerMutation,
} from '@lens-protocol/graphql';
import type { EvmAddress, ResultAsync } from '@lens-protocol/types';
import type { SessionClient } from '../clients';
import type { UnauthenticatedError, UnexpectedError } from '../errors';
/**
* Fetch Account Managers.
*
* ```ts
* const result = await fetchAccountManagers(sessionClient);
* ```
*
* @param client - Lens SessionClient.
* @param request - The query request.
* @returns List of Account Managers.
*/
export function fetchAccountManagers(
client: SessionClient,
request: AccountManagersRequest = {},
): ResultAsync<
Paginated<AccountManager>,
UnexpectedError | UnauthenticatedError
> {
return client.query(AccountManagersQuery, { request });
}
/**
* Add an account manager to the authenticated account.
*
* ```ts
* const result = await addAccountManager(sessionClient, {
* address: evmAddress("0xe5439696f4057aF073c0FB2dc6e5e755392922e1"),
* });
* ```
*
* @param client - Lens SessionClient.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function addAccountManager(
client: SessionClient,
request: {
address: EvmAddress;
permissions?: AccountManagerPermissionsInput;
},
): ResultAsync<
AddAccountManagerResult,
UnexpectedError | UnauthenticatedError
> {
return client.mutation(AddAccountManagerMutation, {
request: {
address: request.address,
permissions: request.permissions ?? {
canExecuteTransactions: false,
canTransferTokens: false,
canTransferNative: false,
canSetMetadataUri: false,
},
},
});
}
/**
* Remove manager from the authenticated account.
*
* ```ts
* const result = await removeAccountManager(sessionClient, {
* manager: evmAddress("0xe5439696f4057aF073c0FB2dc6e5e755392922e1");
* });
* ```
*
* @param client - Lens SessionClient.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function removeAccountManager(
client: SessionClient,
request: RemoveAccountManagerRequest,
): ResultAsync<
RemoveAccountManagerResult,
UnexpectedError | UnauthenticatedError
> {
return client.mutation(RemoveAccountManagerMutation, { request });
}
/**
* Update permissions for an account manager.
*
* ```ts
* const result = await updateAccountManager(sessionClient, {
* permissions: {
* canSetMetadataUri: true;
* canTransferNative: false;
* canTransferTokens: true;
* canExecuteTransactions: false;
* },
* manager: evmAddress("0xe5439696f4057aF073c0FB2dc6e5e755392922e1");
* });
* ```
*
* @param client - Lens SessionClient.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function updateAccountManager(
client: SessionClient,
request: UpdateAccountManagerRequest,
): ResultAsync<
UpdateAccountManagerResult,
UnexpectedError | UnauthenticatedError
> {
return client.mutation(UpdateAccountManagerMutation, { request });
}
/**
* Hide a managed account.
*
* ```ts
* const result = await muteAccount(sessionClient, {
* account: evmAddress("0xe5439696f4057aF073c0FB2dc6e5e755392922e1");
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns void.
*/
export function hideManagedAccount(
client: SessionClient,
request: HideManagedAccountRequest,
): ResultAsync<void, UnexpectedError | UnauthenticatedError> {
return client.mutation(HideManagedAccountMutation, { request });
}
/**
* Unhide a managed account.
*
* ```ts
* const result = await unhideManagedAccount(sessionClient, {
* account: evmAddress("0xe5439696f4057aF073c0FB2dc6e5e755392922e1");
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns void.
*/
export function unhideManagedAccount(
client: SessionClient,
request: UnhideManagedAccountRequest,
): ResultAsync<void, UnexpectedError | UnauthenticatedError> {
return client.mutation(UnhideManagedAccountMutation, { request });
}
================================================
FILE: packages/client/src/actions/actions.ts
================================================
import type {
ConfigureAccountActionRequest,
ConfigureAccountActionResult,
ConfigurePostActionRequest,
ConfigurePostActionResult,
DisableAccountActionRequest,
DisableAccountActionResult,
DisablePostActionRequest,
DisablePostActionResult,
EnableAccountActionRequest,
EnableAccountActionResult,
EnablePostActionRequest,
EnablePostActionResult,
ExecuteAccountActionRequest,
ExecuteAccountActionResult,
ExecutePostActionRequest,
ExecutePostActionResult,
} from '@lens-protocol/graphql';
import {
ConfigureAccountActionMutation,
ConfigurePostActionMutation,
DisableAccountActionMutation,
DisablePostActionMutation,
EnableAccountActionMutation,
EnablePostActionMutation,
ExecuteAccountActionMutation,
ExecutePostActionMutation,
} from '@lens-protocol/graphql';
import type { ResultAsync } from '@lens-protocol/types';
import type { SessionClient } from '../clients';
import type { UnauthenticatedError, UnexpectedError } from '../errors';
/**
* Configure post action.
*
* ```ts
* const result = await configurePostAction(sessionClient, {
* post: postId('1234…'),
* params: {
* simpleCollect: {
* payToCollect: {
* amount: {
* value: '100',
* currency: evmAddress('0x5678…'),
* },
* },
* },
* },
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function configurePostAction(
client: SessionClient,
request: ConfigurePostActionRequest,
): ResultAsync<
ConfigurePostActionResult,
UnexpectedError | UnauthenticatedError
> {
return client.mutation(ConfigurePostActionMutation, { request });
}
/**
* Enable post action.
*
* ```ts
* const result = await enablePostAction(sessionClient, {
* post: postId('1234…'),
* action: { simpleCollect: true }
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function enablePostAction(
client: SessionClient,
request: EnablePostActionRequest,
): ResultAsync<EnablePostActionResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(EnablePostActionMutation, { request });
}
/**
* Disable post action.
*
* ```ts
* const result = await disablePostAction(sessionClient, {
* post: postId('1234…'),
* action: { simpleCollect: true }
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function disablePostAction(
client: SessionClient,
request: DisablePostActionRequest,
): ResultAsync<
DisablePostActionResult,
UnexpectedError | UnauthenticatedError
> {
return client.mutation(DisablePostActionMutation, { request });
}
/**
* Execute post action.
*
* ```ts
* const result = await executePostAction(sessionClient, {
* post: postId('1234…'),
* action: {
* simpleCollect: {
* selected: true,
* }
* }
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function executePostAction(
client: SessionClient,
request: ExecutePostActionRequest,
): ResultAsync<
ExecutePostActionResult,
UnexpectedError | UnauthenticatedError
> {
return client.mutation(ExecutePostActionMutation, { request });
}
/**
* Configure account action, only available for configure custom actions.
* By default the tipping action is configured for all accounts.
* Any user can tip any other user and any token.
*
* ```ts
* const result = await configureAccountAction(sessionClient, {
* action: {
* unknown: {
* address: evmAddress('0x1234…'),
* params: [{
* key: 'usd',
* value: '100',
* }],
* },
* },
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function configureAccountAction(
client: SessionClient,
request: ConfigureAccountActionRequest,
): ResultAsync<
ConfigureAccountActionResult,
UnexpectedError | UnauthenticatedError
> {
return client.mutation(ConfigureAccountActionMutation, { request });
}
/**
* Enable account action.
* The tipping action is not possible to modify.
*
* ```ts
* const result = await enableAccountAction(sessionClient, {
* unknown: {
* params: [{
* key: 'usd',
* value: '100'
* }],
* address: evmAddress('0x1234…'),
* }
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function enableAccountAction(
client: SessionClient,
request: EnableAccountActionRequest,
): ResultAsync<
EnableAccountActionResult,
UnexpectedError | UnauthenticatedError
> {
return client.mutation(EnableAccountActionMutation, { request });
}
/**
* Disable account action.
* Not possible to disable the tipping action.
*
* ```ts
* const result = await disableAccountAction(sessionClient, {
* unknown: {
* address: evmAddress('0x1234…'),
* }
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function disableAccountAction(
client: SessionClient,
request: DisableAccountActionRequest,
): ResultAsync<
DisableAccountActionResult,
UnexpectedError | UnauthenticatedError
> {
return client.mutation(DisableAccountActionMutation, { request });
}
/**
* Execute account action.
*
* ```ts
* const result = await executeAccountAction(sessionClient, {
* targetAccount: evmAddress('0x1234…'),
* params: {
* tipping: {
* value: '100',
* currency: evmAddress('0x5678…')
* }
* }
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function executeAccountAction(
client: SessionClient,
request: ExecuteAccountActionRequest,
): ResultAsync<
ExecuteAccountActionResult,
UnexpectedError | UnauthenticatedError
> {
return client.mutation(ExecuteAccountActionMutation, { request });
}
================================================
FILE: packages/client/src/actions/admins.ts
================================================
import type {
AddAdminsRequest,
AddAdminsResult,
Admin,
AdminsForRequest,
Paginated,
RemoveAdminsRequest,
RemoveAdminsResult,
} from '@lens-protocol/graphql';
import {
AddAdminsMutation,
AdminsForQuery,
RemoveAdminsMutation,
} from '@lens-protocol/graphql';
import type { ResultAsync } from '@lens-protocol/types';
import type { AnyClient, SessionClient } from '../clients';
import type { UnauthenticatedError, UnexpectedError } from '../errors';
/**
* Add Admins
*
* ```ts
* const result = await addAdmins(sessionClient{
* admins: [evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5')],
* address: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - The session client logged in as a builder.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function addAdmins(
client: SessionClient,
request: AddAdminsRequest,
): ResultAsync<AddAdminsResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(AddAdminsMutation, { request });
}
/**
* Remove admins
*
* ```ts
* const result = await removeAdmins(sessionClient{
* admins: [evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5')],
* address: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function removeAdmins(
client: SessionClient,
request: RemoveAdminsRequest,
): ResultAsync<RemoveAdminsResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(RemoveAdminsMutation, { request });
}
/**
* Fetch admins for.
*
* ```ts
* const result = await fetchAdminsFor(anyClient, {
* address: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - Any Lens client.
* @param request - The query request.
* @returns The list of admins or empty if it does not exist.
*/
export function fetchAdminsFor(
client: AnyClient,
request: AdminsForRequest,
): ResultAsync<Paginated<Admin>, UnexpectedError> {
return client.query(AdminsForQuery, { request });
}
================================================
FILE: packages/client/src/actions/app.ts
================================================
import type {
AddAppAuthorizationEndpointRequest,
AddAppFeedsRequest,
AddAppFeedsResult,
AddAppGroupsRequest,
AddAppGroupsResult,
AddAppSignersRequest,
AddAppSignersResult,
App,
AppFeed,
AppFeedsRequest,
AppGroupsRequest,
AppRequest,
AppServerApiKeyRequest,
AppSigner,
AppSignersRequest,
AppsRequest,
AppUser,
AppUsersRequest,
CreateAppRequest,
CreateAppResult,
GenerateNewAppServerApiKeyRequest,
Group,
Paginated,
RemoveAppAuthorizationEndpointRequest,
RemoveAppFeedsRequest,
RemoveAppFeedsResult,
RemoveAppGroupsRequest,
RemoveAppGroupsResult,
RemoveAppSignersRequest,
RemoveAppSignersResult,
ServerAPIKey,
SetAppGraphRequest,
SetAppGraphResult,
SetAppMetadataRequest,
SetAppMetadataResult,
SetAppSponsorshipRequest,
SetAppSponsorshipResult,
SetAppTreasuryRequest,
SetAppTreasuryResult,
SetAppUsernameNamespaceRequest,
SetAppUsernameNamespaceResult,
SetAppVerificationRequest,
SetAppVerificationResult,
SetDefaultAppFeedRequest,
SetDefaultAppFeedResult,
} from '@lens-protocol/graphql';
import {
AddAppAuthorizationEndpointMutation,
AddAppFeedsMutation,
AddAppGroupsMutation,
AddAppSignersMutation,
AppFeedsQuery,
AppGroupsQuery,
AppQuery,
AppServerApiKeyQuery,
AppSignersQuery,
AppsQuery,
AppUsersQuery,
CreateAppMutation,
GenerateNewAppServerApiKeyMutation,
RemoveAppAuthorizationEndpointMutation,
RemoveAppFeedsMutation,
RemoveAppGroupsMutation,
RemoveAppSignersMutation,
SetAppGraphMutation,
SetAppMetadataMutation,
SetAppSponsorshipMutation,
SetAppTreasuryMutation,
SetAppUsernameNamespaceMutation,
SetAppVerificationMutation,
SetDefaultAppFeedMutation,
} from '@lens-protocol/graphql';
import type { ResultAsync } from '@lens-protocol/types';
import type { AnyClient, SessionClient } from '../clients';
import type { UnauthenticatedError, UnexpectedError } from '../errors';
/**
* Fetch an App.
*
* Using a {@link SessionClient} will yield {@link App#operations}
*
* ```ts
* const result = await fetchApp(anyClient, {
* address: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - Any Lens client.
* @param request - The App query request.
* @returns The App or `null` if it does not exist.
*/
export function fetchApp(
client: AnyClient,
request: AppRequest,
): ResultAsync<App | null, UnexpectedError> {
return client.query(AppQuery, { request });
}
/**
* Fetch Apps.
*
* ```ts
* const result = await fetchApps(anyClient, {
* filter: {
* managedBy: {
* address: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5')
* }
* },
* });
* ```
*
* @param client - Any Lens client.
* @param request - The query request.
* @returns The list of Apps or empty if it does not exist.
*/
export function fetchApps(
client: AnyClient,
request: AppsRequest,
): ResultAsync<Paginated<App>, UnexpectedError> {
return client.query(AppsQuery, { request });
}
/**
* Fetch Groups linked to an App.
*
* ```ts
* const result = await fetchAppGroups(anyClient, {
* app: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5')
* });
* ```
*
* @param client - Any Lens client.
* @param request - The query request.
* @returns The list of groups for an App or empty if it does not exist.
*/
export function fetchAppGroups(
client: AnyClient,
request: AppGroupsRequest,
): ResultAsync<Paginated<Group>, UnexpectedError> {
return client.query(AppGroupsQuery, { request });
}
/**
* Fetch Feeds linked to an App.
*
* ```ts
* const result = await fetchAppFeeds(anyClient, {
* app: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5')
* });
* ```
*
* @param client - Any Lens client.
* @param request - The query request.
* @returns The list of feeds for an App or empty if it does not exist.
*/
export function fetchAppFeeds(
client: AnyClient,
request: AppFeedsRequest,
): ResultAsync<Paginated<AppFeed>, UnexpectedError> {
return client.query(AppFeedsQuery, { request });
}
/**
* Fetch Signers linked to an App.
*
* ```ts
* const result = await fetchAppSigners(anyClient, {
* app: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5')
* });
* ```
*
* @param client - Any Lens client.
* @param request - The query request.
* @returns The list of signers for an App or empty if it does not exist.
*/
export function fetchAppSigners(
client: AnyClient,
request: AppSignersRequest,
): ResultAsync<Paginated<AppSigner>, UnexpectedError> {
return client.query(AppSignersQuery, { request });
}
/**
* Fetch users using an App.
*
* ```ts
* const result = await fetchAppUsers(anyClient, {
* app: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5')
* });
* ```
*
* @param client - Any Lens client.
* @param request - The query request.
* @returns The list of users for an App or empty if it does not exist.
*/
export function fetchAppUsers(
client: AnyClient,
request: AppUsersRequest,
): ResultAsync<Paginated<AppUser> | null, UnexpectedError> {
return client.query(AppUsersQuery, { request });
}
/**
* Create an App
*
* ```ts
* const result = await createApp(sessionClient, {
* defaultFeed: {
* globalFeed: true,
* },
* graph: {
* globalGraph: true,
* },
* namespace: {
* globalNamespace: true,
* },
* });
* ```
*
* @param client - The session client logged in as a builder.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function createApp(
client: SessionClient,
request: CreateAppRequest,
): ResultAsync<CreateAppResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(CreateAppMutation, { request });
}
/**
* Add feeds to an App
*
* ```ts
* const result = await addAppFeeds(sessionClient, {
* feeds: [evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5')],
* app: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - The session client logged in as a builder.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function addAppFeeds(
client: SessionClient,
request: AddAppFeedsRequest,
): ResultAsync<AddAppFeedsResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(AddAppFeedsMutation, { request });
}
/**
* Add groups to an App
*
* ```ts
* const result = await addAppGroups(sessionClient, {
* groups: [evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5')],
* app: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - The session client logged in as a builder.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function addAppGroups(
client: SessionClient,
request: AddAppGroupsRequest,
): ResultAsync<AddAppGroupsResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(AddAppGroupsMutation, { request });
}
/**
* Add signers to an App
*
* ```ts
* const result = await addAppSigners(sessionClient, {
* signers: [evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5')],
* app: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - The session client logged in as a builder.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function addAppSigners(
client: SessionClient,
request: AddAppSignersRequest,
): ResultAsync<AddAppSignersResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(AddAppSignersMutation, { request });
}
/**
* Remove feeds from an App
*
* ```ts
* const result = await removeAppFeeds(sessionClient, {
* feeds: [evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5')],
* app: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - The session client logged in as a builder.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function removeAppFeeds(
client: SessionClient,
request: RemoveAppFeedsRequest,
): ResultAsync<RemoveAppFeedsResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(RemoveAppFeedsMutation, { request });
}
/**
* Remove groups from an App
*
* ```ts
* const result = await removeAppGroups(sessionClient, {
* groups: [evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5')],
* app: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - The session client logged in as a builder.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function removeAppGroups(
client: SessionClient,
request: RemoveAppGroupsRequest,
): ResultAsync<RemoveAppGroupsResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(RemoveAppGroupsMutation, { request });
}
/**
* Remove signers from an App
*
* ```ts
* const result = await removeAppSigners(sessionClient, {
* signers: [evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5')],
* app: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - The session client logged in as a builder.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function removeAppSigners(
client: SessionClient,
request: RemoveAppSignersRequest,
): ResultAsync<RemoveAppSignersResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(RemoveAppSignersMutation, { request });
}
/**
* Set app Graph
*
* ```ts
* const result = await setAppGraph(sessionClient, {
* graph: { globalGraph: true },
* app: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - The session client logged in as a builder.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function setAppGraph(
client: SessionClient,
request: SetAppGraphRequest,
): ResultAsync<SetAppGraphResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(SetAppGraphMutation, { request });
}
/**
* Set default Feed for app
*
* ```ts
* const result = await setDefaultAppFeed(sessionClient, {
* feed: { globalFeed: true },
* app: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - The session client logged in as a builder.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function setDefaultAppFeed(
client: SessionClient,
request: SetDefaultAppFeedRequest,
): ResultAsync<
SetDefaultAppFeedResult,
UnexpectedError | UnauthenticatedError
> {
return client.mutation(SetDefaultAppFeedMutation, { request });
}
/**
* Set metadata for app
*
* ```ts
* const result = await setAppMetadata(sessionClient, {
* metadataUri: uri("lens://4f91..."),
* app: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - The session client logged in as a builder.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function setAppMetadata(
client: SessionClient,
request: SetAppMetadataRequest,
): ResultAsync<SetAppMetadataResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(SetAppMetadataMutation, { request });
}
/**
* Set verification status for app
*
* ```ts
* const result = await setAppVerification(sessionClient, {
* enabled: true,
* app: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - The session client logged in as a builder.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function setAppVerification(
client: SessionClient,
request: SetAppVerificationRequest,
): ResultAsync<
SetAppVerificationResult,
UnexpectedError | UnauthenticatedError
> {
return client.mutation(SetAppVerificationMutation, { request });
}
/**
* Set sponsorship for app
*
* ```ts
* const result = await setAppSponsorship(sessionClient, {
* sponsorship: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* app: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - The session client logged in as a builder.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function setAppSponsorship(
client: SessionClient,
request: SetAppSponsorshipRequest,
): ResultAsync<
SetAppSponsorshipResult,
UnexpectedError | UnauthenticatedError
> {
return client.mutation(SetAppSponsorshipMutation, { request });
}
/**
* Set treasury for app
*
* ```ts
* const result = await setAppTreasury(sessionClient, {
* treasury: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* app: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - The session client logged in as a builder.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function setAppTreasury(
client: SessionClient,
request: SetAppTreasuryRequest,
): ResultAsync<SetAppTreasuryResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(SetAppTreasuryMutation, { request });
}
/**
* Set username namespace for app
*
* ```ts
* const result = await setAppUsernameNamespace(sessionClient, {
* usernameNamespace: {
* custom: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* },
* app: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - The session client logged in as a builder.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function setAppUsernameNamespace(
client: SessionClient,
request: SetAppUsernameNamespaceRequest,
): ResultAsync<
SetAppUsernameNamespaceResult,
UnexpectedError | UnauthenticatedError
> {
return client.mutation(SetAppUsernameNamespaceMutation, { request });
}
/**
* Add an authorization endpoint to an App
*
* ```ts
* const result = await addAppAuthorizationEndpoint(sessionClient, {
* endpoint: uri('https://example.com/auth'),
* app: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* bearerToken: 'Qdy136748…',
* });
* ```
*
* @param client - The session client logged as a builder.
* @param request - The mutation request.
* @returns void.
*/
export function addAppAuthorizationEndpoint(
client: SessionClient,
request: AddAppAuthorizationEndpointRequest,
): ResultAsync<void, UnexpectedError | UnauthenticatedError> {
return client.mutation(AddAppAuthorizationEndpointMutation, {
// biome-ignore lint/suspicious/noExplicitAny: work around and issue with endpoint: URL using browser URL instead of specified scalar
request: request as any,
});
}
/**
* Remove an authorization endpoint to an App
*
* ```ts
* const result = await removeAppAuthorizationEndpoint(sessionClient, {
* app: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - The session client logged as a builder.
* @param request - The mutation request.
* @returns void.
*/
export function removeAppAuthorizationEndpoint(
client: SessionClient,
request: RemoveAppAuthorizationEndpointRequest,
): ResultAsync<void, UnexpectedError | UnauthenticatedError> {
return client.mutation(RemoveAppAuthorizationEndpointMutation, { request });
}
/**
* Checks if the App has a server API key allocated.
*
* The actual value is redacted for security reasons.
*
* You MUST be logged-in as Builder and be the owner of the App.
*
* @param client - The session client logged as a builder.
* @param request - The query request.
* @returns The server API key for the App.
*/
export function fetchAppServerAPiKey(
client: SessionClient,
request: AppServerApiKeyRequest,
): ResultAsync<string | null, UnexpectedError | UnauthenticatedError> {
return client.query(AppServerApiKeyQuery, { request });
}
/**
* Generate a new server API key for an App.
*
* You MUST be logged-in as Builder and be the owner of the App.
*
* @param client - The session client logged as a builder.
* @param request - The mutation request.
* @returns The new server API key for the App.
*/
export function generateNewAppServerApiKey(
client: SessionClient,
request: GenerateNewAppServerApiKeyRequest,
): ResultAsync<ServerAPIKey, UnexpectedError | UnauthenticatedError> {
return client.mutation(GenerateNewAppServerApiKeyMutation, { request });
}
================================================
FILE: packages/client/src/actions/authentication.ts
================================================
import type {
Account,
AuthenticatedSession,
AuthenticatedSessionsRequest,
LastLoggedInAccountRequest,
MeResult,
Paginated,
RefreshRequest,
RefreshResult,
RevokeAuthenticationRequest,
RolloverRefreshRequest,
SwitchAccountRequest,
SwitchAccountResult,
} from '@lens-protocol/graphql';
import {
AuthenticatedSessionsQuery,
CurrentSessionQuery,
LastLoggedInAccountQuery,
LegacyRolloverRefreshMutation,
MeQuery,
RefreshMutation,
RevokeAuthenticationMutation,
SwitchAccountMutation,
} from '@lens-protocol/graphql';
import type { ResultAsync } from '@lens-protocol/types';
import type { AnyClient, SessionClient } from '../clients';
import type { UnauthenticatedError, UnexpectedError } from '../errors';
/**
* Get the AuthenticatedSession associated with the authenticated Account.
*
* ```ts
* const result = await currentSession(sessionClient);
* ```
*
* @param client - The session client.
* @returns The current AuthenticatedSession details.
*/
export function currentSession(
client: SessionClient,
): ResultAsync<AuthenticatedSession, UnauthenticatedError | UnexpectedError> {
return client.query(CurrentSessionQuery, {});
}
/**
* Revoke the authentication from the provided authentication ID.
*
* @remarks Use the {@link SessionClient#logout} method to logout instead.
* It's unlikely you'll need to use this action directly.
*
* ```ts
* const result = await revokeAuthentication(sessionClient, {
* authenticationId: 'f4dd2ea1-58d4-4210-86a2-67b7571f241a',
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Void if the operation was successful.
*/
export function revokeAuthentication(
client: SessionClient,
request: RevokeAuthenticationRequest,
): ResultAsync<void, UnexpectedError | UnauthenticatedError> {
return client.mutation(RevokeAuthenticationMutation, { request });
}
/**
* Refresh the authentication tokens of the authenticated Account.
*
* ```ts
* const result = await refresh(anyClient, {
* refreshToken: 'eyJhbGciOiJIUzI1NiIsInR5c…'
* });
* ```
*
* @param client - Any Lens client.
* @param request - The mutation request.
* @returns The refreshed authentication tokens if the operation was successful.
*/
export function refresh(
client: AnyClient,
request: RefreshRequest,
): ResultAsync<RefreshResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(RefreshMutation, { request });
}
/**
* Fetch the authenticated sessions associated with the authenticated Account.
*
* ```ts
* const result = await fetchAuthenticatedSessions(sessionClient);
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The query request.
* @returns The paginated authenticated sessions associated with the authenticated Account.
*/
export function fetchAuthenticatedSessions(
client: SessionClient,
request: AuthenticatedSessionsRequest = {},
): ResultAsync<Paginated<AuthenticatedSession>, UnexpectedError> {
return client.query(AuthenticatedSessionsQuery, { request });
}
/**
* Issue new authentication tokens from a valid Lens API v2 refresh token.
*
* Use this to seamlessly transition your users from Lens API v2 to Lens API v3 without
* requiring them to re-authenticate.
*
* The HTTP Origin header MUST be present and match the app's domain.
*
* ```ts
* const result = await legacyRolloverRefresh(sessionClient, {
* refreshToken: 'eyJhbGciOiJIUzI1NiIsInR5c…',
* app: evmAddress("0xe5439696f4057aF073c0FB2dc6e5e755392922e1"),
* });
* ```
*
* @param client - The client to use for the rollover refresh operation.
* @param request - The mutation request.
* @returns The refreshed authentication tokens if the operation was successful.
*/
export function legacyRolloverRefresh(
client: SessionClient,
request: RolloverRefreshRequest,
): ResultAsync<RefreshResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(LegacyRolloverRefreshMutation, { request });
}
/**
* Switch to another managed account.
*
* @remarks Use the {@link SessionClient#switchAccount} method to switch to an account instead.
* It's unlikely you'll need to use this action directly.
*
* @param client - The current session client.
* @param request - The query request.
* @returns The authenticated tokens for the switched account.
*/
export function switchAccount(
client: SessionClient,
request: SwitchAccountRequest,
): ResultAsync<SwitchAccountResult, UnauthenticatedError | UnexpectedError> {
return client.mutation(SwitchAccountMutation, { request });
}
/**
* Retrieve the details of the authenticated Account.
*
* @param client - The session client for the authenticated Account.
* @returns The details of the authenticated Account.
*/
export function fetchMeDetails(
client: SessionClient,
): ResultAsync<MeResult, UnauthenticatedError | UnexpectedError> {
return client.query(MeQuery, {});
}
/**
* Get the last logged in account.
*
* ```ts
* const result = await lastLoggedInAccount(anyClient, {
* address: evmAddress('0x90c8c68d0Abfb40D4fCD72316A65e42161520BC3'),
* });
* ```
*
* @param client - The session client.
* @param request - The query request.
* @returns The last logged in account.
*/
export function lastLoggedInAccount(
client: AnyClient,
request: LastLoggedInAccountRequest,
): ResultAsync<Account | null, UnauthenticatedError | UnexpectedError> {
return client.query(LastLoggedInAccountQuery, { request });
}
================================================
FILE: packages/client/src/actions/feed.ts
================================================
import type {
CreateFeedRequest,
CreateFeedResult,
Feed,
FeedRequest,
FeedsRequest,
Paginated,
SetFeedMetadataRequest,
SetFeedMetadataResult,
UpdateFeedRulesRequest,
UpdateFeedRulesResult,
} from '@lens-protocol/graphql';
import {
CreateFeedMutation,
FeedQuery,
FeedsQuery,
SetFeedMetadataMutation,
UpdateFeedRulesMutation,
} from '@lens-protocol/graphql';
import type { ResultAsync } from '@lens-protocol/types';
import type { AnyClient, SessionClient } from '../clients';
import type { UnauthenticatedError, UnexpectedError } from '../errors';
/**
* Create a Feed
*
* ```ts
* const result = await createFeed(sessionClient);
* ```
*
* @param client - The session client logged in as a builder.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function createFeed(
client: SessionClient,
request: CreateFeedRequest,
): ResultAsync<CreateFeedResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(CreateFeedMutation, { request });
}
/**
* Set Feed Metadata
*
* ```ts
* const result = await setFeedMetadata(sessionClient, {
* feed: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* metadataUri: uri("lens://4f91..."),
* });
* ```
*
* @param client - The session client logged in as a builder.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function setFeedMetadata(
client: SessionClient,
request: SetFeedMetadataRequest,
): ResultAsync<SetFeedMetadataResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(SetFeedMetadataMutation, { request });
}
/**
* Fetch a Feed.
*
* ```ts
* const result = await fetchFeed(anyClient, {
* feed: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - Any Lens client.
* @param request - The Feed query request.
* @returns The Feed or `null` if it does not exist.
*/
export function fetchFeed(
client: AnyClient,
request: FeedRequest,
): ResultAsync<Feed | null, UnexpectedError> {
return client.query(FeedQuery, { request });
}
/**
* Fetch Feeds.
*
* ```ts
* const result = await fetchFeeds(anyClient, {
* filter: {
* managedBy: {
* address: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5')
* }
* },
* });
* ```
*
* @param client - Any Lens client.
* @param request - The Feeds query request.
* @returns The list of Feeds or empty list if none exist.
*/
export function fetchFeeds(
client: AnyClient,
request: FeedsRequest,
): ResultAsync<Paginated<Feed>, UnexpectedError> {
return client.query(FeedsQuery, { request });
}
/**
* Update feed rules.
*
* ```ts
* const result = await updateFeedRules(sessionClient, {
* feed: evmAddress('0x1234…'),
* toAdd: {
* required: [{
* tokenGatedRule: {
* standard: TokenStandard.Erc20,
* currency: evmAddress('0x5678…'),
* value: '1.5', // Token value in its main unit
* }
* }],
* anyOf: [],
* }
* });
* ```
*
* @param client - The session client.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function updateFeedRules(
client: SessionClient,
request: UpdateFeedRulesRequest,
): ResultAsync<UpdateFeedRulesResult, UnauthenticatedError | UnexpectedError> {
return client.mutation(UpdateFeedRulesMutation, { request });
}
================================================
FILE: packages/client/src/actions/follow.ts
================================================
import type {
CreateFollowRequest,
CreateUnfollowRequest,
Follower,
FollowersRequest,
FollowersYouKnowRequest,
Following,
FollowingRequest,
FollowResult,
FollowStatusRequest,
FollowStatusResult,
Paginated,
UnfollowResult,
} from '@lens-protocol/graphql';
import {
FollowersQuery,
FollowersYouKnowQuery,
FollowingQuery,
FollowMutation,
FollowStatusQuery,
UnfollowMutation,
} from '@lens-protocol/graphql';
import type { ResultAsync } from '@lens-protocol/types';
import type { AnyClient, SessionClient } from '../clients';
import type { UnauthenticatedError, UnexpectedError } from '../errors';
/**
* Follow an Account
*
* ```ts
* const result = await follow(sessionClient, {
* account: evmAddress('0x90c8c68d0Abfb40D4fCD72316A65e42161520BC3')
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function follow(
client: SessionClient,
request: CreateFollowRequest,
): ResultAsync<FollowResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(FollowMutation, { request });
}
/**
* Unfollow an Account
*
* ```ts
* const result = await unfollow(sessionClient, {
* account: evmAddress('0x90c8c68d0Abfb40D4fCD72316A65e42161520BC3')
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function unfollow(
client: SessionClient,
request: CreateUnfollowRequest,
): ResultAsync<UnfollowResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(UnfollowMutation, { request });
}
/**
* Fetch followers accounts.
*
* ```ts
* const result = await fetchFollowers(anyClient, {
* account: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - Any Lens client.
* @param request - The query request.
* @returns List of followers accounts.
*/
export function fetchFollowers(
client: AnyClient,
request: FollowersRequest,
): ResultAsync<Paginated<Follower>, UnexpectedError> {
return client.query(FollowersQuery, { request });
}
/**
* Fetch following accounts for an account.
*
* ```ts
* const result = await fetchFollowing(anyClient, {
* account: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - Any Lens client.
* @param request - The query request.
* @returns List of accounts following.
*/
export function fetchFollowing(
client: AnyClient,
request: FollowingRequest,
): ResultAsync<Paginated<Following>, UnexpectedError> {
return client.query(FollowingQuery, { request });
}
/**
* Fetch followers you know.
*
* ```ts
* const result = await fetchFollowersYouKnow(anyClient, {
* observer: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* target: evmAddress('0xe5439696f4057aF073c0FB2dc6e5e755392922e1'),
* });
* ```
*
* @param client - Any Lens client.
* @param request - The query request.
* @returns List of accounts following.
*/
export function fetchFollowersYouKnow(
client: AnyClient,
request: FollowersYouKnowRequest,
): ResultAsync<Paginated<Follower>, UnexpectedError> {
return client.query(FollowersYouKnowQuery, { request });
}
/**
* Fetch follow status.
*
* ```ts
* const result = await fetchFollowStatus(anyClient,
* pairs: [
* {
* account: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* follower: evmAddress('0xe5439696f4057aF073c0FB2dc6e5e755392922e1'),
* }
* ],
* });
* ```
*
* @param client - Any Lens client.
* @param request - The query request.
* @returns Status of the follow action.
*/
export function fetchFollowStatus(
client: AnyClient,
request: FollowStatusRequest,
): ResultAsync<FollowStatusResult[], UnexpectedError> {
return client.query(FollowStatusQuery, { request });
}
================================================
FILE: packages/client/src/actions/frames.ts
================================================
import type {
CreateFrameEip712TypedDataFragment,
CreateFrameTypedDataRequest,
FrameLensManagerSignatureResultFragment,
SignFrameActionRequest,
VerifyFrameSignatureRequest,
} from '@lens-protocol/graphql';
import {
CreateFrameTypedDataQuery,
type FrameVerifySignatureResult,
SignFrameActionMutation,
VerifyFrameSignatureQuery,
} from '@lens-protocol/graphql';
import type { ResultAsync } from '@lens-protocol/types';
import type { AnyClient, SessionClient } from '../clients';
import type { UnauthenticatedError, UnexpectedError } from '../errors';
/**
* Create Frame action typed data to be signed by user wallet
*
* @param request - The request object
* @returns Typed data for Frame request
* @experimental This function might change in the future release
*
* @example
* ```ts
* const result = await createFrameTypedData(anyClient, {
* transactionId: '0x0000000000000000000000000000000000000000',
* buttonIndex: 2,
* deadline: 1711038973,
* inputText: 'Hello, World!',
* account: '0x0000000000000000000000000000000000000000',
* post: '0x01-0x01',
* app: '0x0000000000000000000000000000000000000000,
* specVersion: '1.1.0',
* state: '{"counter":1,"idempotency_key":"431b8b38-eb4d-455b"}',
* url: 'https://mylensframe.xyz',
* });
* ```
*/
export function createFrameTypedData(
client: AnyClient,
request: CreateFrameTypedDataRequest,
): ResultAsync<CreateFrameEip712TypedDataFragment, UnexpectedError> {
return client.query(CreateFrameTypedDataQuery, { request });
}
/**
* Sign Frame action with Lens Manager if enabled
*
* ⚠️ Requires authenticated SessionClient.
*
* @param request - The request object
* @returns Signature result
* @experimental This function might change in the future release
*
* @example
* ```ts
* const result = await signFrameAction(sessionClient, {
* transactionId: '0x0000000000000000000000000000000000000000',
* buttonIndex: 2,
* inputText: 'Hello, World!',
* account: '0x0000000000000000000000000000000000000000',
* post: '0x01-0x01',
* app: '0x0000000000000000000000000000000000000000,
* specVersion: '1.1.0',
* state: '{"counter":1,"idempotency_key":"431b8b38-eb4d-455b"}',
* url: 'https://mylensframe.xyz',
* });
* ```
*/
export function signFrameAction(
client: SessionClient,
request: SignFrameActionRequest,
): ResultAsync<
FrameLensManagerSignatureResultFragment,
UnexpectedError | UnauthenticatedError
> {
return client.mutation(SignFrameActionMutation, { request });
}
/**
* Verify Frame signature
*
* @param request - The request object
* @returns Verification result
* @experimental This function might change in the future release
*
* @example
* ```ts
* const result = await verifyFrameSignature(anyClient, {
* identityToken: identityToken,
* signature: data.signature,
* signedTypedData: data.signedTypedData,
* });
* ```
*/
export function verifyFrameSignature(
client: AnyClient,
request: VerifyFrameSignatureRequest,
): ResultAsync<FrameVerifySignatureResult, UnexpectedError> {
return client.query(VerifyFrameSignatureQuery, { request });
}
================================================
FILE: packages/client/src/actions/funds.e2e.ts
================================================
import type { Erc20Amount, NativeAmount } from '@lens-protocol/graphql';
import { assertOk, bigDecimal, evmAddress, Result } from '@lens-protocol/types';
import { Big } from 'big.js';
import { zeroAddress } from 'viem';
import { beforeAll, describe, expect, it } from 'vitest';
import type { SessionClient } from '../clients';
import {
CHAIN,
loginAsAccountOwner,
TEST_ACCOUNT,
TEST_ERC20,
wallet,
} from '../test-utils';
import { handleOperationWith } from '../viem';
import {
deposit,
fetchBalancesBulk,
unwrapTokens,
withdraw,
wrapTokens,
} from './funds';
import { findErc20Amount, findNativeAmount } from './helpers';
async function fetchBalances(
sessionClient: SessionClient,
): Promise<[NativeAmount, Erc20Amount]> {
const result = await fetchBalancesBulk(sessionClient, {
address: TEST_ACCOUNT,
includeNative: true,
tokens: [TEST_ERC20],
}).andThen((balances) =>
Result.combine([
findNativeAmount(balances),
findErc20Amount(TEST_ERC20, balances),
]),
);
assertOk(result);
return result.value;
}
// TODO: remove this once LENS-1212 is fixed
async function retryBalanceCheck(
sessionClient: SessionClient,
assertion: (balances: [NativeAmount, Erc20Amount]) => void,
): Promise<void> {
let lastError: Error | null = null;
let attempt = 0;
do {
try {
const balances = await fetchBalances(sessionClient);
assertion(balances);
return;
} catch (error) {
lastError = error as Error;
}
attempt++;
await new Promise((resolve) => setTimeout(resolve, 250));
} while (attempt < 4);
throw lastError || new Error('Balance check failed after all retries');
}
describe('Given a Lens Account', { timeout: 20_000 }, () => {
describe(`When calling the '${fetchBalancesBulk.name}' action`, () => {
it('Then it should return the requested balance amounts', async () => {
const result = await loginAsAccountOwner().andThen((sessionClient) =>
fetchBalancesBulk(sessionClient, {
address: TEST_ACCOUNT,
includeNative: true,
tokens: [TEST_ERC20],
}),
);
assertOk(result);
expect(result.value).toMatchObject([
{
__typename: 'NativeAmount',
asset: {
symbol: 'GRASS',
},
value: expect.any(String),
},
{
__typename: 'Erc20Amount',
asset: {
contract: {
chainId: CHAIN.id,
address: TEST_ERC20,
},
},
value: expect.any(String),
},
]);
});
it('Then it should be resilient and have a local error just for the failed balance', async () => {
const result = await loginAsAccountOwner().andThen((sessionClient) =>
fetchBalancesBulk(sessionClient, {
address: TEST_ACCOUNT,
includeNative: true,
tokens: [evmAddress(zeroAddress), TEST_ERC20],
}),
);
assertOk(result);
expect(result.value).toMatchObject([
{
__typename: 'NativeAmount',
asset: {
symbol: 'GRASS',
},
value: expect.any(String),
},
{
__typename: 'Erc20BalanceError',
reason: expect.any(String),
token: zeroAddress,
},
{
__typename: 'Erc20Amount',
asset: {
contract: {
chainId: CHAIN.id,
address: TEST_ERC20,
},
},
value: expect.any(String),
},
]);
});
});
describe('When managing Account funds', () => {
let sessionClient: SessionClient;
beforeAll(async () => {
await loginAsAccountOwner().andTee((client) => {
sessionClient = client;
});
});
it.sequential(
`Then it should be possible to deposit native tokens via the '${deposit.name}' action`,
async () => {
const [native] = await fetchBalances(sessionClient);
const result = await deposit(sessionClient, {
native: bigDecimal(1),
}).andThen(handleOperationWith(wallet));
assertOk(result);
await retryBalanceCheck(sessionClient, ([newNative]) => {
expect(Big(newNative.value)).toEqual(Big(native.value).add(1));
});
},
);
it.sequential(
`Then it should be possible to wrap native tokens via the '${wrapTokens.name}' action`,
async () => {
const [native, wrapped] = await fetchBalances(sessionClient);
const result = await wrapTokens(sessionClient, {
amount: bigDecimal(1),
}).andThen(handleOperationWith(wallet));
assertOk(result);
await retryBalanceCheck(sessionClient, ([newNative, newWrapped]) => {
expect(Big(newNative.value)).toEqual(Big(native.value).sub(1));
expect(Big(newWrapped.value)).toEqual(Big(wrapped.value).add(1));
});
},
);
it.sequential(
`Then it should be possible to withdraw ERC20 tokens via the '${withdraw.name}' action`,
async () => {
const [, wrapped] = await fetchBalances(sessionClient);
const result = await withdraw(sessionClient, {
erc20: {
currency: TEST_ERC20,
value: bigDecimal(1),
},
}).andThen(handleOperationWith(wallet));
assertOk(result);
await retryBalanceCheck(sessionClient, ([, newWrapped]) => {
expect(Big(newWrapped.value)).toEqual(Big(wrapped.value).sub(1));
});
},
);
it.sequential(
`Then it should be possible to deposit ERC20 tokens via the '${deposit.name}' action`,
async () => {
const [, wrapped] = await fetchBalances(sessionClient);
const result = await deposit(sessionClient, {
erc20: {
currency: TEST_ERC20,
value: bigDecimal(1),
},
}).andThen(handleOperationWith(wallet));
assertOk(result);
await retryBalanceCheck(sessionClient, ([, newWrapped]) => {
expect(Big(newWrapped.value)).toEqual(Big(wrapped.value).add(1));
});
},
);
it.sequential(
`Then it should be possible to unwrap wrapped native tokens via the '${unwrapTokens.name}' action`,
async () => {
const [native, wrapped] = await fetchBalances(sessionClient);
const result = await unwrapTokens(sessionClient, {
amount: bigDecimal(1),
}).andThen(handleOperationWith(wallet));
assertOk(result);
await retryBalanceCheck(sessionClient, ([newNative, newWrapped]) => {
expect(Big(newNative.value)).toEqual(Big(native.value).add(1));
expect(Big(newWrapped.value)).toEqual(Big(wrapped.value).sub(1));
});
},
);
it.sequential(
`Then it should be possible to withdraw native tokens via the '${withdraw.name}' action`,
async () => {
const [native] = await fetchBalances(sessionClient);
const result = await withdraw(sessionClient, {
native: bigDecimal(1),
}).andThen(handleOperationWith(wallet));
assertOk(result);
await retryBalanceCheck(sessionClient, ([newNative]) => {
expect(Big(newNative.value)).toEqual(Big(native.value).sub(1));
});
},
);
});
});
================================================
FILE: packages/client/src/actions/funds.ts
================================================
import type {
AccountBalancesRequest,
AnyAccountBalance,
AnyBalance,
BalancesBulkRequest,
DepositRequest,
DepositResult,
UnwrapTokensRequest,
UnwrapTokensResult,
WithdrawRequest,
WithdrawResult,
WrapTokensRequest,
WrapTokensResult,
} from '@lens-protocol/graphql';
import {
AccountBalancesQuery,
BalancesBulkQuery,
DepositMutation,
UnwrapTokensMutation,
WithdrawMutation,
WrapTokensMutation,
} from '@lens-protocol/graphql';
import type { ResultAsync } from '@lens-protocol/types';
import type { SessionClient } from '../clients';
import type { UnauthenticatedError, UnexpectedError } from '../errors';
/**
* @deprecated Use `fetchBalancesBulk` instead.
*
* Fetch balances for the authenticated Account.
*
* ```ts
* const result = await fetchBalancesBulk(sessionClient, {
* includeNative: true,
* tokens: [
* evmAddress("0x12345…"),
* evmAddress("0x67890…"),
* ]
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The query request.
* @returns The list of balance results.
*/
export function fetchAccountBalances(
client: SessionClient,
request: AccountBalancesRequest,
): ResultAsync<AnyAccountBalance[], UnauthenticatedError | UnexpectedError> {
return client.query(AccountBalancesQuery, { request });
}
/**
* Fetch balances for the provided addresses. Needs to be authenticated to execute.
*
* ```ts
* const result = await fetchBalancesBulk(anyClient, {
* address: evmAddress("0x12345…"),
* includeNative: true,
* tokens: [
* evmAddress("0x45678…"),
* evmAddress("0x90123…"),
* ],
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The query request.
* @returns The list of balance results for the provided addresses.
*/
export function fetchBalancesBulk(
client: SessionClient,
request: BalancesBulkRequest,
): ResultAsync<AnyBalance[], UnauthenticatedError | UnexpectedError> {
return client.query(BalancesBulkQuery, { request });
}
/**
* Withdraw funds from the authenticated Account.
*
* ```ts
* const result = await withdraw(sessionClient, {
* native: bigDecimal(42.5),
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function withdraw(
sessionClient: SessionClient,
request: WithdrawRequest,
): ResultAsync<WithdrawResult, UnexpectedError | UnauthenticatedError> {
return sessionClient.mutation(WithdrawMutation, { request });
}
/**
* Deposit funds into the authenticated Account.
*
* ```ts
* const result = await deposit(sessionClient, {
* native: bigDecimal(42.5),
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function deposit(
sessionClient: SessionClient,
request: DepositRequest,
): ResultAsync<DepositResult, UnexpectedError | UnauthenticatedError> {
return sessionClient.mutation(DepositMutation, { request });
}
/**
* Convert native tokens held in the authenticated Lens Account to their ERC20 equivalent. For example:
* - Mainnet: GHO -> WGHO
* - Testnet: GRASS -> WGRASS
*
* ```ts
* const result = await wrapTokens(sessionClient, {
* amount: bigDecimal(42.5),
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function wrapTokens(
sessionClient: SessionClient,
request: WrapTokensRequest,
): ResultAsync<WrapTokensResult, UnexpectedError | UnauthenticatedError> {
return sessionClient.mutation(WrapTokensMutation, { request });
}
/**
* Unwrap wrapped native tokens held in the authenticated Lens Account. For example:
* - Mainnet: WGHO -> GHO
* - Testnet: WGRASS -> GRASS
*
* ```ts
* const result = await unwrapTokens(sessionClient, {
* amount: bigDecimal(42.5),
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function unwrapTokens(
sessionClient: SessionClient,
request: UnwrapTokensRequest,
): ResultAsync<UnwrapTokensResult, UnexpectedError | UnauthenticatedError> {
return sessionClient.mutation(UnwrapTokensMutation, { request });
}
================================================
FILE: packages/client/src/actions/graph.ts
================================================
import type {
CreateGraphRequest,
CreateGraphResult,
Graph,
GraphRequest,
GraphsRequest,
Paginated,
SetGraphMetadataRequest,
SetGraphMetadataResult,
UpdateGraphRulesRequest,
UpdateGraphRulesResult,
} from '@lens-protocol/graphql';
import {
CreateGraphMutation,
GraphQuery,
GraphsQuery,
SetGraphMetadataMutation,
UpdateGraphRulesMutation,
} from '@lens-protocol/graphql';
import type { ResultAsync } from '@lens-protocol/types';
import type { AnyClient, SessionClient } from '../clients';
import type { UnauthenticatedError, UnexpectedError } from '../errors';
/**
* Create a Graph
*
* ```ts
* const result = await createGraph(sessionClient);
* ```
*
* @param client - The session client logged in as a builder.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function createGraph(
client: SessionClient,
request: CreateGraphRequest,
): ResultAsync<CreateGraphResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(CreateGraphMutation, { request });
}
/**
* Set Graph Metadata
*
* ```ts
* const result = await setGraphMetadata(sessionClient, {
* graph: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* metadataUri: uri("lens://4f91..."),
* });
* ```
*
* @param client - The session client logged in as a builder.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function setGraphMetadata(
client: SessionClient,
request: SetGraphMetadataRequest,
): ResultAsync<SetGraphMetadataResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(SetGraphMetadataMutation, { request });
}
/**
* Fetch a Graph.
*
* ```ts
* const result = await fetchGraph(anyClient, {
* graph: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - Any Lens client.
* @param request - The Graph query request.
* @returns The Graph or `null` if it does not exist.
*/
export function fetchGraph(
client: AnyClient,
request: GraphRequest,
): ResultAsync<Graph | null, UnexpectedError> {
return client.query(GraphQuery, { request });
}
/**
* Fetch Graphs.
*
* ```ts
* const result = await fetchGraphs(anyClient, {
* filter: {
* managedBy: {
* address: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5')
* }
* },
* });
* ```
*
* @param client - Any Lens client.
* @param request - The Graphs query request.
* @returns The list of Graphs or empty list if none exist.
*/
export function fetchGraphs(
client: AnyClient,
request: GraphsRequest,
): ResultAsync<Paginated<Graph>, UnexpectedError> {
return client.query(GraphsQuery, { request });
}
/**
* Update graph rules.
*
* ```ts
* const result = await updateGraphRules(sessionClient, {
* graph: evmAddress('0x1234…'),
* toAdd: {
* required: [{
* tokenGatedRule: {
* standard: TokenStandard.Erc20,
* currency: evmAddress('0x5678…'),
* value: '1.5', // Token value in its main unit
* }
* }],
* anyOf: [],
* }
* });
* ```
*
* @param client - The session client.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function updateGraphRules(
client: SessionClient,
request: UpdateGraphRulesRequest,
): ResultAsync<UpdateGraphRulesResult, UnauthenticatedError | UnexpectedError> {
return client.mutation(UpdateGraphRulesMutation, { request });
}
================================================
FILE: packages/client/src/actions/group.e2e.ts
================================================
import type { EvmAddress } from '@lens-chain/storage-client';
import { group } from '@lens-protocol/metadata';
import { assertOk, nonNullable, uri } from '@lens-protocol/types';
import { beforeAll, describe, expect, it } from 'vitest';
import {
loginAsAccountOwner,
loginAsBuilder,
TEST_ACCOUNT,
wallet,
} from '../test-utils';
import { handleOperationWith } from '../viem';
import { createGroup, fetchGroup, joinGroup } from './group';
const metadata = group({
name: 'web3natives',
});
describe('Given a logged-in user', () => {
describe('When joining a Group with SimplePaymentRule in native token denomination', () => {
let groupAddress: EvmAddress;
beforeAll(async () => {
const result = await loginAsBuilder().andThen((sessionClient) =>
createGroup(sessionClient, {
metadataUri: uri(`data:application/json,${JSON.stringify(metadata)}`),
rules: {
required: [
{
simplePaymentRule: {
native: '0.01',
recipient: TEST_ACCOUNT,
},
},
],
},
})
.andThen(handleOperationWith(wallet))
.andThen(sessionClient.waitForTransaction)
.andThen((txHash) => fetchGroup(sessionClient, { txHash }))
.map(nonNullable),
);
assertOk(result);
groupAddress = result.value.address;
}, 15_000);
it('Then the user can join the Group by fulfilling the payment rule with native tokens from the Lens Account', async () => {
const result = await loginAsAccountOwner().andThen((sessionClient) =>
joinGroup(sessionClient, {
group: groupAddress,
})
.andThen(handleOperationWith(wallet))
.andThen(sessionClient.waitForTransaction)
.andThen(() =>
fetchGroup(sessionClient, { group: groupAddress }).map(nonNullable),
),
);
assertOk(result);
expect(result.value.operations?.isMember).toBe(true);
});
});
});
================================================
FILE: packages/client/src/actions/group.ts
================================================
import type {
ApproveGroupMembershipRequest,
ApproveGroupMembershipResult,
BanGroupAccountsRequest,
BanGroupAccountsResult,
CancelGroupMembershipRequestRequest,
CancelGroupMembershipRequestResult,
CreateGroupRequest,
CreateGroupResult,
Group,
GroupBannedAccount,
GroupBannedAccountsRequest,
GroupMember,
GroupMembershipRequest,
GroupMembershipRequestsRequest,
GroupMembersRequest,
GroupRequest,
GroupStatsRequest,
GroupStatsResponse,
GroupsRequest,
JoinGroupRequest,
JoinGroupResult,
LeaveGroupRequest,
LeaveGroupResult,
Paginated,
RejectGroupMembershipRequest,
RejectGroupMembershipResult,
RemoveGroupMembersRequest,
RemoveGroupMembersResult,
RequestGroupMembershipRequest,
RequestGroupMembershipResult,
SetGroupMetadataRequest,
SetGroupMetadataResult,
UnbanGroupAccountsRequest,
UnbanGroupAccountsResult,
UpdateGroupRulesRequest,
UpdateGroupRulesResult,
} from '@lens-protocol/graphql';
import {
ApproveGroupMembershipRequestsMutation,
BanGroupAccountsMutation,
CancelGroupMembershipRequestMutation,
CreateGroupMutation,
GroupBannedAccountsQuery,
GroupMembershipRequestsQuery,
GroupMembersQuery,
GroupQuery,
GroupStatsQuery,
GroupsQuery,
JoinGroupMutation,
LeaveGroupMutation,
RejectGroupMembershipRequestsMutation,
RemoveGroupMembersMutation,
RequestGroupMembershipMutation,
SetGroupMetadataMutation,
UnbanGroupAccountsMutation,
UpdateGroupRulesMutation,
} from '@lens-protocol/graphql';
import type { ResultAsync } from '@lens-protocol/types';
import type { AnyClient, SessionClient } from '../clients';
import type { UnauthenticatedError, UnexpectedError } from '../errors';
/**
* Create a Group
*
* ```ts
* const result = await createGroup(sessionClient, {
* metadataUri: uri("lens://4f91..."),
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function createGroup(
client: SessionClient,
request: CreateGroupRequest,
): ResultAsync<CreateGroupResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(CreateGroupMutation, { request });
}
/**
* Set Group Metadata
*
* ```ts
* const result = await setGroupMetadata(sessionClient, {
* group: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* metadataUri: uri("lens://4f91..."),
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function setGroupMetadata(
client: SessionClient,
request: SetGroupMetadataRequest,
): ResultAsync<SetGroupMetadataResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(SetGroupMetadataMutation, { request });
}
/**
* Join a Group
*
* ```ts
* const result = await joinGroup(sessionClient, {
* group: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function joinGroup(
client: SessionClient,
request: JoinGroupRequest,
): ResultAsync<JoinGroupResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(JoinGroupMutation, { request });
}
/**
* Leave a Group
*
* ```ts
* const result = await leaveGroup(sessionClient, {
* group: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function leaveGroup(
client: SessionClient,
request: LeaveGroupRequest,
): ResultAsync<LeaveGroupResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(LeaveGroupMutation, { request });
}
/**
* Fetch a Group.
*
* ```ts
* const result = await fetchGroup(anyClient, {
* group: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - Any Lens client.
* @param request - The query request.
* @returns The Group or `null` if it does not exist.
*/
export function fetchGroup(
client: AnyClient,
request: GroupRequest,
): ResultAsync<Group | null, UnexpectedError> {
return client.query(GroupQuery, { request });
}
/**
* Fetch groups.
*
* ```ts
* const result = await fetchGroups(anyClient);
* ```
*
* @param client - Any Lens client.
* @param request - The query request.
* @returns The list of groups.
*/
export function fetchGroups(
client: AnyClient,
request: GroupsRequest = {},
): ResultAsync<Paginated<Group>, UnexpectedError> {
return client.query(GroupsQuery, { request });
}
/**
* Fetch group members.
*
* ```ts
* const result = await fetchGroupMembers(anyClient, {
* group: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - Any Lens client.
* @param request - The query request.
* @returns The list of members for the group.
*/
export function fetchGroupMembers(
client: AnyClient,
request: GroupMembersRequest,
): ResultAsync<Paginated<GroupMember>, UnexpectedError> {
return client.query(GroupMembersQuery, { request });
}
/**
* Fetch stats for a group.
*
* ```ts
* const result = await fetchGroupStats(anyClient, {
* group: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - Any Lens client.
* @param request - The query request.
* @returns The stats for the group.
*/
export function fetchGroupStats(
client: AnyClient,
request: GroupStatsRequest,
): ResultAsync<GroupStatsResponse | null, UnexpectedError> {
return client.query(GroupStatsQuery, { request });
}
/**
* Fetch banned accounts for a group.
*
* ```ts
* const result = await fetchGroupBannedAccounts(anyClient, {
* group: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - Any Lens client.
* @param request - The query request.
* @returns The list of banned accounts for the group.
*/
export function fetchGroupBannedAccounts(
client: AnyClient,
request: GroupBannedAccountsRequest,
): ResultAsync<Paginated<GroupBannedAccount>, UnexpectedError> {
return client.query(GroupBannedAccountsQuery, { request });
}
/**
* Fetch membership requests for a group (only admin/owner).
*
* ```ts
* const result = await fetchGroupMembershipRequests(sessionClient, {
* group: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The query request.
* @returns The list of membership requests for the group.
*/
export function fetchGroupMembershipRequests(
client: SessionClient,
request: GroupMembershipRequestsRequest,
): ResultAsync<Paginated<GroupMembershipRequest>, UnexpectedError> {
return client.query(GroupMembershipRequestsQuery, { request });
}
/**
* Update group rules.
*
* ```ts
* const result = await updateGroupRules(sessionClient, {
* group: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* toAdd: {
* required: [{
* membershipApprovalRule: {
* enable: true
* }
* }]
* anyOf: [],
* }
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function updateGroupRules(
client: SessionClient,
request: UpdateGroupRulesRequest,
): ResultAsync<UpdateGroupRulesResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(UpdateGroupRulesMutation, { request });
}
/**
* Approve group membership requests.
*
* ```ts
* const result = await approveGroupMembershipRequests(sessionClient, {
* group: evmAddress('0xe2f2…'),
* accounts: [evmAddress('0x4f91…'), evmAddress('0x4f92…')],
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function approveGroupMembershipRequests(
client: SessionClient,
request: ApproveGroupMembershipRequest,
): ResultAsync<
ApproveGroupMembershipResult,
UnexpectedError | UnauthenticatedError
> {
return client.mutation(ApproveGroupMembershipRequestsMutation, { request });
}
/**
* Remove account from a group.
*
* ```ts
* const result = await removeGroupMembers(sessionClient, {
* group: evmAddress('0xe2f…'),
* accounts: [evmAddress('0x4f91…'), evmAddress('0x4f92…')],
* ban: true, // contextually bans the accounts from rejoining
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function removeGroupMembers(
client: SessionClient,
request: RemoveGroupMembersRequest,
): ResultAsync<
RemoveGroupMembersResult,
UnexpectedError | UnauthenticatedError
> {
return client.mutation(RemoveGroupMembersMutation, { request });
}
/**
* Request membership for a group.
*
* ```ts
* const result = await requestGroupMembership(sessionClient, {
* group: evmAddress('0xe2f…'),
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function requestGroupMembership(
client: SessionClient,
request: RequestGroupMembershipRequest,
): ResultAsync<
RequestGroupMembershipResult,
UnexpectedError | UnauthenticatedError
> {
return client.mutation(RequestGroupMembershipMutation, { request });
}
/**
* Cancel and existing request to be part of a group.
*
* ```ts
* const result = await cancelGroupMembershipRequest(sessionClient, {
* group: evmAddress('0xe2f…'),
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function cancelGroupMembershipRequest(
client: SessionClient,
request: CancelGroupMembershipRequestRequest,
): ResultAsync<
CancelGroupMembershipRequestResult,
UnexpectedError | UnauthenticatedError
> {
return client.mutation(CancelGroupMembershipRequestMutation, { request });
}
/**
* Reject group membership requests.
*
* You must be the owner or admin of the group to reject membership requests.
*
* ```ts
* const result = await rejectGroupMembershipRequests(sessionClient, {
* group: evmAddress('0xe2f…'),
* accounts: [evmAddress('0x4f91…'), evmAddress('0x4f92…')],
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function rejectGroupMembershipRequests(
client: SessionClient,
request: RejectGroupMembershipRequest,
): ResultAsync<
RejectGroupMembershipResult,
UnexpectedError | UnauthenticatedError
> {
return client.mutation(RejectGroupMembershipRequestsMutation, { request });
}
/**
* Ban accounts from a group. These accounts will not be able to join the group.
*
* You must be the owner or admin of the group to ban accounts.
*
* ```ts
* const result = await banGroupAccount(sessionClient, {
* group: evmAddress('0xe2f…'),
* accounts: [evmAddress('0x4f91…'), evmAddress('0x4f92…')],
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function banGroupAccounts(
client: SessionClient,
request: BanGroupAccountsRequest,
): ResultAsync<BanGroupAccountsResult, UnexpectedError | UnauthenticatedError> {
return client.mutation(BanGroupAccountsMutation, { request });
}
/**
* Unban accounts from a group.
*
* You must be the owner or admin of the group to unban accounts.
*
* ```ts
* const result = await unbanGroupAccounts(sessionClient, {
* group: evmAddress('0xe2f…'),
* accounts: [evmAddress('0x4f91…'), evmAddress('0x4f92…')],
* });
* ```
*
* @param client - The session client for the authenticated Account.
* @param request - The mutation request.
* @returns Tiered transaction result.
*/
export function unbanGroupAccounts(
client: SessionClient,
request: UnbanGroupAccountsRequest,
): ResultAsync<
UnbanGroupAccountsResult,
UnexpectedError | UnauthenticatedError
> {
return client.mutation(UnbanGroupAccountsMutation, { request });
}
================================================
FILE: packages/client/src/actions/helpers.ts
================================================
import { InvariantError } from '@lens-chain/storage-client';
import type {
AnyAccountBalance,
Erc20Amount,
NativeAmount,
} from '@lens-protocol/graphql';
import { type EvmAddress, err, ok, type Result } from '@lens-protocol/types';
import { UnexpectedError } from '../errors';
/**
* Given a list of account balances, find the native amount.
*
* @experimental This function is subject to change.
* @param balances - A list of account balances as returned by the {@link fetchAccountBalances} action.
* @returns The native amount.
*/
export function findNativeAmount(
balances: AnyAccountBalance[],
): Result<NativeAmount, InvariantError | UnexpectedError> {
for (const entry of balances) {
switch (entry.__typename) {
case 'NativeBalanceError':
return err(new UnexpectedError(entry.reason));
case 'NativeAmount':
return ok(entry);
}
}
return err(new InvariantError('No native balance found'));
}
/**
* Given a list of account balances, find the ERC20 entry for a given token.
*
* @experimental This function is subject to change.
* @param token - The token address.
* @param balances - A list of account balances as returned by the {@link fetchAccountBalances} action.
* @returns The ERC20 amount.
*/
export function findErc20Amount(
token: EvmAddress,
balances: AnyAccountBalance[],
): Result<Erc20Amount, InvariantError | UnexpectedError> {
for (const entry of balances) {
switch (entry.__typename) {
case 'Erc20BalanceError':
if (entry.token === token) {
return err(new UnexpectedError(entry.reason));
}
break;
case 'Erc20Amount':
if (entry.asset.contract.address === token) {
return ok(entry);
}
break;
}
}
return err(new InvariantError(`No balance found for token ${token}`));
}
================================================
FILE: packages/client/src/actions/index.ts
================================================
export * from './account';
export * from './accountManager';
export * from './actions';
export * from './admins';
export * from './app';
export * from './authentication';
export * from './feed';
export * from './follow';
export * from './frames';
export * from './funds';
export * from './graph';
export * from './group';
export * from './helpers';
export * from './metadata';
export * from './misc';
export * from './ml';
export * from './namespace';
export * from './notifications';
export * from './post';
export * from './posts';
export * from './sns';
export * from './sponsorship';
export * from './timeline';
export * from './transactions';
export * from './transfer';
export * from './username';
================================================
FILE: packages/client/src/actions/metadata.test.ts
================================================
import { justPost, type Post } from '@lens-protocol/graphql';
import { textOnly } from '@lens-protocol/metadata';
import { assertOk, nonNullable } from '@lens-protocol/types';
import { beforeAll, describe, expect, it } from 'vitest';
import {
createPublicClient,
loginAsAccountOwner,
updateTextOnlyMetadata,
uploadTextOnlyPostMetadata,
wallet,
} from '../test-utils';
import { handleOperationWith } from '../viem';
import { refreshMetadata, waitForMetadata } from './metadata';
import { post } from './post';
import { fetchPost } from './posts';
describe('Given a Lens Post', () => {
let item: Post;
beforeAll(async () => {
const resources = await uploadTextOnlyPostMetadata();
const result = await loginAsAccountOwner().andThen((sessionClient) =>
post(sessionClient, {
contentUri: resources.uri,
})
.andThen(handleOperationWith(wallet))
.andThen(sessionClient.waitForTransaction)
.andThen((tx) => fetchPost(sessionClient, { txHash: tx }))
.map(nonNullable)
.map(justPost),
);
assertOk(result);
item = result.value;
// Make sure the metadata is on IPFS before being able to edit/delete it
await resources.waitForPropagation();
}, 20_000);
describe(`When the metadata at 'contentUri' is updated`, () => {
const client = createPublicClient();
const updates = textOnly({ content: 'This is the new content' });
beforeAll(async () => {
const response = await updateTextOnlyMetadata(item.contentUri, updates);
await response.waitForPropagation();
}, 20_000);
it('Then it should be possible to force a refresh of the metadata', async () => {
const refreshed = await refreshMetadata(client, {
entity: { post: item.id },
}).andThen(({ id }) => waitForMetadata(client, id));
assertOk(refreshed);
const fetched = await fetchPost(client, { post: item.id })
.map(nonNullable)
.map(justPost);
assertOk(fetched);
expect(fetched.value.metadata).toHaveProperty(
'content',
updates.lens.content,
);
});
});
});
================================================
FILE: packages/client/src/actions/metadata.ts
================================================
import type {
RefreshMetadataRequest,
RefreshMetadataResult,
RefreshMetadataStatusRequest,
RefreshMetadataStatusResult,
} from '@lens-protocol/graphql';
import {
IndexingStatus,
RefreshMetadataMutation,
RefreshMetadataStatusQuery,
} from '@lens-protocol/graphql';
import { ResultAsync, type UUID } from '@lens-protocol/types';
import type { AnyClient } from '../clients';
import {
MetadataIndexingError,
type UnauthenticatedError,
UnexpectedError,
} from '../errors';
import { delay } from '../utils';
/**
* Fetch the indexing status of metadata.
*
* ```ts
* const result = await refreshMetadataStatus(anyClient, {
* id: uuid("a0a88a62-377f-46eb-a1ec-ca6597aef164")
* });
* ```
*
* @param client - Any Lens client.
* @param request - The query request.
* @returns The indexing status of the metadata.
*/
export function refreshMetadataStatus(
client: AnyClient,
request: RefreshMetadataStatusRequest,
): ResultAsync<RefreshMetadataStatusResult, UnexpectedError> {
return client.query(RefreshMetadataStatusQuery, { request });
}
/**
* Refresh the metadata for a given entity.
*
* ```ts
* const result = await refreshMetadata(anyClient, {
* entity: {
* post: postId('42'),
* },
* });
* ```
*
* @param client - Any Lens client.
* @param request - The mutation request.
* @returns - UUID to track the metadata refresh.
*/
export function refreshMetadata(
client: AnyClient,
request: RefreshMetadataRequest,
): ResultAsync<RefreshMetadataResult, UnauthenticatedError | UnexpectedError> {
return client.mutation(RefreshMetadataMutation, { request });
}
/**
* Given a metadata id, wait for the metadata to be either confirmed or rejected by the Lens API.
*
* @param client - Any Lens client.
* @param id - The metadata id to wait for.
* @returns The metadata id if the metadata was confirmed or an error if the transaction was rejected.
*/
export function waitForMetadata(
client: AnyClient,
id: UUID,
): ResultAsync<UUID, MetadataIndexingError | UnexpectedError> {
return ResultAsync.fromPromise(pollMetadataStatus(client, id), (err) => {
if (
err instanceof MetadataIndexingError ||
err instanceof UnexpectedError
) {
return err;
}
return UnexpectedError.from(err);
});
}
async function pollMetadataStatus(client: AnyClient, id: UUID): Promise<UUID> {
const startedAt = Date.now();
while (Date.now() - startedAt < client.context.environment.indexingTimeout) {
const result = await refreshMetadataStatus(client, { id });
if (result.isErr()) {
throw UnexpectedError.from(result.error);
}
switch (result.value.status) {
case IndexingStatus.Finished:
return result.value.id;
case IndexingStatus.Failed:
throw MetadataIndexingError.from(result.value.reason);
case IndexingStatus.Pending:
await delay(client.context.environment.pollingInterval);
break;
}
}
throw MetadataIndexingError.from(`Timeout waiting for metadata ${id}`);
}
================================================
FILE: packages/client/src/actions/misc.ts
================================================
import {
AccessControlQuery,
type AccessControlRequest,
type AccessControlResult,
HealthQuery,
type Paginated,
type TokenDistribution,
TokenDistributionsQuery,
type TokenDistributionsRequest,
} from '@lens-protocol/graphql';
import type { ResultAsync } from '@lens-protocol/types';
import type { AnyClient, SessionClient } from '../clients';
import type { UnexpectedError } from '../errors';
/**
* Health check query.
*
* ```ts
* const result = await health(anyClient);
* ```
*
* @param client - Any Lens client.
* @returns True or false
*/
export function health(
client: AnyClient,
): ResultAsync<boolean, UnexpectedError> {
return client.query(HealthQuery, {});
}
/**
* Fetch an Access Control details.
*
* ```ts
* const result = await fetchAccessControl(anyClient, {
* address: evmAddress('0xe2f2a5C287993345a840db3B0845fbc70f5935a5'),
* });
* ```
*
* @param client - Any Lens client.
* @param request - The Access Control query request.
* @returns The Access Control or `null` if it does not exist.
*/
export function fetchAccessControl(
client: AnyClient,
request: AccessControlRequest,
): ResultAsync<AccessControlResult | null, UnexpectedError> {
return client.query(AccessControlQuery, { request });
}
/**
* Fetch list of token distributions received by the authenticated account.
*
* ```ts
* const result = await fetchTokenDistributions(sessionClient);
* ```
*
* @param client - Lens SessionClient.
* @param request - The query request.
* @returns List of token distributions for the authenticated account was rewarded with.
*/
export function fetchTokenDistributions(
client: SessionClient,
request: TokenDistributionsRequest = {},
): ResultAsync<Paginated<TokenDistribution>, UnexpectedError> {
return client.query(TokenDistributionsQuery, { request });
}
================================================
FILE: packages/client/src/actions/ml.e2e.ts
================================================
import { assertOk } from '@lens-protocol/types';
import { beforeAll, describe, it } from 'vitest';
import type { SessionClient } from '../clients';
import { loginAsAccountOwner, TEST_ACCOUNT } from '../test-utils';
import {
fetchAccountRecommendations,
fetchPostsForYou,
fetchPostsToExplore,
} from './ml';
describe('Given the ML query actions', () => {
let sessionClient: SessionClient;
beforeAll(async () => {
await loginAsAccountOwner().andTee((client) => {
gitextract_d8sflke8/ ├── .changeset/ │ ├── README.md │ ├── config.json │ ├── giant-buckets-melt.md │ ├── nice-baboons-protect.md │ └── pre.json ├── .editorconfig ├── .github/ │ ├── actions/ │ │ ├── setup/ │ │ │ └── action.yml │ │ └── tests/ │ │ └── action.yml │ └── workflows/ │ ├── dependency-review.yml │ ├── pull-request.yml │ ├── snapshot.yml │ ├── trigger-tests.yml │ └── verify.yml ├── .gitignore ├── .npmrc ├── .nvmrc ├── .prettierignore ├── .vscode/ │ └── settings.json ├── LICENSE ├── README.md ├── biome.json ├── examples/ │ ├── create-app/ │ │ ├── README.md │ │ ├── index.html │ │ ├── index.ts │ │ ├── package.json │ │ └── tsconfig.json │ ├── custom-fragments/ │ │ ├── README.md │ │ ├── index.html │ │ ├── index.ts │ │ ├── package.json │ │ └── tsconfig.json │ ├── nextjs-client/ │ │ ├── .gitignore │ │ ├── .stackblitzrc │ │ ├── README.md │ │ ├── next.config.ts │ │ ├── package.json │ │ ├── src/ │ │ │ └── app/ │ │ │ ├── Web3Providers.tsx │ │ │ ├── client.ts │ │ │ ├── globals.css │ │ │ ├── layout.tsx │ │ │ └── page.tsx │ │ └── tsconfig.json │ ├── react-follow/ │ │ ├── README.md │ │ ├── index.html │ │ ├── package.json │ │ ├── src/ │ │ │ ├── AccountToFollow.tsx │ │ │ ├── App.tsx │ │ │ ├── FollowButton.tsx │ │ │ ├── Web3Providers.tsx │ │ │ ├── client.ts │ │ │ ├── config.ts │ │ │ ├── main.tsx │ │ │ ├── vite-env.d.ts │ │ │ └── wallet.ts │ │ ├── tsconfig.json │ │ └── vite.config.ts │ ├── react-login/ │ │ ├── README.md │ │ ├── index.html │ │ ├── package.json │ │ ├── src/ │ │ │ ├── App.tsx │ │ │ ├── LoginForm.tsx │ │ │ ├── LogoutButton.tsx │ │ │ ├── MyAccount.tsx │ │ │ ├── Web3Providers.tsx │ │ │ ├── client.ts │ │ │ ├── config.ts │ │ │ ├── main.tsx │ │ │ └── vite-env.d.ts │ │ ├── tsconfig.json │ │ └── vite.config.ts │ ├── react-post/ │ │ ├── README.md │ │ ├── index.html │ │ ├── package.json │ │ ├── src/ │ │ │ ├── App.tsx │ │ │ ├── client.ts │ │ │ ├── config.ts │ │ │ ├── main.tsx │ │ │ ├── vite-env.d.ts │ │ │ └── wallet.ts │ │ ├── tsconfig.json │ │ └── vite.config.ts │ ├── react-post-action/ │ │ ├── README.md │ │ ├── index.html │ │ ├── package.json │ │ ├── src/ │ │ │ ├── App.tsx │ │ │ ├── client.ts │ │ │ ├── config.ts │ │ │ ├── main.tsx │ │ │ ├── vite-env.d.ts │ │ │ └── wallet.ts │ │ ├── tsconfig.json │ │ └── vite.config.ts │ ├── sponsored-tx/ │ │ ├── .stackblitzrc │ │ ├── README.md │ │ ├── index.ts │ │ ├── package.json │ │ └── tsconfig.json │ ├── sponsored-tx-poc/ │ │ ├── README.md │ │ ├── index.html │ │ ├── index.ts │ │ ├── package.json │ │ └── tsconfig.json │ ├── thirdweb-onramp/ │ │ ├── README.md │ │ ├── index.html │ │ ├── package.json │ │ ├── src/ │ │ │ ├── App.tsx │ │ │ └── main.tsx │ │ ├── tsconfig.json │ │ └── vite.config.ts │ └── user-onboarding/ │ ├── README.md │ ├── index.html │ ├── index.ts │ ├── package.json │ └── tsconfig.json ├── jest-extended.d.ts ├── package.json ├── packages/ │ ├── client/ │ │ ├── CHANGELOG.md │ │ ├── README.md │ │ ├── package.json │ │ ├── src/ │ │ │ ├── AuthenticatedUser.ts │ │ │ ├── actions/ │ │ │ │ ├── account.test.ts │ │ │ │ ├── account.ts │ │ │ │ ├── accountManager.test.ts │ │ │ │ ├── accountManager.ts │ │ │ │ ├── actions.ts │ │ │ │ ├── admins.ts │ │ │ │ ├── app.ts │ │ │ │ ├── authentication.ts │ │ │ │ ├── feed.ts │ │ │ │ ├── follow.ts │ │ │ │ ├── frames.ts │ │ │ │ ├── funds.e2e.ts │ │ │ │ ├── funds.ts │ │ │ │ ├── graph.ts │ │ │ │ ├── group.e2e.ts │ │ │ │ ├── group.ts │ │ │ │ ├── helpers.ts │ │ │ │ ├── index.ts │ │ │ │ ├── metadata.test.ts │ │ │ │ ├── metadata.ts │ │ │ │ ├── misc.ts │ │ │ │ ├── ml.e2e.ts │ │ │ │ ├── ml.ts │ │ │ │ ├── namespace.ts │ │ │ │ ├── notifications.test.ts │ │ │ │ ├── notifications.ts │ │ │ │ ├── onboarding.e2e.ts │ │ │ │ ├── post.test.ts │ │ │ │ ├── post.ts │ │ │ │ ├── posts.test.ts │ │ │ │ ├── posts.ts │ │ │ │ ├── sns.ts │ │ │ │ ├── sponsorship.ts │ │ │ │ ├── timeline.ts │ │ │ │ ├── tipping.e2e.ts │ │ │ │ ├── transactions.ts │ │ │ │ ├── transfer.ts │ │ │ │ └── username.ts │ │ │ ├── authorization.ts │ │ │ ├── batch.ts │ │ │ ├── cache.ts │ │ │ ├── clients.test.ts │ │ │ ├── clients.ts │ │ │ ├── config.ts │ │ │ ├── context.ts │ │ │ ├── crossRegion.e2e.ts │ │ │ ├── errors.ts │ │ │ ├── ethers/ │ │ │ │ ├── __snapshots__/ │ │ │ │ │ └── encoding.test.ts.snap │ │ │ │ ├── encoding.test.ts │ │ │ │ ├── encoding.ts │ │ │ │ ├── index.ts │ │ │ │ ├── signer.test.ts │ │ │ │ ├── signer.ts │ │ │ │ ├── sponsorship.test.ts │ │ │ │ └── sponsorship.ts │ │ │ ├── fragments.test.ts │ │ │ ├── fragments.ts │ │ │ ├── index.ts │ │ │ ├── logger.ts │ │ │ ├── sponsorship.ts │ │ │ ├── test-utils.ts │ │ │ ├── tokens.ts │ │ │ ├── types.ts │ │ │ ├── utils.ts │ │ │ └── viem/ │ │ │ ├── __snapshots__/ │ │ │ │ └── encoding.test.ts.snap │ │ │ ├── authorization.test.ts │ │ │ ├── authorization.ts │ │ │ ├── encoding.test.ts │ │ │ ├── encoding.ts │ │ │ ├── index.ts │ │ │ ├── signer.test.ts │ │ │ ├── signer.ts │ │ │ ├── sponsorship.test.ts │ │ │ ├── sponsorship.ts │ │ │ └── types.ts │ │ ├── tsconfig.build.json │ │ ├── tsconfig.json │ │ └── tsup.config.ts │ ├── env/ │ │ ├── CHANGELOG.md │ │ ├── README.md │ │ ├── package.json │ │ ├── src/ │ │ │ └── index.ts │ │ ├── tsconfig.build.json │ │ ├── tsconfig.json │ │ └── tsup.config.ts │ ├── graphql/ │ │ ├── .gitignore │ │ ├── CHANGELOG.md │ │ ├── README.md │ │ ├── package.json │ │ ├── schema.d.ts │ │ ├── schema.graphql │ │ ├── scripts/ │ │ │ └── fetch-schema.ts │ │ ├── src/ │ │ │ ├── accounts/ │ │ │ │ ├── account.ts │ │ │ │ ├── index.ts │ │ │ │ ├── managers.ts │ │ │ │ └── signless.ts │ │ │ ├── actions.ts │ │ │ ├── admins.ts │ │ │ ├── app.ts │ │ │ ├── authentication.ts │ │ │ ├── common.ts │ │ │ ├── enums.ts │ │ │ ├── feed.ts │ │ │ ├── follow.ts │ │ │ ├── fragments/ │ │ │ │ ├── account.ts │ │ │ │ ├── common.ts │ │ │ │ ├── index.ts │ │ │ │ ├── media.ts │ │ │ │ ├── metadata.ts │ │ │ │ ├── pagination.ts │ │ │ │ ├── post.ts │ │ │ │ ├── primitives.ts │ │ │ │ ├── transactions.ts │ │ │ │ └── username.ts │ │ │ ├── frames.ts │ │ │ ├── funds.ts │ │ │ ├── graph.ts │ │ │ ├── graphql-env.d.ts │ │ │ ├── graphql.ts │ │ │ ├── group.ts │ │ │ ├── index.ts │ │ │ ├── metadata.ts │ │ │ ├── misc.ts │ │ │ ├── ml.ts │ │ │ ├── namespace.ts │ │ │ ├── notifications.ts │ │ │ ├── post.ts │ │ │ ├── refinements.ts │ │ │ ├── scalars.ts │ │ │ ├── schema.json │ │ │ ├── schema.ts │ │ │ ├── sns.ts │ │ │ ├── sponsorship.ts │ │ │ ├── test-utils.ts │ │ │ ├── timeline.ts │ │ │ ├── transactions.ts │ │ │ ├── transferOwnership.ts │ │ │ └── username.ts │ │ ├── tsconfig.build.json │ │ ├── tsconfig.json │ │ └── tsup.config.ts │ ├── react/ │ │ ├── CHANGELOG.md │ │ ├── README.md │ │ ├── package.json │ │ ├── src/ │ │ │ ├── LensProvider.tsx │ │ │ ├── account/ │ │ │ │ ├── index.ts │ │ │ │ ├── useAccount.ts │ │ │ │ ├── useAccountFeedsStats.ts │ │ │ │ ├── useAccountManagers.ts │ │ │ │ ├── useAccountStats.ts │ │ │ │ ├── useAccounts.ts │ │ │ │ ├── useAccountsBlocked.ts │ │ │ │ ├── useAccountsBulk.ts │ │ │ │ ├── useAddAccountManager.ts │ │ │ │ ├── useBalancesBulk.ts │ │ │ │ ├── useCreateAccountWithFreeUsername.ts │ │ │ │ ├── useCreateAccountWithRestrictedUsername.ts │ │ │ │ ├── useEnableSignless.ts │ │ │ │ ├── useRemoveAccountManager.ts │ │ │ │ ├── useRemoveSignless.ts │ │ │ │ ├── useSetAccountMetadata.ts │ │ │ │ └── useWhoExecutedActionOnAccount.ts │ │ │ ├── app/ │ │ │ │ ├── index.ts │ │ │ │ └── useAppUsers.ts │ │ │ ├── authentication/ │ │ │ │ ├── index.ts │ │ │ │ ├── useAccountsAvailable.ts │ │ │ │ ├── useAuthenticatedUser.test.ts │ │ │ │ ├── useAuthenticatedUser.ts │ │ │ │ ├── useLogin.test.ts │ │ │ │ ├── useLogin.ts │ │ │ │ ├── useLogout.ts │ │ │ │ ├── useMeDetails.ts │ │ │ │ ├── usePublicClient.ts │ │ │ │ ├── useSessionClient.test.ts │ │ │ │ ├── useSessionClient.ts │ │ │ │ └── useSwitchAccount.ts │ │ │ ├── context.tsx │ │ │ ├── ethers/ │ │ │ │ ├── index.ts │ │ │ │ └── useUnknownPostActionEncoder.ts │ │ │ ├── feed/ │ │ │ │ ├── index.ts │ │ │ │ ├── useFeed.ts │ │ │ │ └── useFeeds.ts │ │ │ ├── follow/ │ │ │ │ ├── index.ts │ │ │ │ ├── useFollow.ts │ │ │ │ ├── useFollowStatus.ts │ │ │ │ ├── useFollowers.ts │ │ │ │ ├── useFollowersYouKnow.ts │ │ │ │ ├── useFollowing.ts │ │ │ │ └── useUnfollow.ts │ │ │ ├── graph/ │ │ │ │ ├── index.ts │ │ │ │ └── useGraph.ts │ │ │ ├── group/ │ │ │ │ ├── index.ts │ │ │ │ ├── useGroup.ts │ │ │ │ ├── useGroupBannedAccounts.ts │ │ │ │ ├── useGroupMembers.ts │ │ │ │ ├── useGroupMembershipRequests.ts │ │ │ │ └── useGroups.ts │ │ │ ├── helpers/ │ │ │ │ ├── index.ts │ │ │ │ ├── reads.ts │ │ │ │ ├── results.ts │ │ │ │ ├── tasks.test.ts │ │ │ │ └── tasks.ts │ │ │ ├── index.ts │ │ │ ├── ml/ │ │ │ │ ├── index.ts │ │ │ │ ├── useAccountRecommendations.ts │ │ │ │ ├── useDismissRecommendedAccounts.ts │ │ │ │ ├── usePostsForYou.ts │ │ │ │ └── usePostsToExplore.ts │ │ │ ├── notification/ │ │ │ │ ├── index.ts │ │ │ │ └── useNotifications.ts │ │ │ ├── post/ │ │ │ │ ├── index.ts │ │ │ │ ├── useBookmarkPost.ts │ │ │ │ ├── useCreatePost.test.ts │ │ │ │ ├── useCreatePost.ts │ │ │ │ ├── useExecutePostAction.ts │ │ │ │ ├── usePost.ts │ │ │ │ ├── usePostBookmarks.ts │ │ │ │ ├── usePostReactions.ts │ │ │ │ ├── usePostReferences.ts │ │ │ │ ├── usePostTags.ts │ │ │ │ ├── usePosts.ts │ │ │ │ ├── useUndoBookmarkPost.ts │ │ │ │ ├── useWhoExecutedActionOnPost.ts │ │ │ │ └── useWhoReferencedPost.ts │ │ │ ├── test-utils.tsx │ │ │ ├── timeline/ │ │ │ │ ├── index.ts │ │ │ │ ├── useTimeline.ts │ │ │ │ └── useTimelineHighlights.ts │ │ │ ├── tokenDistribution/ │ │ │ │ ├── index.ts │ │ │ │ └── useTokenDistributions.ts │ │ │ ├── username/ │ │ │ │ ├── index.ts │ │ │ │ ├── useCanCreateUsername.ts │ │ │ │ ├── useNamespace.ts │ │ │ │ └── useUsernames.ts │ │ │ └── viem/ │ │ │ ├── index.ts │ │ │ └── useUnknownPostActionEncoder.ts │ │ ├── tsconfig.build.json │ │ ├── tsconfig.json │ │ ├── tsup.config.ts │ │ └── vitest.setup.ts │ ├── storage/ │ │ ├── CHANGELOG.md │ │ ├── README.md │ │ ├── package.json │ │ ├── src/ │ │ │ ├── BaseStorageSchema.ts │ │ │ ├── CredentialsStorageSchema.ts │ │ │ ├── IStorage.ts │ │ │ ├── InMemoryStorageProvider.ts │ │ │ ├── Storage.test.ts │ │ │ ├── Storage.ts │ │ │ ├── __helpers__/ │ │ │ │ └── mocks.ts │ │ │ └── index.ts │ │ ├── tsconfig.build.json │ │ ├── tsconfig.json │ │ └── tsup.config.ts │ └── types/ │ ├── CHANGELOG.md │ ├── README.md │ ├── package.json │ ├── src/ │ │ ├── errors.ts │ │ ├── helpers/ │ │ │ ├── Deferred.ts │ │ │ ├── assertions.ts │ │ │ ├── fail.ts │ │ │ ├── identity.ts │ │ │ ├── index.ts │ │ │ ├── invariant.ts │ │ │ ├── never.ts │ │ │ ├── refinements.ts │ │ │ └── typeguards.ts │ │ ├── hex.ts │ │ ├── id.ts │ │ ├── index.ts │ │ ├── jwt.ts │ │ ├── misc.ts │ │ ├── number.ts │ │ ├── tag.ts │ │ └── uri.ts │ ├── tsconfig.build.json │ ├── tsconfig.json │ └── tsup.config.ts ├── plopfile.ts ├── pnpm-workspace.yaml ├── renovate.json ├── templates/ │ ├── example-react/ │ │ ├── README.md │ │ ├── index.html │ │ ├── package.json │ │ ├── src/ │ │ │ ├── App.tsx │ │ │ ├── client.ts │ │ │ ├── main.tsx │ │ │ └── vite-env.d.ts │ │ ├── tsconfig.json │ │ └── vite.config.ts │ └── lib/ │ ├── README.md.hbs │ ├── package.json.hbs │ ├── src/ │ │ └── index.ts │ ├── tsconfig.build.json │ ├── tsconfig.json │ └── tsup.config.ts ├── tsconfig.base.json ├── tsconfig.json ├── turbo.json ├── vite-env.d.ts ├── vitest.config.ts ├── vitest.d.ts └── vitest.setup.ts
SYMBOL INDEX (1265 symbols across 203 files)
FILE: examples/custom-fragments/index.ts
type Account (line 65) | interface Account extends FragmentOf<typeof AccountFragment> {}
type PostFields (line 66) | interface PostFields extends FragmentOf<typeof PostFieldsFragment> {}
type PostMetadata (line 67) | type PostMetadata = FragmentOf<typeof PostMetadataFragment>;
FILE: examples/nextjs-client/src/app/Web3Providers.tsx
function Web3Providers (line 6) | function Web3Providers({ children }: { children: React.ReactNode }) {
FILE: examples/nextjs-client/src/app/layout.tsx
function RootLayout (line 23) | function RootLayout({
FILE: examples/nextjs-client/src/app/page.tsx
function Home (line 5) | function Home() {
FILE: examples/react-follow/src/AccountToFollow.tsx
function AccountsToFollow (line 4) | function AccountsToFollow() {
FILE: examples/react-follow/src/App.tsx
function App (line 3) | function App() {
FILE: examples/react-follow/src/FollowButton.tsx
function FollowButton (line 5) | function FollowButton({ account }: { account: Account }) {
FILE: examples/react-follow/src/Web3Providers.tsx
function Web3Providers (line 12) | function Web3Providers({ children }: { children: React.ReactNode }) {
FILE: examples/react-login/src/App.tsx
function App (line 5) | function App() {
FILE: examples/react-login/src/LoginForm.tsx
function LoginWith (line 12) | function LoginWith({
function LoginOptions (line 52) | function LoginOptions({ address }: { address: string }) {
function LoginForm (line 72) | function LoginForm() {
FILE: examples/react-login/src/LogoutButton.tsx
function LogoutButton (line 4) | function LogoutButton() {
FILE: examples/react-login/src/MyAccount.tsx
function MyAccount (line 4) | function MyAccount({ address }: { address: EvmAddress }) {
FILE: examples/react-login/src/Web3Providers.tsx
function Web3Providers (line 12) | function Web3Providers({ children }: { children: React.ReactNode }) {
FILE: examples/react-post-action/src/App.tsx
constant POST_SLUG (line 14) | const POST_SLUG = 'b84rn3awqztera37ek';
constant ACTION_ADDRESS (line 15) | const ACTION_ADDRESS = '0xE34b5bF6e385084F43F827077E49EdAa33a3c9Dd';
function App (line 17) | function App() {
FILE: examples/react-post/src/App.tsx
function App (line 6) | function App() {
FILE: examples/sponsored-tx/index.ts
type SponsorRequest (line 40) | interface SponsorRequest {
function sendSponsoredTransaction (line 46) | async function sendSponsoredTransaction({
FILE: examples/thirdweb-onramp/src/App.tsx
function App (line 36) | function App() {
FILE: jest-extended.d.ts
type Assertion (line 5) | interface Assertion<T = unknown> extends CustomMatchers<T> {}
type AsymmetricMatchersContaining (line 6) | interface AsymmetricMatchersContaining<T = unknown>
type ExpectStatic (line 8) | interface ExpectStatic extends CustomMatchers<T> {}
FILE: packages/client/src/AuthenticatedUser.ts
type AuthenticatedUser (line 13) | type AuthenticatedUser = {
function authenticatedUser (line 25) | function authenticatedUser(
FILE: packages/client/src/actions/account.ts
function fetchAccount (line 80) | function fetchAccount(
function fetchAccounts (line 100) | function fetchAccounts(
function fetchAccountsBulk (line 120) | function fetchAccountsBulk(
function fetchAccountStats (line 140) | function fetchAccountStats(
function fetchAccountFeedStats (line 160) | function fetchAccountFeedStats(
function fetchAccountGraphStats (line 180) | function fetchAccountGraphStats(
function fetchAccountsAvailable (line 200) | function fetchAccountsAvailable(
function fetchAccountsBlocked (line 218) | function fetchAccountsBlocked(
function setAccountMetadata (line 238) | function setAccountMetadata(
function createAccountWithUsername (line 264) | function createAccountWithUsername(
function createAccount (line 289) | function createAccount(
function enableSignless (line 307) | function enableSignless(
function removeSignless (line 324) | function removeSignless(
function muteAccount (line 343) | function muteAccount(
function unmuteAccount (line 363) | function unmuteAccount(
function reportAccount (line 384) | function reportAccount(
function blockAccount (line 403) | function blockAccount(
function unblockAccount (line 422) | function unblockAccount(
function recommendAccount (line 442) | function recommendAccount(
function undoRecommendAccount (line 462) | function undoRecommendAccount(
function updateAccountFollowRules (line 482) | function updateAccountFollowRules(
FILE: packages/client/src/actions/accountManager.ts
function fetchAccountManagers (line 37) | function fetchAccountManagers(
function addAccountManager (line 60) | function addAccountManager(
function removeAccountManager (line 96) | function removeAccountManager(
function updateAccountManager (line 125) | function updateAccountManager(
function hideManagedAccount (line 148) | function hideManagedAccount(
function unhideManagedAccount (line 168) | function unhideManagedAccount(
FILE: packages/client/src/actions/actions.ts
function configurePostAction (line 57) | function configurePostAction(
function enablePostAction (line 81) | function enablePostAction(
function disablePostAction (line 102) | function disablePostAction(
function executePostAction (line 130) | function executePostAction(
function configureAccountAction (line 163) | function configureAccountAction(
function enableAccountAction (line 193) | function enableAccountAction(
function disableAccountAction (line 219) | function disableAccountAction(
function executeAccountAction (line 248) | function executeAccountAction(
FILE: packages/client/src/actions/admins.ts
function addAdmins (line 33) | function addAdmins(
function removeAdmins (line 54) | function removeAdmins(
function fetchAdminsFor (line 74) | function fetchAdminsFor(
FILE: packages/client/src/actions/app.ts
function fetchApp (line 94) | function fetchApp(
function fetchApps (line 118) | function fetchApps(
function fetchAppGroups (line 138) | function fetchAppGroups(
function fetchAppFeeds (line 158) | function fetchAppFeeds(
function fetchAppSigners (line 178) | function fetchAppSigners(
function fetchAppUsers (line 198) | function fetchAppUsers(
function createApp (line 226) | function createApp(
function addAppFeeds (line 247) | function addAppFeeds(
function addAppGroups (line 268) | function addAppGroups(
function addAppSigners (line 289) | function addAppSigners(
function removeAppFeeds (line 310) | function removeAppFeeds(
function removeAppGroups (line 331) | function removeAppGroups(
function removeAppSigners (line 352) | function removeAppSigners(
function setAppGraph (line 373) | function setAppGraph(
function setDefaultAppFeed (line 394) | function setDefaultAppFeed(
function setAppMetadata (line 418) | function setAppMetadata(
function setAppVerification (line 439) | function setAppVerification(
function setAppSponsorship (line 463) | function setAppSponsorship(
function setAppTreasury (line 487) | function setAppTreasury(
function setAppUsernameNamespace (line 510) | function setAppUsernameNamespace(
function addAppAuthorizationEndpoint (line 535) | function addAppAuthorizationEndpoint(
function removeAppAuthorizationEndpoint (line 558) | function removeAppAuthorizationEndpoint(
function fetchAppServerAPiKey (line 576) | function fetchAppServerAPiKey(
function generateNewAppServerApiKey (line 592) | function generateNewAppServerApiKey(
FILE: packages/client/src/actions/authentication.ts
function currentSession (line 40) | function currentSession(
function revokeAuthentication (line 62) | function revokeAuthentication(
function refresh (line 82) | function refresh(
function fetchAuthenticatedSessions (line 100) | function fetchAuthenticatedSessions(
function legacyRolloverRefresh (line 127) | function legacyRolloverRefresh(
function switchAccount (line 144) | function switchAccount(
function fetchMeDetails (line 157) | function fetchMeDetails(
function lastLoggedInAccount (line 176) | function lastLoggedInAccount(
FILE: packages/client/src/actions/feed.ts
function createFeed (line 36) | function createFeed(
function setFeedMetadata (line 57) | function setFeedMetadata(
function fetchFeed (line 77) | function fetchFeed(
function fetchFeeds (line 101) | function fetchFeeds(
function updateFeedRules (line 131) | function updateFeedRules(
FILE: packages/client/src/actions/follow.ts
function follow (line 40) | function follow(
function unfollow (line 60) | function unfollow(
function fetchFollowers (line 80) | function fetchFollowers(
function fetchFollowing (line 100) | function fetchFollowing(
function fetchFollowersYouKnow (line 121) | function fetchFollowersYouKnow(
function fetchFollowStatus (line 146) | function fetchFollowStatus(
FILE: packages/client/src/actions/frames.ts
function createFrameTypedData (line 41) | function createFrameTypedData(
function signFrameAction (line 72) | function signFrameAction(
function verifyFrameSignature (line 98) | function verifyFrameSignature(
FILE: packages/client/src/actions/funds.e2e.ts
function fetchBalances (line 25) | async function fetchBalances(
function retryBalanceCheck (line 43) | async function retryBalanceCheck(
FILE: packages/client/src/actions/funds.ts
function fetchAccountBalances (line 47) | function fetchAccountBalances(
function fetchBalancesBulk (line 72) | function fetchBalancesBulk(
function withdraw (line 92) | function withdraw(
function deposit (line 112) | function deposit(
function wrapTokens (line 134) | function wrapTokens(
function unwrapTokens (line 156) | function unwrapTokens(
FILE: packages/client/src/actions/graph.ts
function createGraph (line 36) | function createGraph(
function setGraphMetadata (line 57) | function setGraphMetadata(
function fetchGraph (line 77) | function fetchGraph(
function fetchGraphs (line 101) | function fetchGraphs(
function updateGraphRules (line 131) | function updateGraphRules(
FILE: packages/client/src/actions/group.ts
function createGroup (line 77) | function createGroup(
function setGroupMetadata (line 98) | function setGroupMetadata(
function joinGroup (line 118) | function joinGroup(
function leaveGroup (line 138) | function leaveGroup(
function fetchGroup (line 158) | function fetchGroup(
function fetchGroups (line 176) | function fetchGroups(
function fetchGroupMembers (line 196) | function fetchGroupMembers(
function fetchGroupStats (line 216) | function fetchGroupStats(
function fetchGroupBannedAccounts (line 236) | function fetchGroupBannedAccounts(
function fetchGroupMembershipRequests (line 256) | function fetchGroupMembershipRequests(
function updateGroupRules (line 284) | function updateGroupRules(
function approveGroupMembershipRequests (line 305) | function approveGroupMembershipRequests(
function removeGroupMembers (line 330) | function removeGroupMembers(
function requestGroupMembership (line 353) | function requestGroupMembership(
function cancelGroupMembershipRequest (line 376) | function cancelGroupMembershipRequest(
function rejectGroupMembershipRequests (line 402) | function rejectGroupMembershipRequests(
function banGroupAccounts (line 428) | function banGroupAccounts(
function unbanGroupAccounts (line 451) | function unbanGroupAccounts(
FILE: packages/client/src/actions/helpers.ts
function findNativeAmount (line 17) | function findNativeAmount(
function findErc20Amount (line 39) | function findErc20Amount(
FILE: packages/client/src/actions/metadata.ts
function refreshMetadataStatus (line 35) | function refreshMetadataStatus(
function refreshMetadata (line 57) | function refreshMetadata(
function waitForMetadata (line 71) | function waitForMetadata(
function pollMetadataStatus (line 86) | async function pollMetadataStatus(client: AnyClient, id: UUID): Promise<...
FILE: packages/client/src/actions/misc.ts
function health (line 25) | function health(
function fetchAccessControl (line 44) | function fetchAccessControl(
function fetchTokenDistributions (line 62) | function fetchTokenDistributions(
FILE: packages/client/src/actions/ml.ts
function fetchAccountRecommendations (line 38) | function fetchAccountRecommendations(
function fetchPostsForYou (line 58) | function fetchPostsForYou(
function fetchPostsToExplore (line 76) | function fetchPostsToExplore(
function dismissRecommendedAccounts (line 96) | function dismissRecommendedAccounts(
function addPostNotInterested (line 116) | function addPostNotInterested(
function undoPostNotInterested (line 136) | function undoPostNotInterested(
FILE: packages/client/src/actions/namespace.ts
function createUsernameNamespace (line 45) | function createUsernameNamespace(
function setNamespaceMetadata (line 69) | function setNamespaceMetadata(
function fetchNamespace (line 92) | function fetchNamespace(
function fetchNamespaces (line 116) | function fetchNamespaces(
function updateNamespaceRules (line 146) | function updateNamespaceRules(
function updateReservedUsernames (line 171) | function updateReservedUsernames(
function fetchNamespaceReservedUsernames (line 194) | function fetchNamespaceReservedUsernames(
FILE: packages/client/src/actions/notifications.ts
function fetchNotifications (line 23) | function fetchNotifications(
FILE: packages/client/src/actions/post.ts
function post (line 51) | function post(
function repost (line 71) | function repost(
function editPost (line 92) | function editPost(
function deletePost (line 112) | function deletePost(
function addReaction (line 133) | function addReaction(
function undoReaction (line 154) | function undoReaction(
function bookmarkPost (line 174) | function bookmarkPost(
function undoBookmarkPost (line 194) | function undoBookmarkPost(
function hideReply (line 214) | function hideReply(
function unhideReply (line 234) | function unhideReply(
function reportPost (line 255) | function reportPost(
function updatePostRules (line 283) | function updatePostRules(
FILE: packages/client/src/actions/posts.ts
function fetchPost (line 59) | function fetchPost(
function fetchPosts (line 84) | function fetchPosts(
function fetchPostActionContracts (line 102) | function fetchPostActionContracts(
function fetchPostReactions (line 122) | function fetchPostReactions(
function fetchPostBookmarks (line 140) | function fetchPostBookmarks(
function fetchPostReferences (line 161) | function fetchPostReferences(
function fetchPostTags (line 183) | function fetchPostTags(
function fetchPostReactionStatus (line 206) | function fetchPostReactionStatus(
function fetchWhoReferencedPost (line 227) | function fetchWhoReferencedPost(
function fetchWhoExecutedActionOnPost (line 247) | function fetchWhoExecutedActionOnPost(
function fetchWhoExecutedActionOnAccount (line 267) | function fetchWhoExecutedActionOnAccount(
function fetchPostEdits (line 287) | function fetchPostEdits(
FILE: packages/client/src/actions/sns.ts
function fetchSnsSubscription (line 30) | function fetchSnsSubscription(
function createSnsSubscriptions (line 54) | function createSnsSubscriptions(
function deleteSnsSubscription (line 74) | function deleteSnsSubscription(
FILE: packages/client/src/actions/sponsorship.ts
function fetchSponsorship (line 54) | function fetchSponsorship(
function fetchSponsorships (line 76) | function fetchSponsorships(
function fetchSponsorshipSigners (line 98) | function fetchSponsorshipSigners(
function fetchSponsorshipGrants (line 120) | function fetchSponsorshipGrants(
function fetchSponsorshipLimitExclusions (line 142) | function fetchSponsorshipLimitExclusions(
function createSponsorship (line 162) | function createSponsorship(
function setSponsorshipMetadata (line 186) | function setSponsorshipMetadata(
function updateSponsorshipLimits (line 241) | function updateSponsorshipLimits(
function updateSponsorshipExclusionList (line 273) | function updateSponsorshipExclusionList(
function updateSponsorshipSigners (line 305) | function updateSponsorshipSigners(
function pauseSponsorship (line 328) | function pauseSponsorship(
function unpauseSponsorship (line 348) | function unpauseSponsorship(
FILE: packages/client/src/actions/timeline.ts
function fetchTimeline (line 27) | function fetchTimeline(
function fetchTimelineHighlights (line 47) | function fetchTimelineHighlights(
FILE: packages/client/src/actions/transactions.ts
function transactionStatus (line 29) | function transactionStatus(
function prepareSignerErc20Approval (line 51) | function prepareSignerErc20Approval(
FILE: packages/client/src/actions/transfer.ts
function transferPrimitiveOwnership (line 25) | function transferPrimitiveOwnership(
FILE: packages/client/src/actions/username.ts
function canCreateUsername (line 36) | function canCreateUsername(
function createUsername (line 61) | function createUsername(
function assignUsernameToAccount (line 83) | function assignUsernameToAccount(
function unassignUsernameFromAccount (line 108) | function unassignUsernameFromAccount(
function fetchUsername (line 133) | function fetchUsername(
function fetchUsernames (line 156) | function fetchUsernames(
FILE: packages/client/src/authorization.ts
type OperationType (line 4) | enum OperationType {
type OperationApprovalRequest (line 26) | type OperationApprovalRequest = {
FILE: packages/client/src/batch.ts
type StoredQuery (line 17) | interface StoredQuery<TValue, TVariables extends AnyVariables> {
type BatchQueryData (line 24) | type BatchQueryData = Record<string, unknown>;
class BatchQueryBuilder (line 26) | class BatchQueryBuilder {
method build (line 52) | build<TVariables extends AnyVariables>(): [
method resolve (line 129) | resolve(data: BatchQueryData) {
function extractQueryParts (line 144) | function extractQueryParts(
FILE: packages/client/src/clients.ts
function takeValue (line 61) | function takeValue<T>({
type SignMessage (line 72) | type SignMessage = (message: string) => Promise<string>;
type LoginParams (line 80) | type LoginParams = ChallengeRequest & {
method constructor (line 95) | protected constructor(
method mutation (line 135) | public mutation<TValue, TVariables extends AnyVariables>(
method batch (line 393) | batch(
method exchanges (line 417) | protected exchanges(): Exchange[] {
method resultFrom (line 424) | protected resultFrom<TData, TVariables extends AnyVariables>(
class PublicClient (line 443) | class PublicClient<
method create (line 467) | static create(options: ClientConfig): PublicClient<Context> {
method challenge (line 474) | challenge(
method authenticate (line 483) | authenticate(
method login (line 510) | login({
method resumeSession (line 542) | resumeSession(): ResultAsync<
method isPublicClient (line 560) | public override isPublicClient(): this is PublicClient<TContext> {
method isSessionClient (line 567) | public override isSessionClient(): this is SessionClient<TContext> {
method query (line 591) | public query<TValue, TVariables extends AnyVariables>(
method mutation (line 611) | public mutation<TValue, TVariables extends AnyVariables>(
method createCredentialsStorage (line 620) | private createCredentialsStorage(): IStorage<Credentials> {
class SessionClient (line 633) | class SessionClient<TContext extends Context = Context> extends Abstract...
method parent (line 637) | public get parent(): PublicClient<TContext> {
method constructor (line 641) | constructor(
method getCredentials (line 654) | getCredentials(): Result<Credentials | null, UnexpectedError> {
method getAuthenticatedUser (line 666) | getAuthenticatedUser(): Result<AuthenticatedUser, UnexpectedError> {
method logout (line 684) | logout(): ResultAsync<void, UnauthenticatedError | UnexpectedError> {
method isPublicClient (line 699) | public override isPublicClient(): this is PublicClient<TContext> {
method isSessionClient (line 706) | public override isSessionClient(): this is SessionClient<TContext> {
method switchAccount (line 718) | switchAccount(
method query (line 758) | override query<TValue, TVariables extends AnyVariables>(
method mutation (line 782) | override mutation<TValue, TVariables extends AnyVariables>(
method pollTransactionStatus (line 815) | protected async pollTransactionStatus(txHash: TxHash): Promise<TxHash> {
method exchanges (line 843) | protected override exchanges(): Exchange[] {
method handleAuthentication (line 916) | private handleAuthentication<
type AnyClient (line 940) | type AnyClient<TContext extends Context = Context> =
FILE: packages/client/src/config.ts
type ClientConfig (line 8) | type ClientConfig = {
FILE: packages/client/src/context.ts
type Context (line 13) | type Context = {
function configureContext (line 26) | function configureContext(from: ClientConfig): Context {
FILE: packages/client/src/errors.ts
type GraphQLErrorCode (line 8) | enum GraphQLErrorCode {
function hasExtensionCode (line 18) | function hasExtensionCode(
class UnauthenticatedError (line 30) | class UnauthenticatedError extends ResultAwareError {
method fromCombinedError (line 33) | static fromCombinedError(error: CombinedError): UnauthenticatedError {
class UnexpectedError (line 41) | class UnexpectedError extends ResultAwareError {
class AuthenticationError (line 48) | class AuthenticationError extends ResultAwareError {
class SigningError (line 55) | class SigningError extends ResultAwareError {
class TransactionError (line 62) | class TransactionError extends ResultAwareError {
class TransactionIndexingError (line 69) | class TransactionIndexingError extends ResultAwareError {
class MetadataIndexingError (line 76) | class MetadataIndexingError extends ResultAwareError {
class ValidationError (line 84) | class ValidationError<
method constructor (line 89) | constructor(public readonly cause: ErrorResponse<T>) {
method fromErrorResponse (line 93) | static fromErrorResponse<T extends string>(
FILE: packages/client/src/ethers/encoding.ts
type EncodedParam (line 10) | type EncodedParam = {
function encodeValueByType (line 18) | function encodeValueByType(
function encodeKeyValuePairs (line 29) | function encodeKeyValuePairs(
FILE: packages/client/src/ethers/signer.ts
function nullableToOptional (line 23) | function nullableToOptional<T extends object>(
function signWith (line 41) | function signWith(
function handleOperationWith (line 75) | function handleOperationWith(signer: Signer): OperationHandler {
function signMessageWith (line 99) | function signMessageWith(signer: Signer): SignMessage {
FILE: packages/client/src/ethers/sponsorship.ts
type SponsorshipApprovalSignerConfig (line 11) | type SponsorshipApprovalSignerConfig = {
type SponsorshipApprovalSignerContext (line 28) | type SponsorshipApprovalSignerContext = {
class SponsorshipApprovalSigner (line 39) | class SponsorshipApprovalSigner {
method constructor (line 42) | constructor(config: SponsorshipApprovalSignerConfig) {
method approveSponsorship (line 50) | async approveSponsorship(
method computeDeadline (line 99) | private async computeDeadline(): Promise<number> {
method fillCustomData (line 104) | private fillCustomData(deadline: number, approval = '0x'): types.Eip71...
method encodePaymasterInput (line 115) | private encodePaymasterInput(deadline: number, approval = '0x'): string {
FILE: packages/client/src/fragments.ts
class FragmentDeduplicator (line 14) | class FragmentDeduplicator<TResult, TVariables extends AnyVariables> {
method constructor (line 22) | constructor(
method dedupe (line 29) | dedupe(): TypedDocumentNode<TResult, TVariables> {
method getRecursivelyReferencedFragments (line 75) | private getRecursivelyReferencedFragments(
method getFragmentSpreads (line 103) | private getFragmentSpreads(
method getFragment (line 126) | private getFragment(name: string): Maybe<FragmentDefinitionNode> {
class FragmentResolver (line 146) | class FragmentResolver {
method constructor (line 147) | private constructor(
method from (line 151) | static from(nodes: TypedDocumentNode[]): FragmentResolver {
method replaceFrom (line 171) | replaceFrom<TResult, TVariables extends AnyVariables>(
FILE: packages/client/src/logger.ts
type LogMethod (line 1) | type LogMethod = (...args: unknown[]) => void;
type LogLevel (line 3) | enum LogLevel {
class Logger (line 12) | class Logger {
method constructor (line 16) | private constructor(name: string, level: LogLevel = LogLevel.WARN) {
method named (line 22) | static named(name: string, level: LogLevel = LogLevel.WARN): Logger {
method replaceMethods (line 33) | private replaceMethods() {
FILE: packages/client/src/test-utils.ts
constant CHAIN (line 45) | const CHAIN = chains.testnet;
constant TEST_ACCOUNT (line 46) | const TEST_ACCOUNT = evmAddress(import.meta.env.TEST_ACCOUNT);
constant TEST_APP (line 47) | const TEST_APP = evmAddress(import.meta.env.TEST_APP);
constant TEST_ERC20 (line 48) | const TEST_ERC20 = evmAddress(import.meta.env.TEST_ERC20);
constant PRIVATE_KEY (line 49) | const PRIVATE_KEY = hexString(import.meta.env.PRIVATE_KEY);
constant GLOBAL_SPONSORSHIP (line 50) | const GLOBAL_SPONSORSHIP = evmAddress(
constant SPONSORSHIP_APPROVER_PRIVATE_KEY (line 53) | const SPONSORSHIP_APPROVER_PRIVATE_KEY = hexString(
constant TEST_SIGNER (line 71) | const TEST_SIGNER = evmAddress(signer.address);
function createPublicClient (line 73) | function createPublicClient(config: Partial<ClientConfig> = {}) {
function loginAsAccountOwner (line 81) | function loginAsAccountOwner(client = createPublicClient()) {
function loginAsOnboardingUser (line 92) | function loginAsOnboardingUser() {
function loginAsBuilder (line 104) | function loginAsBuilder() {
function createGraphQLErrorObject (line 128) | function createGraphQLErrorObject(code: GraphQLErrorCode) {
function dummyTextOnlyMetadata (line 141) | function dummyTextOnlyMetadata(): TextOnlyMetadata {
function uploadImmutableTextOnlyPostMetadata (line 148) | function uploadImmutableTextOnlyPostMetadata() {
function uploadTextOnlyPostMetadata (line 156) | function uploadTextOnlyPostMetadata() {
function updateTextOnlyMetadata (line 161) | function updateTextOnlyMetadata(uri: URI, metadata: TextOnlyMetadata) {
function createFakeJwt (line 165) | function createFakeJwt(payload: object): string {
function mockAccessToken (line 171) | function mockAccessToken(
function waitForTransactionReceipt (line 190) | function waitForTransactionReceipt(
function assertTypedDocumentSatisfies (line 204) | function assertTypedDocumentSatisfies<
FILE: packages/client/src/tokens.ts
constant SPONSORED_CLAIM (line 12) | const SPONSORED_CLAIM = 'tag:lens.dev,2024:sponsored';
constant ROLE_CLAIM (line 13) | const ROLE_CLAIM = 'tag:lens.dev,2024:role';
type ActorClaim (line 15) | interface ActorClaim {
type IdTokenClaims (line 19) | interface IdTokenClaims {
function decodeIdToken (line 78) | function decodeIdToken(
type AccessTokenClaims (line 91) | interface AccessTokenClaims {
function decodeAccessToken (line 163) | function decodeAccessToken(
FILE: packages/client/src/types.ts
function isTransactionRequest (line 8) | function isTransactionRequest(request: {
type OperationResponse (line 17) | type OperationResponse<T extends string> = {
type ErrorResponse (line 22) | type ErrorResponse<T extends string> = {
type DelegableOperationResult (line 27) | type DelegableOperationResult<O extends string, E extends string> =
type RestrictedOperationResult (line 33) | type RestrictedOperationResult<E extends string> =
type OperationResult (line 38) | type OperationResult<O extends string, E extends string> =
type RestrictedOperationHandler (line 42) | type RestrictedOperationHandler<E extends string> = (
type DelegableOperationHandler (line 46) | type DelegableOperationHandler<T extends string, E extends string> = (
type OperationHandler (line 50) | type OperationHandler<
FILE: packages/client/src/utils.ts
function delay (line 4) | function delay(ms: number): Promise<void> {
FILE: packages/client/src/viem/authorization.ts
type TypedDataSigner (line 7) | type TypedDataSigner = {
type LocalOperationApprovalSignerContext (line 11) | type LocalOperationApprovalSignerContext = {
constant DOMAIN_NAME (line 17) | const DOMAIN_NAME = 'Lens Source';
constant DOMAIN_VERSION (line 18) | const DOMAIN_VERSION = '1';
class OperationApprovalSigner (line 23) | class OperationApprovalSigner {
method constructor (line 24) | constructor(private readonly context: LocalOperationApprovalSignerCont...
method signOperationApproval (line 26) | async signOperationApproval(data: OperationApprovalRequest): Promise<s...
method createTypedDataDefinition (line 32) | private createTypedDataDefinition(
FILE: packages/client/src/viem/encoding.ts
type EncodedParam (line 10) | type EncodedParam = {
function encodeValueByType (line 18) | function encodeValueByType(
function encodeKeyValuePairs (line 28) | function encodeKeyValuePairs(
FILE: packages/client/src/viem/signer.ts
function sendTransaction (line 36) | async function sendTransaction(
function sendTransactionWith (line 73) | function sendTransactionWith(
function handleOperationWith (line 97) | function handleOperationWith(
function signMessageWith (line 140) | function signMessageWith(
FILE: packages/client/src/viem/sponsorship.ts
type SponsorshipApprovalSignerConfig (line 24) | type SponsorshipApprovalSignerConfig<chain extends chains.LensChain> = {
type SponsorshipApprovalSignerContext (line 41) | type SponsorshipApprovalSignerContext<chain extends chains.LensChain> = {
class SponsorshipApprovalSigner (line 52) | class SponsorshipApprovalSigner<chain extends chains.LensChain> {
method constructor (line 55) | constructor(config: SponsorshipApprovalSignerConfig<chain>) {
method approveSponsorship (line 63) | async approveSponsorship(
method approve (line 87) | private async approve(request: ZksyncTransactionSerializable): Promise...
method computeDeadline (line 101) | private async computeDeadline(): Promise<bigint> {
method encodePaymasterInput (line 108) | private encodePaymasterInput(deadline: bigint, approval: Hex = '0x'): ...
FILE: packages/client/src/viem/types.ts
function isOnLensChain (line 7) | function isOnLensChain<T extends Transport = Transport>(
function hasHoistedAccount (line 19) | function hasHoistedAccount<TChain extends Chain | undefined = undefined>(
FILE: packages/env/src/index.ts
type EnvironmentConfig (line 6) | type EnvironmentConfig = {
FILE: packages/graphql/src/accounts/account.ts
type AccountRequest (line 22) | type AccountRequest = RequestOf<typeof AccountQuery>;
type AccountsRequest (line 38) | type AccountsRequest = RequestOf<typeof AccountsQuery>;
type AccountsBulkRequest (line 48) | type AccountsBulkRequest = RequestOf<typeof AccountsBulkQuery>;
type SetAccountMetadataResponse (line 56) | type SetAccountMetadataResponse = FragmentOf<
type SetAccountMetadataResult (line 85) | type SetAccountMetadataResult = FragmentOf<
type SetAccountMetadataRequest (line 97) | type SetAccountMetadataRequest = RequestOf<
type CreateAccountResponse (line 107) | type CreateAccountResponse = FragmentOf<
type UsernameTaken (line 118) | type UsernameTaken = FragmentOf<typeof UsernameTakenFragment>;
type CreateAccountWithUsernameResult (line 155) | type CreateAccountWithUsernameResult = FragmentOf<
type CreateAccountWithUsernameRequest (line 168) | type CreateAccountWithUsernameRequest = RequestOf<
type CreateAccountResult (line 197) | type CreateAccountResult = FragmentOf<
type CreateAccountRequest (line 210) | type CreateAccountRequest = RequestOf<typeof CreateAccountMutation>;
type AccountFeedsStats (line 225) | type AccountFeedsStats = FragmentOf<typeof AccountFeedsStatsFragment>;
type AccountGraphsFollowStats (line 234) | type AccountGraphsFollowStats = FragmentOf<
type AccountStats (line 250) | type AccountStats = FragmentOf<typeof AccountStatsFragment>;
type AccountFeedsStatsRequest (line 260) | type AccountFeedsStatsRequest = RequestOf<typeof AccountFeedsStatsQuery>;
type AccountStatsRequest (line 270) | type AccountStatsRequest = RequestOf<typeof AccountStatsQuery>;
type AccountGraphsStatsRequest (line 280) | type AccountGraphsStatsRequest = RequestOf<
type AccountsAvailableRequest (line 297) | type AccountsAvailableRequest = RequestOf<typeof AccountsAvailableQuery>;
type AccountsBlockedRequest (line 312) | type AccountsBlockedRequest = RequestOf<typeof AccountsBlockedQuery>;
type MuteRequest (line 319) | type MuteRequest = RequestOf<typeof MuteAccountMutation>;
type UnmuteRequest (line 326) | type UnmuteRequest = RequestOf<typeof UnmuteAccountMutation>;
type ReportAccountRequest (line 333) | type ReportAccountRequest = RequestOf<typeof ReportAccountMutation>;
type AccountBlockedResponse (line 341) | type AccountBlockedResponse = FragmentOf<
type BlockResult (line 370) | type BlockResult = FragmentOf<typeof BlockResultFragment>;
type BlockRequest (line 380) | type BlockRequest = RequestOf<typeof BlockMutation>;
type AccountUnblockedResponse (line 388) | type AccountUnblockedResponse = FragmentOf<
type UnblockResult (line 414) | type UnblockResult = FragmentOf<typeof UnblockResultFragment>;
type UnblockRequest (line 424) | type UnblockRequest = RequestOf<typeof UnblockMutation>;
type RecommendAccountRequest (line 431) | type RecommendAccountRequest = RequestOf<
type UndoRecommendAccountRequest (line 440) | type UndoRecommendAccountRequest = RequestOf<
type UpdateAccountFollowRulesResponse (line 450) | type UpdateAccountFollowRulesResponse = FragmentOf<
type UpdateAccountFollowRulesResult (line 476) | type UpdateAccountFollowRulesResult = FragmentOf<
type UpdateAccountFollowRulesRequest (line 488) | type UpdateAccountFollowRulesRequest = RequestOf<
FILE: packages/graphql/src/accounts/managers.ts
type AccountManagersRequest (line 25) | type AccountManagersRequest = RequestOf<typeof AccountManagersQuery>;
type AddAccountManagerResult (line 45) | type AddAccountManagerResult = FragmentOf<
type AddAccountManagerRequest (line 57) | type AddAccountManagerRequest = RequestOf<
type AccountManagerPermissionsInput (line 61) | type AccountManagerPermissionsInput = ReturnType<
type RemoveAccountManagerResult (line 83) | type RemoveAccountManagerResult = FragmentOf<
type RemoveAccountManagerRequest (line 95) | type RemoveAccountManagerRequest = RequestOf<
type UpdateAccountManagerResult (line 117) | type UpdateAccountManagerResult = FragmentOf<
type UpdateAccountManagerRequest (line 129) | type UpdateAccountManagerRequest = RequestOf<
type HideManagedAccountRequest (line 138) | type HideManagedAccountRequest = RequestOf<
type UnhideManagedAccountRequest (line 147) | type UnhideManagedAccountRequest = RequestOf<
FILE: packages/graphql/src/accounts/signless.ts
type EnableSignlessResult (line 28) | type EnableSignlessResult = FragmentOf<
type RemoveSignlessResult (line 59) | type RemoveSignlessResult = FragmentOf<
FILE: packages/graphql/src/actions.ts
type ConfigurePostActionResponse (line 20) | type ConfigurePostActionResponse = FragmentOf<
type ConfigurePostActionResult (line 46) | type ConfigurePostActionResult = FragmentOf<
type ConfigurePostActionRequest (line 58) | type ConfigurePostActionRequest = RequestOf<
type DisablePostActionResponse (line 69) | type DisablePostActionResponse = FragmentOf<
type DisablePostActionResult (line 95) | type DisablePostActionResult = FragmentOf<
type DisablePostActionRequest (line 107) | type DisablePostActionRequest = RequestOf<
type EnablePostActionResponse (line 118) | type EnablePostActionResponse = FragmentOf<
type EnablePostActionResult (line 144) | type EnablePostActionResult = FragmentOf<
type EnablePostActionRequest (line 156) | type EnablePostActionRequest = RequestOf<
type ExecutePostActionResponse (line 167) | type ExecutePostActionResponse = FragmentOf<
type ExecutePostActionResult (line 201) | type ExecutePostActionResult = FragmentOf<
type ExecutePostActionRequest (line 213) | type ExecutePostActionRequest = RequestOf<
type ConfigureAccountActionResponse (line 224) | type ConfigureAccountActionResponse = FragmentOf<
type ConfigureAccountActionResult (line 250) | type ConfigureAccountActionResult = FragmentOf<
type ConfigureAccountActionRequest (line 262) | type ConfigureAccountActionRequest = RequestOf<
type DisableAccountActionResponse (line 273) | type DisableAccountActionResponse = FragmentOf<
type DisableAccountActionResult (line 299) | type DisableAccountActionResult = FragmentOf<
type DisableAccountActionRequest (line 311) | type DisableAccountActionRequest = RequestOf<
type EnableAccountActionResponse (line 322) | type EnableAccountActionResponse = FragmentOf<
type EnableAccountActionResult (line 348) | type EnableAccountActionResult = FragmentOf<
type EnableAccountActionRequest (line 360) | type EnableAccountActionRequest = RequestOf<
type ExecuteAccountActionResponse (line 371) | type ExecuteAccountActionResponse = FragmentOf<
type ExecuteAccountActionResult (line 405) | type ExecuteAccountActionResult = FragmentOf<
type ExecuteAccountActionRequest (line 417) | type ExecuteAccountActionRequest = RequestOf<
FILE: packages/graphql/src/admins.ts
type AddAdminsResult (line 29) | type AddAdminsResult = FragmentOf<typeof AddAdminsResultFragment>;
type AddAdminsRequest (line 39) | type AddAdminsRequest = RequestOf<typeof AddAdminsMutation>;
type RemoveAdminsResult (line 59) | type RemoveAdminsResult = FragmentOf<typeof RemoveAdminsResultFragment>;
type RemoveAdminsRequest (line 69) | type RemoveAdminsRequest = RequestOf<typeof RemoveAdminsMutation>;
type Admin (line 81) | type Admin = FragmentOf<typeof AdminFragment>;
type AdminsForRequest (line 97) | type AdminsForRequest = RequestOf<typeof AdminsForQuery>;
FILE: packages/graphql/src/app.ts
type AppRequest (line 22) | type AppRequest = RequestOf<typeof AppQuery>;
type AppsRequest (line 38) | type AppsRequest = RequestOf<typeof AppsQuery>;
type AppGroupsRequest (line 54) | type AppGroupsRequest = RequestOf<typeof AppGroupsQuery>;
type AppSigner (line 63) | type AppSigner = FragmentOf<typeof AppSignerFragment>;
type AppSignersRequest (line 79) | type AppSignersRequest = RequestOf<typeof AppSignersQuery>;
type AppFeed (line 88) | type AppFeed = FragmentOf<typeof AppFeedFragment>;
type AppFeedsRequest (line 104) | type AppFeedsRequest = RequestOf<typeof AppFeedsQuery>;
type AppUser (line 117) | type AppUser = FragmentOf<typeof AppUserFragment>;
type AppUsersRequest (line 133) | type AppUsersRequest = RequestOf<typeof AppUsersQuery>;
type CreateAppResponse (line 141) | type CreateAppResponse = FragmentOf<typeof CreateAppResponseFragment>;
type CreateAppResult (line 161) | type CreateAppResult = FragmentOf<typeof CreateAppResultFragment>;
type CreateAppRequest (line 171) | type CreateAppRequest = RequestOf<typeof CreateAppMutation>;
type AddAppFeedsResult (line 191) | type AddAppFeedsResult = FragmentOf<typeof AddAppFeedsResultFragment>;
type AddAppFeedsRequest (line 201) | type AddAppFeedsRequest = RequestOf<typeof AddAppFeedsMutation>;
type AddAppGroupsResult (line 221) | type AddAppGroupsResult = FragmentOf<typeof AddAppGroupsResultFragment>;
type AddAppGroupsRequest (line 231) | type AddAppGroupsRequest = RequestOf<typeof AddAppGroupsMutation>;
type AddAppSignersResult (line 251) | type AddAppSignersResult = FragmentOf<
type AddAppSignersRequest (line 263) | type AddAppSignersRequest = RequestOf<typeof AddAppSignersMutation>;
type RemoveAppFeedsResult (line 283) | type RemoveAppFeedsResult = FragmentOf<
type RemoveAppFeedsRequest (line 295) | type RemoveAppFeedsRequest = RequestOf<typeof RemoveAppFeedsMutation>;
type RemoveAppGroupsResult (line 315) | type RemoveAppGroupsResult = FragmentOf<
type RemoveAppGroupsRequest (line 327) | type RemoveAppGroupsRequest = RequestOf<typeof RemoveAppGroupsMutation>;
type RemoveAppSignersResult (line 347) | type RemoveAppSignersResult = FragmentOf<
type RemoveAppSignersRequest (line 359) | type RemoveAppSignersRequest = RequestOf<
type SetAppGraphResult (line 381) | type SetAppGraphResult = FragmentOf<typeof SetAppGraphResultFragment>;
type SetAppGraphRequest (line 391) | type SetAppGraphRequest = RequestOf<typeof SetAppGraphMutation>;
type SetDefaultAppFeedResult (line 411) | type SetDefaultAppFeedResult = FragmentOf<
type SetDefaultAppFeedRequest (line 423) | type SetDefaultAppFeedRequest = RequestOf<
type SetAppMetadataResult (line 445) | type SetAppMetadataResult = FragmentOf<
type SetAppMetadataRequest (line 457) | type SetAppMetadataRequest = RequestOf<typeof SetAppMetadataMutation>;
type SetAppVerificationResult (line 477) | type SetAppVerificationResult = FragmentOf<
type SetAppVerificationRequest (line 489) | type SetAppVerificationRequest = RequestOf<
type SetAppSponsorshipResult (line 511) | type SetAppSponsorshipResult = FragmentOf<
type SetAppSponsorshipRequest (line 523) | type SetAppSponsorshipRequest = RequestOf<
type SetAppTreasuryResult (line 545) | type SetAppTreasuryResult = FragmentOf<
type SetAppTreasuryRequest (line 557) | type SetAppTreasuryRequest = RequestOf<typeof SetAppTreasuryMutation>;
type SetAppUsernameNamespaceResult (line 577) | type SetAppUsernameNamespaceResult = FragmentOf<
type SetAppUsernameNamespaceRequest (line 589) | type SetAppUsernameNamespaceRequest = RequestOf<
type AddAppAuthorizationEndpointRequest (line 599) | type AddAppAuthorizationEndpointRequest = {
type RemoveAppAuthorizationEndpointRequest (line 610) | type RemoveAppAuthorizationEndpointRequest = RequestOf<
type GenerateNewAppServerApiKeyRequest (line 619) | type GenerateNewAppServerApiKeyRequest = RequestOf<
type AppServerApiKeyRequest (line 628) | type AppServerApiKeyRequest = RequestOf<typeof AppServerApiKeyQuery>;
FILE: packages/graphql/src/authentication.ts
type AuthenticationChallenge (line 17) | type AuthenticationChallenge = FragmentOf<
type ChallengeRequest (line 30) | type ChallengeRequest = RequestOf<typeof ChallengeMutation>;
type AuthenticationTokens (line 40) | type AuthenticationTokens = FragmentOf<
type WrongSignerError (line 50) | type WrongSignerError = FragmentOf<typeof WrongSignerErrorFragment>;
type ExpiredChallengeError (line 58) | type ExpiredChallengeError = FragmentOf<
type ForbiddenError (line 68) | type ForbiddenError = FragmentOf<typeof ForbiddenErrorFragment>;
type AuthenticationResult (line 95) | type AuthenticationResult = FragmentOf<
type SignedAuthChallenge (line 107) | type SignedAuthChallenge = RequestOf<typeof AuthenticateMutation>;
type AuthenticatedSession (line 122) | type AuthenticatedSession = FragmentOf<
type AuthenticatedSessionsRequest (line 148) | type AuthenticatedSessionsRequest = RequestOf<
type RevokeAuthenticationRequest (line 157) | type RevokeAuthenticationRequest = RequestOf<
type RefreshResult (line 173) | type RefreshResult = FragmentOf<typeof RefreshResultFragment>;
type RefreshRequest (line 183) | type RefreshRequest = RequestOf<typeof RefreshMutation>;
type RolloverRefreshRequest (line 193) | type RolloverRefreshRequest = RequestOf<
type SwitchAccountResult (line 209) | type SwitchAccountResult = FragmentOf<
type SwitchAccountRequest (line 221) | type SwitchAccountRequest = RequestOf<typeof SwitchAccountMutation>;
type MeResult (line 240) | type MeResult = FragmentOf<typeof MeResultFragment>;
type LastLoggedInAccountRequest (line 259) | type LastLoggedInAccountRequest = RequestOf<
FILE: packages/graphql/src/common.ts
type Paginated (line 6) | type Paginated<T> = {
type StandardData (line 17) | type StandardData<T> = { value: T };
FILE: packages/graphql/src/enums.ts
type Role (line 4) | enum Role {
type AccessConditionComparison (line 14) | enum AccessConditionComparison {
type AccountReportReason (line 26) | enum AccountReportReason {
type AccountsOrderBy (line 35) | enum AccountsOrderBy {
type AppMetadataLensPlatformsItem (line 44) | enum AppMetadataLensPlatformsItem {
type AppsOrderBy (line 53) | enum AppsOrderBy {
type BlockErrorType (line 62) | enum BlockErrorType {
type ContentWarning (line 71) | enum ContentWarning {
type EntityType (line 80) | enum EntityType {
type EventMetadataLensSchedulingAdjustmentsTimezoneId (line 97) | enum EventMetadataLensSchedulingAdjustmentsTimezoneId {
type FeedsOrderBy (line 531) | enum FeedsOrderBy {
type FollowersOrderBy (line 540) | enum FollowersOrderBy {
type FollowersYouKnowOrderBy (line 549) | enum FollowersYouKnowOrderBy {
type FollowingOrderBy (line 557) | enum FollowingOrderBy {
type ForYouSource (line 566) | enum ForYouSource {
type GraphsOrderBy (line 576) | enum GraphsOrderBy {
type GroupMembersOrderBy (line 585) | enum GroupMembersOrderBy {
type GroupsOrderBy (line 594) | enum GroupsOrderBy {
type MainContentFocus (line 603) | enum MainContentFocus {
type ManagedAccountsVisibility (line 625) | enum ManagedAccountsVisibility {
type MediaAudioKind (line 634) | enum MediaAudioKind {
type MediaAudioType (line 646) | enum MediaAudioType {
type MediaImageType (line 660) | enum MediaImageType {
type MediaVideoType (line 676) | enum MediaVideoType {
type MetadataAttributeType (line 692) | enum MetadataAttributeType {
type MetadataLicenseType (line 703) | enum MetadataLicenseType {
type NamespacesOrderBy (line 745) | enum NamespacesOrderBy {
type NftContractType (line 754) | enum NftContractType {
type NotificationOrderBy (line 762) | enum NotificationOrderBy {
type NotificationType (line 770) | enum NotificationType {
type PageSize (line 787) | enum PageSize {
type PostActionCategoryType (line 795) | enum PostActionCategoryType {
type PostActionType (line 802) | enum PostActionType {
type PostReactionOrderBy (line 810) | enum PostReactionOrderBy {
type PostReactionType (line 818) | enum PostReactionType {
type PostReferenceType (line 826) | enum PostReferenceType {
type PostReportReason (line 835) | enum PostReportReason {
type PostTagsOrderBy (line 859) | enum PostTagsOrderBy {
type PostType (line 867) | enum PostType {
type PostVisibilityFilter (line 877) | enum PostVisibilityFilter {
type SelfFundedFallbackReason (line 886) | enum SelfFundedFallbackReason {
type SponsorLimitType (line 894) | enum SponsorLimitType {
type SponsoredFallbackReason (line 904) | enum SponsoredFallbackReason {
type ThreeDAssetFormat (line 914) | enum ThreeDAssetFormat {
type TimelineEventItemType (line 924) | enum TimelineEventItemType {
type TokenStandard (line 934) | enum TokenStandard {
type TransactionType (line 943) | enum TransactionType {
type WhoExecutedActionOnAccountOrderBy (line 952) | enum WhoExecutedActionOnAccountOrderBy {
type WhoExecutedActionOnPostOrderBy (line 961) | enum WhoExecutedActionOnPostOrderBy {
type WhoReferencedPostOrderBy (line 970) | enum WhoReferencedPostOrderBy {
type AppUsersOrderBy (line 979) | enum AppUsersOrderBy {
type IndexingStatus (line 988) | enum IndexingStatus {
type SponsorshipRateLimitWindow (line 997) | enum SponsorshipRateLimitWindow {
type SponsorshipsOrderBy (line 1008) | enum SponsorshipsOrderBy {
type SponsorshipSignersOrderBy (line 1017) | enum SponsorshipSignersOrderBy {
type SponsorshipLimitExclusionsOrderBy (line 1026) | enum SponsorshipLimitExclusionsOrderBy {
type FeedRuleUnsatisfiedReason (line 1035) | enum FeedRuleUnsatisfiedReason {
type GroupRuleUnsatisfiedReason (line 1045) | enum GroupRuleUnsatisfiedReason {
type NamespaceRuleUnsatisfiedReason (line 1055) | enum NamespaceRuleUnsatisfiedReason {
type PostRuleUnsatisfiedReason (line 1066) | enum PostRuleUnsatisfiedReason {
type AccountFollowRuleUnsatisfiedReason (line 1077) | enum AccountFollowRuleUnsatisfiedReason {
type FeedRuleType (line 1088) | enum FeedRuleType {
type PostRuleType (line 1100) | enum PostRuleType {
type AccountFollowRuleType (line 1108) | enum AccountFollowRuleType {
type GraphRuleType (line 1117) | enum GraphRuleType {
type FeedRuleExecuteOn (line 1127) | enum FeedRuleExecuteOn {
type GroupRuleExecuteOn (line 1137) | enum GroupRuleExecuteOn {
type GroupRuleType (line 1147) | enum GroupRuleType {
type NamespaceRuleExecuteOn (line 1159) | enum NamespaceRuleExecuteOn {
type NamespaceRuleType (line 1169) | enum NamespaceRuleType {
type PostRuleExecuteOn (line 1181) | enum PostRuleExecuteOn {
type GraphRuleExecuteOn (line 1189) | enum GraphRuleExecuteOn {
type MarketplaceMetadataAttributeType (line 1198) | enum MarketplaceMetadataAttributeType {
type SimpleCollectValidationFailedReason (line 1207) | enum SimpleCollectValidationFailedReason {
type FrameVerifySignatureResult (line 1219) | enum FrameVerifySignatureResult {
type AccountActionType (line 1236) | enum AccountActionType {
type ReferenceRelevancyFilter (line 1244) | enum ReferenceRelevancyFilter {
type GroupBannedAccountsOrderBy (line 1253) | enum GroupBannedAccountsOrderBy {
type UsernamesOrderBy (line 1263) | enum UsernamesOrderBy {
type PrimitiveMetadataSchema (line 1271) | enum PrimitiveMetadataSchema {
type PaymentSource (line 1286) | enum PaymentSource {
type RulesSubject (line 1294) | enum RulesSubject {
FILE: packages/graphql/src/feed.ts
type CreateFeedResponse (line 17) | type CreateFeedResponse = FragmentOf<typeof CreateFeedResponseFragment>;
type CreateFeedResult (line 37) | type CreateFeedResult = FragmentOf<typeof CreateFeedResultFragment>;
type CreateFeedRequest (line 47) | type CreateFeedRequest = RequestOf<typeof CreateFeedMutation>;
type SetFeedMetadataResponse (line 55) | type SetFeedMetadataResponse = FragmentOf<
type SetFeedMetadataResult (line 81) | type SetFeedMetadataResult = FragmentOf<
type SetFeedMetadataRequest (line 93) | type SetFeedMetadataRequest = RequestOf<typeof SetFeedMetadataMutation>;
type FeedRequest (line 103) | type FeedRequest = RequestOf<typeof FeedQuery>;
type FeedsRequest (line 119) | type FeedsRequest = RequestOf<typeof FeedsQuery>;
type UpdateFeedRulesResponse (line 127) | type UpdateFeedRulesResponse = FragmentOf<
type UpdateFeedRulesResult (line 153) | type UpdateFeedRulesResult = FragmentOf<
type UpdateFeedRulesRequest (line 165) | type UpdateFeedRulesRequest = RequestOf<typeof UpdateFeedRulesMutation>;
FILE: packages/graphql/src/follow.ts
type FollowResponse (line 20) | type FollowResponse = FragmentOf<typeof FollowResponseFragment>;
type FollowResult (line 48) | type FollowResult = FragmentOf<typeof FollowResultFragment>;
type CreateFollowRequest (line 58) | type CreateFollowRequest = RequestOf<typeof FollowMutation>;
type UnfollowResponse (line 66) | type UnfollowResponse = FragmentOf<typeof UnfollowResponseFragment>;
type UnfollowResult (line 94) | type UnfollowResult = FragmentOf<typeof UnfollowResultFragment>;
type CreateUnfollowRequest (line 104) | type CreateUnfollowRequest = RequestOf<typeof UnfollowMutation>;
type Follower (line 116) | type Follower = FragmentOf<typeof FollowerFragment>;
type Following (line 128) | type Following = FragmentOf<typeof FollowingFragment>;
type FollowersRequest (line 144) | type FollowersRequest = RequestOf<typeof FollowersQuery>;
type FollowingRequest (line 160) | type FollowingRequest = RequestOf<typeof FollowingQuery>;
type FollowersYouKnowRequest (line 176) | type FollowersYouKnowRequest = RequestOf<typeof FollowersYouKnowQuery>;
type FollowStatusResult (line 190) | type FollowStatusResult = FragmentOf<typeof FollowStatusResultFragment>;
type FollowStatusRequest (line 200) | type FollowStatusRequest = RequestOf<typeof FollowStatusQuery>;
FILE: packages/graphql/src/fragments/account.ts
type AccountFollowOperationValidationPassed (line 13) | type AccountFollowOperationValidationPassed = FragmentOf<
type AccountFollowRule (line 29) | type AccountFollowRule = FragmentOf<typeof AccountFollowRuleFragment>;
type AccountFollowOperationValidationRule (line 43) | type AccountFollowOperationValidationRule =
type AccountFollowOperationValidationUnknown (line 56) | type AccountFollowOperationValidationUnknown = FragmentOf<
type AccountFollowUnsatisfiedRule (line 72) | type AccountFollowUnsatisfiedRule = FragmentOf<
type AccountFollowUnsatisfiedRules (line 88) | type AccountFollowUnsatisfiedRules = FragmentOf<
type AccountFollowOperationValidationFailed (line 102) | type AccountFollowOperationValidationFailed = FragmentOf<
type AccountFollowOperationValidationOutcome (line 125) | type AccountFollowOperationValidationOutcome =
type LoggedInAccountOperations (line 151) | interface LoggedInAccountOperations
type AccountMetadata (line 168) | interface AccountMetadata
type AccountFollowRules (line 183) | type AccountFollowRules = FragmentOf<typeof AccountFollowRulesFragment>;
type TippingAccountAction (line 191) | type TippingAccountAction = FragmentOf<
type UnknownAccountAction (line 208) | type UnknownAccountAction = FragmentOf<
type AccountAction (line 224) | type AccountAction = TippingAccountAction | UnknownAccountAction;
type Account (line 257) | interface Account extends FragmentOf<typeof AccountFragment> {}
type AccountManagerPermissions (line 259) | interface AccountManagerPermissions {
type AccountManager (line 293) | type AccountManager = FragmentOf<typeof AccountManagerFragment>;
type AccountManaged (line 308) | type AccountManaged = FragmentOf<typeof AccountManagedFragment>;
type AccountAvailable (line 326) | type AccountAvailable = FragmentOf<typeof AccountAvailableFragment>;
type AccountBlocked (line 338) | type AccountBlocked = FragmentOf<typeof AccountBlockedFragment>;
FILE: packages/graphql/src/fragments/common.ts
type BooleanValue (line 11) | type BooleanValue = FragmentOf<typeof BooleanValueFragment>;
type IntKeyValue (line 20) | type IntKeyValue = FragmentOf<typeof IntKeyValueFragment>;
type IntNullableKeyValue (line 29) | type IntNullableKeyValue = FragmentOf<
type AddressKeyValue (line 40) | type AddressKeyValue = FragmentOf<typeof AddressKeyValueFragment>;
type StringKeyValue (line 49) | type StringKeyValue = FragmentOf<typeof StringKeyValueFragment>;
type BooleanKeyValue (line 58) | type BooleanKeyValue = FragmentOf<typeof BooleanKeyValueFragment>;
type RawKeyValue (line 67) | type RawKeyValue = FragmentOf<typeof RawKeyValueFragment>;
type BigDecimalKeyValue (line 76) | type BigDecimalKeyValue = FragmentOf<typeof BigDecimalKeyValueFragment>;
type PrimitiveData (line 112) | type PrimitiveData =
type DictionaryKeyValue (line 131) | type DictionaryKeyValue = FragmentOf<typeof DictionaryKeyValueFragment>;
type ArrayData (line 171) | type ArrayData =
type ArrayKeyValue (line 191) | type ArrayKeyValue = FragmentOf<typeof ArrayKeyValueFragment>;
type AnyKeyValue (line 235) | type AnyKeyValue =
type KeyValuePair (line 254) | type KeyValuePair = FragmentOf<typeof KeyValuePairFragment>;
type ActionMetadata (line 276) | interface ActionMetadata
type UnknownPostAction (line 292) | type UnknownPostAction = FragmentOf<typeof UnknownPostActionFragment>;
type FollowerOn (line 301) | type FollowerOn = FragmentOf<typeof FollowerOnFragment>;
type NetworkAddress (line 310) | type NetworkAddress = FragmentOf<typeof NetworkAddressFragment>;
type Erc20 (line 324) | type Erc20 = FragmentOf<typeof Erc20Fragment>;
type Erc20Amount (line 336) | type Erc20Amount = FragmentOf<typeof Erc20AmountFragment>;
type NativeToken (line 350) | type NativeToken = FragmentOf<typeof NativeTokenFragment>;
type NativeAmount (line 362) | type NativeAmount = FragmentOf<typeof NativeAmountFragment>;
type PayableAmount (line 375) | type PayableAmount = FragmentOf<typeof PayableAmountFragment>;
FILE: packages/graphql/src/fragments/media.ts
type MediaAudio (line 22) | interface MediaAudio extends FragmentOf<typeof MediaAudioFragment> {}
type MediaImage (line 35) | interface MediaImage extends FragmentOf<typeof MediaImageFragment> {}
type MediaVideo (line 51) | interface MediaVideo extends FragmentOf<typeof MediaVideoFragment> {}
type AnyMedia (line 68) | type AnyMedia = FragmentOf<typeof AnyMediaFragment>;
FILE: packages/graphql/src/fragments/metadata.ts
type MetadataAttribute (line 18) | type MetadataAttribute = FragmentOf<typeof MetadataAttributeFragment>;
type EventLocationFragment (line 27) | type EventLocationFragment = FragmentOf<typeof EventLocationFragment>;
type EventSchedulingAdjustments (line 36) | type EventSchedulingAdjustments = FragmentOf<
type PhysicalAddress (line 51) | type PhysicalAddress = FragmentOf<typeof PhysicalAddressFragment>;
type ThreeDAsset (line 63) | interface ThreeDAsset extends FragmentOf<typeof ThreeDAssetFragment> {}
type ArticleMetadata (line 84) | interface ArticleMetadata
type AudioMetadata (line 109) | interface AudioMetadata
type TextOnlyMetadata (line 127) | interface TextOnlyMetadata
type CheckingInMetadata (line 153) | interface CheckingInMetadata
type ImageMetadata (line 178) | interface ImageMetadata
type VideoMetadata (line 203) | interface VideoMetadata
type EmbedMetadata (line 225) | interface EmbedMetadata
type EventMetadata (line 266) | interface EventMetadata
type LinkMetadata (line 288) | interface LinkMetadata extends FragmentOf<typeof LinkMetadataFragment> {}
type LivestreamMetadata (line 314) | interface LivestreamMetadata
type MintMetadata (line 336) | interface MintMetadata extends FragmentOf<typeof MintMetadataFragment> {}
type SpaceMetadata (line 359) | interface SpaceMetadata
type StoryMetadata (line 380) | interface StoryMetadata
type ThreeDMetadata (line 404) | interface ThreeDMetadata
type TransactionMetadata (line 428) | interface TransactionMetadata
type UnknownPostMetadata (line 437) | interface UnknownPostMetadata
FILE: packages/graphql/src/fragments/pagination.ts
type PaginatedResultInfo (line 3) | type PaginatedResultInfo = {
FILE: packages/graphql/src/fragments/post.ts
type RecipientPercent (line 49) | type RecipientPercent = FragmentOf<typeof RecipientPercentFragment>;
type PayToCollectConfig (line 51) | type PayToCollectConfig = {
type SimpleCollectAction (line 97) | type SimpleCollectAction = FragmentOf<
type PostAction (line 112) | type PostAction = FragmentOf<typeof PostActionFragment>;
type FullPostMetadata (line 186) | type FullPostMetadata = FragmentOf<typeof PostMetadataFragment>;
type PostOperationValidationPassed (line 193) | type PostOperationValidationPassed = FragmentOf<
type PostRule (line 210) | type PostRule = FragmentOf<typeof PostRuleFragment>;
type PostOperationValidationRule (line 223) | type PostOperationValidationRule = FeedRule | PostRule;
type PostOperationValidationUnknown (line 234) | type PostOperationValidationUnknown = FragmentOf<
type PostUnsatisfiedRule (line 250) | type PostUnsatisfiedRule = FragmentOf<
type PostUnsatisfiedRules (line 266) | type PostUnsatisfiedRules = FragmentOf<
type PostOperationValidationFailed (line 280) | type PostOperationValidationFailed = FragmentOf<
type OperationValidationOutcome (line 302) | type OperationValidationOutcome =
type PostTip (line 307) | type PostTip = {
type SimpleCollectValidationPassed (line 336) | type SimpleCollectValidationPassed = FragmentOf<
type SimpleCollectValidationFailed (line 347) | type SimpleCollectValidationFailed = FragmentOf<
type SimpleCollectValidationOutcome (line 366) | type SimpleCollectValidationOutcome =
type LoggedInPostOperations (line 422) | interface LoggedInPostOperations
type MentionReplace (line 432) | type MentionReplace = FragmentOf<typeof MentionReplaceFragment>;
type AccountMention (line 445) | type AccountMention = FragmentOf<typeof AccountMentionFragment>;
type GroupMention (line 457) | type GroupMention = FragmentOf<typeof GroupMentionFragment>;
type PostMention (line 470) | type PostMention = AccountMention | GroupMention;
type PostStats (line 485) | type PostStats = FragmentOf<typeof PostStatsFragment>;
type PostRules (line 499) | type PostRules = FragmentOf<typeof PostRulesFragment>;
type MarketplaceMetadataAttribute (line 509) | type MarketplaceMetadataAttribute = FragmentOf<
type NftMetadata (line 527) | interface NftMetadata extends FragmentOf<typeof NftMetadataFragment> {}
type PostGroupInfo (line 539) | interface PostGroupInfo
type PostFeedInfo (line 555) | interface PostFeedInfo extends FragmentOf<typeof PostFeedInfoFragment> {}
type PostFields (line 606) | interface PostFields extends FragmentOf<typeof PostFieldsFragment> {}
type ReferencedPost (line 608) | interface ReferencedPost
type Post (line 635) | interface Post
type Repost (line 669) | interface Repost {
type AnyPost (line 700) | type AnyPost = Post | Repost;
type PostReaction (line 723) | type PostReaction = FragmentOf<typeof PostReactionFragment>;
type AccountPostReaction (line 737) | type AccountPostReaction = FragmentOf<
FILE: packages/graphql/src/fragments/primitives.ts
type AppMetadata (line 19) | interface AppMetadata extends FragmentOf<typeof AppMetadataFragment> {}
type App (line 40) | interface App extends FragmentOf<typeof AppFragment> {}
type FeedMetadata (line 50) | interface FeedMetadata extends FragmentOf<typeof FeedMetadataFragment> {}
type FeedOperationValidationPassed (line 57) | type FeedOperationValidationPassed = FragmentOf<
type FeedRule (line 74) | type FeedRule = FragmentOf<typeof FeedRuleFragment>;
type FeedOperationValidationUnknown (line 85) | type FeedOperationValidationUnknown = FragmentOf<
type FeedUnsatisfiedRule (line 101) | type FeedUnsatisfiedRule = FragmentOf<
type FeedUnsatisfiedRules (line 117) | type FeedUnsatisfiedRules = FragmentOf<
type FeedOperationValidationFailed (line 131) | type FeedOperationValidationFailed = FragmentOf<
type FeedOperationValidationOutcome (line 135) | type FeedOperationValidationOutcome =
type LoggedInFeedPostOperations (line 173) | interface LoggedInFeedPostOperations
type FeedRules (line 188) | type FeedRules = FragmentOf<typeof FeedRulesFragment>;
type Feed (line 208) | interface Feed extends FragmentOf<typeof FeedFragment> {}
type GraphMetadata (line 218) | interface GraphMetadata
type GraphRule (line 234) | type GraphRule = FragmentOf<typeof GraphRuleFragment>;
type GraphRules (line 248) | type GraphRules = FragmentOf<typeof GraphRulesFragment>;
type Graph (line 265) | interface Graph extends FragmentOf<typeof GraphFragment> {}
type UsernameNamespaceMetadata (line 274) | type UsernameNamespaceMetadata = FragmentOf<
type NamespaceRule (line 291) | interface NamespaceRule
type NamespaceRules (line 306) | type NamespaceRules = FragmentOf<typeof NamespaceRulesFragment>;
type NamespaceUnsatisfiedRule (line 322) | type NamespaceUnsatisfiedRule = FragmentOf<
type NamespaceOperationValidationPassed (line 331) | type NamespaceOperationValidationPassed = FragmentOf<
type NamespaceOperationValidationUnknown (line 344) | type NamespaceOperationValidationUnknown = FragmentOf<
type NamespaceUnsatisfiedRules (line 359) | type NamespaceUnsatisfiedRules = FragmentOf<
type NamespaceOperationValidationFailed (line 373) | type NamespaceOperationValidationFailed = FragmentOf<
type NamespaceOperationValidationOutcome (line 377) | type NamespaceOperationValidationOutcome =
type LoggedInUsernameNamespaceOperations (line 415) | interface LoggedInUsernameNamespaceOperations
type UsernameNamespaceStats (line 424) | type UsernameNamespaceStats = FragmentOf<
type UsernameNamespaceMetadataStandard (line 442) | interface UsernameNamespaceMetadataStandard
type UsernameNamespace (line 478) | interface UsernameNamespace
type GroupMetadata (line 491) | interface GroupMetadata
type GroupRule (line 507) | type GroupRule = FragmentOf<typeof GroupRuleFragment>;
type GroupRules (line 521) | type GroupRules = FragmentOf<typeof GroupRulesFragment>;
type GroupOperationValidationPassed (line 528) | type GroupOperationValidationPassed = FragmentOf<
type GroupOperationValidationUnknown (line 541) | type GroupOperationValidationUnknown = FragmentOf<
type GroupUnsatisfiedRule (line 557) | type GroupUnsatisfiedRule = FragmentOf<
type GroupUnsatisfiedRules (line 573) | type GroupUnsatisfiedRules = FragmentOf<
type GroupOperationValidationFailed (line 587) | type GroupOperationValidationFailed = FragmentOf<
type GroupOperationValidationOutcome (line 591) | type GroupOperationValidationOutcome =
type LoggedInGroupOperations (line 640) | interface LoggedInGroupOperations
type Group (line 671) | interface Group extends FragmentOf<typeof GroupFragment> {}
FILE: packages/graphql/src/fragments/transactions.ts
type TransactionWillFail (line 10) | type TransactionWillFail = FragmentOf<
type Eip1559TransactionRequest (line 29) | type Eip1559TransactionRequest = FragmentOf<
type SelfFundedTransactionRequest (line 44) | type SelfFundedTransactionRequest = FragmentOf<
type Eip712TransactionRequest (line 74) | type Eip712TransactionRequest = FragmentOf<
type SponsoredTransactionRequest (line 89) | type SponsoredTransactionRequest = FragmentOf<
FILE: packages/graphql/src/fragments/username.ts
type LoggedInUsernameOperations (line 21) | interface LoggedInUsernameOperations
type Username (line 40) | type Username = FragmentOf<typeof UsernameFragment>;
FILE: packages/graphql/src/frames.ts
type CreateFrameEip712TypedDataFragment (line 40) | type CreateFrameEip712TypedDataFragment = FragmentOf<
type CreateFrameTypedDataRequest (line 52) | type CreateFrameTypedDataRequest = RequestOf<
type VerifyFrameSignatureRequest (line 61) | type VerifyFrameSignatureRequest = RequestOf<
type FrameLensManagerSignatureResultFragment (line 74) | type FrameLensManagerSignatureResultFragment = FragmentOf<
type SignFrameActionRequest (line 86) | type SignFrameActionRequest = RequestOf<typeof SignFrameActionMutation>;
FILE: packages/graphql/src/funds.ts
type Erc20BalanceError (line 18) | type Erc20BalanceError = FragmentOf<typeof Erc20BalanceErrorFragment>;
type NativeBalanceError (line 25) | type NativeBalanceError = FragmentOf<typeof NativeBalanceErrorFragment>;
type AnyAccountBalance (line 50) | type AnyAccountBalance = FragmentOf<typeof AnyAccountBalanceFragment>;
type AccountBalancesRequest (line 60) | type AccountBalancesRequest = RequestOf<typeof AccountBalancesQuery>;
type InsufficientFunds (line 68) | type InsufficientFunds = FragmentOf<typeof InsufficientFundsFragment>;
type SignerErc20ApprovalRequired (line 81) | type SignerErc20ApprovalRequired = FragmentOf<
type WithdrawResult (line 107) | type WithdrawResult = FragmentOf<typeof WithdrawResultFragment>;
type WithdrawRequest (line 117) | type WithdrawRequest = RequestOf<typeof WithdrawMutation>;
type DepositResult (line 141) | type DepositResult = FragmentOf<typeof DepositResultFragment>;
type DepositRequest (line 151) | type DepositRequest = RequestOf<typeof DepositMutation>;
type WrapTokensResult (line 175) | type WrapTokensResult = FragmentOf<typeof WrapTokensResultFragment>;
type WrapTokensRequest (line 185) | type WrapTokensRequest = RequestOf<typeof WrapTokensMutation>;
type UnwrapTokensResult (line 209) | type UnwrapTokensResult = FragmentOf<typeof UnwrapTokensResultFragment>;
type UnwrapTokensRequest (line 219) | type UnwrapTokensRequest = RequestOf<typeof UnwrapTokensMutation>;
type AnyBalance (line 244) | type AnyBalance = FragmentOf<typeof AnyBalanceFragment>;
type BalancesBulkRequest (line 254) | type BalancesBulkRequest = RequestOf<typeof BalancesBulkQuery>;
FILE: packages/graphql/src/graph.ts
type CreateGraphResponse (line 17) | type CreateGraphResponse = FragmentOf<
type CreateGraphResult (line 39) | type CreateGraphResult = FragmentOf<typeof CreateGraphResultFragment>;
type CreateGraphRequest (line 49) | type CreateGraphRequest = RequestOf<typeof CreateGraphMutation>;
type SetGraphMetadataResult (line 69) | type SetGraphMetadataResult = FragmentOf<
type SetGraphMetadataRequest (line 81) | type SetGraphMetadataRequest = RequestOf<
type GraphRequest (line 93) | type GraphRequest = RequestOf<typeof GraphQuery>;
type GraphsRequest (line 109) | type GraphsRequest = RequestOf<typeof GraphsQuery>;
type UpdateGraphRulesResult (line 129) | type UpdateGraphRulesResult = FragmentOf<
type UpdateGraphRulesRequest (line 141) | type UpdateGraphRulesRequest = RequestOf<
FILE: packages/graphql/src/graphql-env.d.ts
type introspection_types (line 4) | type introspection_types = {
type introspection (line 896) | type introspection = {
type setupSchema (line 907) | interface setupSchema {
FILE: packages/graphql/src/graphql.ts
type RequestOf (line 250) | type RequestOf<Document> = Document extends DocumentDecoration<
type FragmentShape (line 260) | type FragmentShape = NonNullable<Parameters<typeof graphql>[1]>[number];
type GetDocumentNode (line 262) | type GetDocumentNode<
type __FutureProofUnion (line 272) | type __FutureProofUnion = { __typename: symbol };
type AnySelectionSet (line 277) | type AnySelectionSet = object;
type AnyVariables (line 282) | type AnyVariables = Record<string, unknown>;
type TypedSelectionSet (line 287) | type TypedSelectionSet<TTypename extends string = string> = {
type FragmentDocumentFor (line 294) | type FragmentDocumentFor<
type RequestFrom (line 310) | type RequestFrom<In extends string> = RequestOf<
type StandardDocumentNode (line 315) | type StandardDocumentNode<Value = any, Request = any> = TadaDocumentNode<
function assertTypename (line 337) | function assertTypename<Typename extends string>(
FILE: packages/graphql/src/group.ts
type CreateGroupResponse (line 19) | type CreateGroupResponse = FragmentOf<
type CreateGroupResult (line 45) | type CreateGroupResult = FragmentOf<typeof CreateGroupResultFragment>;
type CreateGroupRequest (line 55) | type CreateGroupRequest = RequestOf<typeof CreateGroupMutation>;
type SetGroupMetadataResponse (line 63) | type SetGroupMetadataResponse = FragmentOf<
type SetGroupMetadataResult (line 89) | type SetGroupMetadataResult = FragmentOf<
type SetGroupMetadataRequest (line 101) | type SetGroupMetadataRequest = RequestOf<
type JoinGroupResponse (line 111) | type JoinGroupResponse = FragmentOf<typeof JoinGroupResponseFragment>;
type JoinGroupResult (line 139) | type JoinGroupResult = FragmentOf<typeof JoinGroupResultFragment>;
type JoinGroupRequest (line 149) | type JoinGroupRequest = RequestOf<typeof JoinGroupMutation>;
type LeaveGroupResponse (line 157) | type LeaveGroupResponse = FragmentOf<typeof LeaveGroupResponseFragment>;
type LeaveGroupResult (line 185) | type LeaveGroupResult = FragmentOf<typeof LeaveGroupResultFragment>;
type LeaveGroupRequest (line 195) | type LeaveGroupRequest = RequestOf<typeof LeaveGroupMutation>;
type GroupRequest (line 205) | type GroupRequest = RequestOf<typeof GroupQuery>;
type GroupsRequest (line 221) | type GroupsRequest = RequestOf<typeof GroupsQuery>;
type GroupMember (line 234) | type GroupMember = FragmentOf<typeof GroupMemberFragment>;
type GroupMembersRequest (line 250) | type GroupMembersRequest = RequestOf<typeof GroupMembersQuery>;
type GroupStatsResponse (line 258) | type GroupStatsResponse = FragmentOf<typeof GroupStatsResponseFragment>;
type GroupStatsRequest (line 268) | type GroupStatsRequest = RequestOf<typeof GroupStatsQuery>;
type GroupMembershipRequest (line 282) | type GroupMembershipRequest = FragmentOf<
type GroupMembershipRequestsRequest (line 300) | type GroupMembershipRequestsRequest = RequestOf<
type GroupBannedAccount (line 319) | type GroupBannedAccount = FragmentOf<typeof GroupBannedAccountFragment>;
type GroupBannedAccountsRequest (line 335) | type GroupBannedAccountsRequest = RequestOf<
type UpdateGroupRulesResponse (line 345) | type UpdateGroupRulesResponse = FragmentOf<
type UpdateGroupRulesResult (line 371) | type UpdateGroupRulesResult = FragmentOf<
type UpdateGroupRulesRequest (line 383) | type UpdateGroupRulesRequest = RequestOf<
type ApproveGroupMembershipResult (line 420) | type ApproveGroupMembershipResult = FragmentOf<
type ApproveGroupMembershipRequest (line 432) | type ApproveGroupMembershipRequest = RequestOf<
type RemoveGroupMembersResponse (line 442) | type RemoveGroupMembersResponse = FragmentOf<
type RemoveGroupMembersResult (line 472) | type RemoveGroupMembersResult = FragmentOf<
type RemoveGroupMembersRequest (line 484) | type RemoveGroupMembersRequest = RequestOf<
type RequestGroupMembershipResponse (line 494) | type RequestGroupMembershipResponse = FragmentOf<
type RequestGroupMembershipResult (line 520) | type RequestGroupMembershipResult = FragmentOf<
type RequestGroupMembershipRequest (line 532) | type RequestGroupMembershipRequest = RequestOf<
type CancelGroupMembershipRequestResponse (line 542) | type CancelGroupMembershipRequestResponse = FragmentOf<
type CancelGroupMembershipRequestResult (line 568) | type CancelGroupMembershipRequestResult = FragmentOf<
type CancelGroupMembershipRequestRequest (line 580) | type CancelGroupMembershipRequestRequest = RequestOf<
type RejectGroupMembershipRequestsResponse (line 590) | type RejectGroupMembershipRequestsResponse = FragmentOf<
type RejectGroupMembershipResult (line 616) | type RejectGroupMembershipResult = FragmentOf<
type RejectGroupMembershipRequest (line 628) | type RejectGroupMembershipRequest = RequestOf<
type BanGroupAccountsResponse (line 638) | type BanGroupAccountsResponse = FragmentOf<
type BanGroupAccountsResult (line 664) | type BanGroupAccountsResult = FragmentOf<
type BanGroupAccountsRequest (line 676) | type BanGroupAccountsRequest = RequestOf<
type UnbanGroupAccountsResponse (line 686) | type UnbanGroupAccountsResponse = FragmentOf<
type UnbanGroupAccountsResult (line 712) | type UnbanGroupAccountsResult = FragmentOf<
type UnbanGroupAccountsRequest (line 724) | type UnbanGroupAccountsRequest = RequestOf<
FILE: packages/graphql/src/metadata.ts
type RefreshMetadataStatusResult (line 13) | type RefreshMetadataStatusResult = FragmentOf<
type RefreshMetadataStatusRequest (line 25) | type RefreshMetadataStatusRequest = RequestOf<
type RefreshMetadataResult (line 35) | type RefreshMetadataResult = FragmentOf<
type RefreshMetadataRequest (line 47) | type RefreshMetadataRequest = RequestOf<typeof RefreshMetadataMutation>;
FILE: packages/graphql/src/misc.ts
type AccessControlResult (line 19) | type AccessControlResult = FragmentOf<
type AccessControlRequest (line 31) | type AccessControlRequest = RequestOf<typeof AccessControlQuery>;
type TokenDistribution (line 45) | type TokenDistribution = FragmentOf<typeof TokenDistributionFragment>;
type TokenDistributionsRequest (line 61) | type TokenDistributionsRequest = RequestOf<
FILE: packages/graphql/src/ml.ts
type AccountRecommendationsRequest (line 23) | type AccountRecommendationsRequest = RequestOf<
type PostForYou (line 37) | type PostForYou = FragmentOf<typeof PostForYouFragment>;
type PostsForYouRequest (line 53) | type PostsForYouRequest = RequestOf<typeof MlPostsForYouQuery>;
type PostsExploreRequest (line 69) | type PostsExploreRequest = RequestOf<typeof MlPostsExploreQuery>;
type DismissRecommendedAccountsRequest (line 76) | type DismissRecommendedAccountsRequest = RequestOf<
type PostNotInterestedRequest (line 90) | type PostNotInterestedRequest = RequestOf<
FILE: packages/graphql/src/namespace.ts
type CreateNamespaceResponse (line 17) | type CreateNamespaceResponse = FragmentOf<
type CreateUsernameNamespaceResult (line 39) | type CreateUsernameNamespaceResult = FragmentOf<
type CreateUsernameNamespaceRequest (line 51) | type CreateUsernameNamespaceRequest = RequestOf<
type SetNamespaceMetadataResult (line 73) | type SetNamespaceMetadataResult = FragmentOf<
type SetNamespaceMetadataRequest (line 85) | type SetNamespaceMetadataRequest = RequestOf<
type NamespaceRequest (line 97) | type NamespaceRequest = RequestOf<typeof NamespaceQuery>;
type NamespacesRequest (line 113) | type NamespacesRequest = RequestOf<typeof NamespacesQuery>;
type UpdateNamespaceRulesResult (line 133) | type UpdateNamespaceRulesResult = FragmentOf<
type UpdateNamespaceRulesRequest (line 145) | type UpdateNamespaceRulesRequest = RequestOf<
type UpdateReservedUsernamesResult (line 167) | type UpdateReservedUsernamesResult = FragmentOf<
type UpdateReservedUsernamesRequest (line 179) | type UpdateReservedUsernamesRequest = RequestOf<
type UsernameReserved (line 190) | type UsernameReserved = FragmentOf<typeof UsernameReservedFragment>;
type NamespaceReservedUsernamesRequest (line 206) | type NamespaceReservedUsernamesRequest = RequestOf<
FILE: packages/graphql/src/notifications.ts
type NotificationAccountFollow (line 33) | interface NotificationAccountFollow {
type FollowNotification (line 51) | interface FollowNotification {
type NotificationAccountPostReaction (line 69) | interface NotificationAccountPostReaction {
type ReactionNotification (line 89) | interface ReactionNotification {
type CommentNotification (line 111) | interface CommentNotification {
type NotificationAccountRepost (line 129) | interface NotificationAccountRepost {
type RepostNotification (line 149) | interface RepostNotification {
type QuoteNotification (line 171) | interface QuoteNotification {
type MentionNotification (line 189) | interface MentionNotification {
type TippingAccountActionExecuted (line 207) | interface TippingAccountActionExecuted {
type UnknownAccountActionExecuted (line 236) | interface UnknownAccountActionExecuted {
type AccountActionExecuted (line 262) | type AccountActionExecuted =
type AccountActionExecutedNotification (line 282) | interface AccountActionExecutedNotification {
type GroupMembershipRequestApprovedNotification (line 300) | interface GroupMembershipRequestApprovedNotification {
type GroupMembershipRequestRejectedNotification (line 324) | interface GroupMembershipRequestRejectedNotification {
type SimpleCollectPostActionExecuted (line 348) | interface SimpleCollectPostActionExecuted {
type TippingPostActionExecuted (line 370) | interface TippingPostActionExecuted {
type UnknownPostActionExecuted (line 399) | interface UnknownPostActionExecuted {
type PostActionExecuted (line 425) | type PostActionExecuted =
type PostActionExecutedNotification (line 453) | interface PostActionExecutedNotification {
type TokenDistributedNotification (line 475) | interface TokenDistributedNotification {
type Notification (line 499) | type Notification =
type NotificationsRequest (line 580) | type NotificationsRequest = RequestOf<typeof NotificationsQuery>;
FILE: packages/graphql/src/post.ts
type PostResponse (line 22) | type PostResponse = FragmentOf<typeof PostResponseFragment>;
type PostResult (line 50) | type PostResult = FragmentOf<typeof PostResultFragment>;
type CreatePostRequest (line 60) | type CreatePostRequest = RequestOf<typeof PostMutation>;
type CreateRepostRequest (line 70) | type CreateRepostRequest = RequestOf<typeof RepostMutation>;
type EditPostRequest (line 80) | type EditPostRequest = RequestOf<typeof EditPostMutation>;
type PostRequest (line 90) | type PostRequest = RequestOf<typeof PostQuery>;
type PostsRequest (line 105) | type PostsRequest = RequestOf<typeof PostsQuery>;
type SimpleCollectActionContract (line 114) | type SimpleCollectActionContract = FragmentOf<
type TippingPostActionContract (line 125) | type TippingPostActionContract = FragmentOf<
type UnknownPostActionContract (line 139) | type UnknownPostActionContract = FragmentOf<
type PostActionContract (line 161) | type PostActionContract = FragmentOf<typeof PostActionContractFragment>;
type PostActionContractsRequest (line 176) | type PostActionContractsRequest = RequestOf<
type PostReactionsRequest (line 193) | type PostReactionsRequest = RequestOf<typeof PostReactionsQuery>;
type PostBookmarksRequest (line 208) | type PostBookmarksRequest = RequestOf<typeof PostBookmarksQuery>;
type PostReferencesRequest (line 223) | type PostReferencesRequest = RequestOf<typeof PostReferencesQuery>;
type AddReactionResult (line 237) | type AddReactionResult = FragmentOf<typeof AddReactionResultFragment>;
type AddReactionRequest (line 247) | type AddReactionRequest = RequestOf<typeof AddReactionMutation>;
type UndoReactionResult (line 261) | type UndoReactionResult = FragmentOf<typeof UndoReactionResultFragment>;
type UndoReactionRequest (line 271) | type UndoReactionRequest = RequestOf<typeof UndoReactionMutation>;
type BookmarkPostRequest (line 278) | type BookmarkPostRequest = RequestOf<typeof BookmarkPostMutation>;
type UndoBookmarkPostRequest (line 285) | type UndoBookmarkPostRequest = RequestOf<
type DeletePostResponse (line 295) | type DeletePostResponse = FragmentOf<typeof DeletePostResponseFragment>;
type DeletePostResult (line 319) | type DeletePostResult = FragmentOf<typeof DeletePostResultFragment>;
type DeletePostRequest (line 329) | type DeletePostRequest = RequestOf<typeof DeletePostMutation>;
type HideReplyRequest (line 336) | type HideReplyRequest = RequestOf<typeof HideReplyMutation>;
type UnhideReplyRequest (line 343) | type UnhideReplyRequest = RequestOf<typeof UnhideReplyMutation>;
type ReportPostRequest (line 350) | type ReportPostRequest = RequestOf<typeof ReportPostMutation>;
type PostTag (line 359) | type PostTag = FragmentOf<typeof PostTagFragment>;
type PostTagsRequest (line 375) | type PostTagsRequest = RequestOf<typeof PostTagsQuery>;
type PostReactionStatus (line 386) | type PostReactionStatus = FragmentOf<typeof PostReactionStatusFragment>;
type PostReactionStatusRequest (line 396) | type PostReactionStatusRequest = RequestOf<
type WhoReferencedPostRequest (line 414) | type WhoReferencedPostRequest = RequestOf<typeof WhoReferencedPostQuery>;
type PostExecutedActions (line 428) | type PostExecutedActions = FragmentOf<
type WhoExecutedActionOnPostRequest (line 446) | type WhoExecutedActionOnPostRequest = RequestOf<
type AccountExecutedActions (line 462) | type AccountExecutedActions = FragmentOf<
type WhoExecutedActionOnAccountRequest (line 480) | type WhoExecutedActionOnAccountRequest = RequestOf<
type PostEdit (line 494) | type PostEdit = FragmentOf<typeof PostEditFragment>;
type PostEditsRequest (line 510) | type PostEditsRequest = RequestOf<typeof PostEditsQuery>;
type UpdatePostRulesResponse (line 518) | type UpdatePostRulesResponse = FragmentOf<
type UpdatePostRulesResult (line 544) | type UpdatePostRulesResult = FragmentOf<
type UpdatePostRulesRequest (line 556) | type UpdatePostRulesRequest = RequestOf<typeof UpdatePostRulesMutation>;
FILE: packages/graphql/src/refinements.ts
function justPost (line 7) | function justPost(post: AnyPost): Post {
FILE: packages/graphql/src/scalars.ts
type ServerAPIKey (line 6) | type ServerAPIKey = Tagged<string, 'ServerAPIKey'>;
FILE: packages/graphql/src/sns.ts
type SnsSubscription (line 16) | type SnsSubscription = FragmentOf<typeof SnsSubscriptionFragment>;
type GetSnsSubscriptionsRequest (line 26) | type GetSnsSubscriptionsRequest = RequestOf<
type CreateSnsSubscriptionRequest (line 38) | type CreateSnsSubscriptionRequest = RequestOf<
type DeleteSnsSubscriptionRequest (line 47) | type DeleteSnsSubscriptionRequest = RequestOf<
FILE: packages/graphql/src/sponsorship.ts
type SponsorshipMetadata (line 19) | type SponsorshipMetadata = FragmentOf<
type SponsorshipRateLimit (line 30) | type SponsorshipRateLimit = FragmentOf<
type Sponsorship (line 57) | type Sponsorship = FragmentOf<typeof SponsorshipFragment>;
type SponsorshipsRequest (line 72) | type SponsorshipsRequest = RequestOf<typeof SponsorshipsQuery>;
type SponsorshipGrant (line 85) | type SponsorshipGrant = FragmentOf<typeof SponsorshipGrantFragment>;
type SponsorshipGrantsRequest (line 100) | type SponsorshipGrantsRequest = RequestOf<typeof SponsorshipGrantsQuery>;
type SponsorshipRequest (line 110) | type SponsorshipRequest = RequestOf<typeof SponsorshipQuery>;
type SponsorshipSigner (line 121) | type SponsorshipSigner = FragmentOf<typeof SponsorshipSignerFragment>;
type SponsorshipSignersRequest (line 136) | type SponsorshipSignersRequest = RequestOf<
type SponsorshipLimitsExempt (line 149) | type SponsorshipLimitsExempt = FragmentOf<
type SponsorshipLimitExclusionsRequest (line 166) | type SponsorshipLimitExclusionsRequest = RequestOf<
type CreateSponsorshipResponse (line 176) | type CreateSponsorshipResponse = FragmentOf<
type CreateSponsorshipResult (line 198) | type CreateSponsorshipResult = FragmentOf<
type CreateSponsorshipRequest (line 210) | type CreateSponsorshipRequest = RequestOf<
type SetSponsorshipMetadataResult (line 232) | type SetSponsorshipMetadataResult = FragmentOf<
type SetSponsorshipMetadataRequest (line 244) | type SetSponsorshipMetadataRequest = RequestOf<
type UpdateSponsorshipLimitsResult (line 266) | type UpdateSponsorshipLimitsResult = FragmentOf<
type UpdateSponsorshipLimitsRequest (line 278) | type UpdateSponsorshipLimitsRequest = RequestOf<
type UpdateSponsorshipExclusionListResult (line 300) | type UpdateSponsorshipExclusionListResult = FragmentOf<
type UpdateSponsorshipExclusionListRequest (line 312) | type UpdateSponsorshipExclusionListRequest = RequestOf<
type UpdateSponsorshipSignersResult (line 334) | type UpdateSponsorshipSignersResult = FragmentOf<
type UpdateSponsorshipSignersRequest (line 346) | type UpdateSponsorshipSignersRequest = RequestOf<
type PausingResult (line 368) | type PausingResult = FragmentOf<typeof PausingResultFragment>;
type PausingRequest (line 388) | type PausingRequest = RequestOf<typeof PauseSponsorshipMutation>;
FILE: packages/graphql/src/timeline.ts
type TimelineItem (line 11) | type TimelineItem = Prettify<{
type TimelineRequest (line 51) | type TimelineRequest = RequestOf<typeof TimelineQuery>;
type TimelineHighlightsRequest (line 66) | type TimelineHighlightsRequest = RequestOf<
FILE: packages/graphql/src/transactions.ts
type SubOperationStatus (line 16) | type SubOperationStatus = FragmentOf<typeof SubOperationStatusFragment>;
type PendingTransactionStatus (line 28) | type PendingTransactionStatus = FragmentOf<
type FinishedTransactionStatus (line 42) | type FinishedTransactionStatus = FragmentOf<
type FailedTransactionStatus (line 57) | type FailedTransactionStatus = FragmentOf<
type NotIndexedYetStatus (line 68) | type NotIndexedYetStatus = FragmentOf<
type TransactionStatusResult (line 94) | type TransactionStatusResult = FragmentOf<
type TransactionStatusRequest (line 107) | type TransactionStatusRequest = RequestOf<typeof TransactionStatusQuery>;
type PrepareSignerErc20ApprovalResult (line 128) | type PrepareSignerErc20ApprovalResult = FragmentOf<
type PrepareSignerErc20ApprovalRequest (line 141) | type PrepareSignerErc20ApprovalRequest = RequestOf<
FILE: packages/graphql/src/transferOwnership.ts
type TransferPrimitiveOwnershipResult (line 27) | type TransferPrimitiveOwnershipResult = FragmentOf<
type TransferPrimitiveOwnershipRequest (line 39) | type TransferPrimitiveOwnershipRequest = RequestOf<
FILE: packages/graphql/src/username.ts
type CreateUsernameResponse (line 21) | type CreateUsernameResponse = FragmentOf<
type CreateUsernameResult (line 55) | type CreateUsernameResult = FragmentOf<
type CreateUsernameRequest (line 67) | type CreateUsernameRequest = RequestOf<typeof CreateUsernameMutation>;
type AssignUsernameResponse (line 75) | type AssignUsernameResponse = FragmentOf<
type AssignUsernameToAccountResult (line 105) | type AssignUsernameToAccountResult = FragmentOf<
type AssignUsernameToAccountRequest (line 117) | type AssignUsernameToAccountRequest = RequestOf<
type UnassignUsernameResponse (line 127) | type UnassignUsernameResponse = FragmentOf<
type UnassignUsernameToAccountResult (line 157) | type UnassignUsernameToAccountResult = FragmentOf<
type UnassignUsernameFromAccountRequest (line 169) | type UnassignUsernameFromAccountRequest = RequestOf<
type UsernameRequest (line 181) | type UsernameRequest = RequestOf<typeof UsernameQuery>;
type UsernamesRequest (line 197) | type UsernamesRequest = RequestOf<typeof UsernamesQuery>;
type CanCreateUsernameResult (line 222) | type CanCreateUsernameResult = FragmentOf<
type CanCreateUsernameRequest (line 234) | type CanCreateUsernameRequest = RequestOf<typeof CanCreateUsernameQuery>;
FILE: packages/react/src/LensProvider.tsx
type LensProviderProps (line 11) | type LensProviderProps = {
function LensProvider (line 41) | function LensProvider({ children, client }: LensProviderProps) {
FILE: packages/react/src/account/useAccount.ts
type UseAccountArgs (line 12) | type UseAccountArgs = AccountRequest;
function useAccount (line 36) | function useAccount({
FILE: packages/react/src/account/useAccountFeedsStats.ts
type UseAccountFeedsStatsArgs (line 15) | type UseAccountFeedsStatsArgs = AccountFeedsStatsRequest;
function useAccountFeedsStats (line 46) | function useAccountFeedsStats({
FILE: packages/react/src/account/useAccountManagers.ts
type UseAccountManagersArgs (line 16) | type UseAccountManagersArgs = AccountManagersRequest;
function useAccountManagers (line 42) | function useAccountManagers({
FILE: packages/react/src/account/useAccountStats.ts
type UseAccountStatsArgs (line 15) | type UseAccountStatsArgs = AccountStatsRequest;
function useAccountStats (line 46) | function useAccountStats({
FILE: packages/react/src/account/useAccounts.ts
type UseAccountsArgs (line 16) | type UseAccountsArgs = AccountsRequest;
function useAccounts (line 55) | function useAccounts({
FILE: packages/react/src/account/useAccountsBlocked.ts
type UseAccountsBlockedArgs (line 16) | type UseAccountsBlockedArgs = AccountsBlockedRequest;
function useAccountsBlocked (line 42) | function useAccountsBlocked({
FILE: packages/react/src/account/useAccountsBulk.ts
type UseAccountsBulkArgs (line 12) | type UseAccountsBulkArgs = AccountsBulkRequest;
function useAccountsBulk (line 43) | function useAccountsBulk({
FILE: packages/react/src/account/useAddAccountManager.ts
type UseAddAccountManagerArgs (line 20) | type UseAddAccountManagerArgs = {
function useAddAccountManager (line 29) | function useAddAccountManager(
FILE: packages/react/src/account/useBalancesBulk.ts
type UseBalancesBulkArgs (line 12) | type UseBalancesBulkArgs = BalancesBulkRequest;
function useBalancesBulk (line 45) | function useBalancesBulk({
FILE: packages/react/src/account/useCreateAccountWithFreeUsername.ts
type UseCreateAccountWithFreeUsernameArgs (line 21) | type UseCreateAccountWithFreeUsernameArgs = {
function useCreateAccountWithFreeUsername (line 30) | function useCreateAccountWithFreeUsername(
FILE: packages/react/src/account/useCreateAccountWithRestrictedUsername.ts
type UseCreateAccountWithRestrictedUsernameArgs (line 23) | type UseCreateAccountWithRestrictedUsernameArgs = {
type UseCreateAccountWithRestrictedUsernameRequest (line 27) | type UseCreateAccountWithRestrictedUsernameRequest =
function useCreateAccountWithRestrictedUsername (line 35) | function useCreateAccountWithRestrictedUsername(
FILE: packages/react/src/account/useEnableSignless.ts
type UseEnableSignlessArgs (line 13) | type UseEnableSignlessArgs = {
function useEnableSignless (line 22) | function useEnableSignless(
FILE: packages/react/src/account/useRemoveAccountManager.ts
type UseRemoveAccountManagerArgs (line 21) | type UseRemoveAccountManagerArgs = {
function useRemoveAccountManager (line 30) | function useRemoveAccountManager(
FILE: packages/react/src/account/useRemoveSignless.ts
type UseRemoveSignlessArgs (line 13) | type UseRemoveSignlessArgs = {
function useRemoveSignless (line 22) | function useRemoveSignless(
FILE: packages/react/src/account/useSetAccountMetadata.ts
type UseSetAccountMetadataArgs (line 17) | type UseSetAccountMetadataArgs = {
function useSetAccountMetadata (line 26) | function useSetAccountMetadata(
FILE: packages/react/src/account/useWhoExecutedActionOnAccount.ts
type UseWhoExecutedActionOnAccountArgs (line 16) | type UseWhoExecutedActionOnAccountArgs =
function useWhoExecutedActionOnAccount (line 48) | function useWhoExecutedActionOnAccount({
FILE: packages/react/src/app/useAppUsers.ts
type UseAppUsersArgs (line 16) | type UseAppUsersArgs = AppUsersRequest;
function useAppUsers (line 47) | function useAppUsers({
FILE: packages/react/src/authentication/useAccountsAvailable.ts
type UseAccountsAvailableArgs (line 15) | type UseAccountsAvailableArgs = AccountsAvailableRequest;
function useAccountsAvailable (line 41) | function useAccountsAvailable({
FILE: packages/react/src/authentication/useAuthenticatedUser.ts
type UseAuthenticatedUserArgs (line 9) | type UseAuthenticatedUserArgs = {
function useAuthenticatedUser (line 42) | function useAuthenticatedUser(
FILE: packages/react/src/authentication/useLogin.ts
type LoginError (line 17) | type LoginError = AuthenticationError | SigningError | UnexpectedError;
function useLoginAction (line 51) | function useLoginAction(): UseAsyncTask<
function useLogin (line 91) | function useLogin(): UseAsyncTask<
FILE: packages/react/src/authentication/useLogout.ts
type LogoutError (line 11) | type LogoutError = UnauthenticatedError | UnexpectedError;
function useLogout (line 20) | function useLogout(): UseAsyncTask<void, void, LogoutError> {
FILE: packages/react/src/authentication/useMeDetails.ts
function useMeDetails (line 34) | function useMeDetails({
FILE: packages/react/src/authentication/usePublicClient.ts
function usePublicClient (line 8) | function usePublicClient(): PublicClient {
FILE: packages/react/src/authentication/useSessionClient.ts
type UseSessionArgs (line 8) | type UseSessionArgs = {
function useSessionClient (line 43) | function useSessionClient(
FILE: packages/react/src/authentication/useSwitchAccount.ts
type SwitchAccountError (line 18) | type SwitchAccountError =
function useSwitchAccount (line 40) | function useSwitchAccount(): UseAsyncTask<
FILE: packages/react/src/context.tsx
type SessionState (line 20) | type SessionState = {
type LensContextValue (line 28) | type LensContextValue = {
function createInitialSessionState (line 35) | function createInitialSessionState(publicClient: PublicClient): SessionS...
function attemptSessionRestoration (line 47) | async function attemptSessionRestoration(
function useCreateLensContextValue (line 58) | function useCreateLensContextValue(
type LensContextProviderProps (line 110) | type LensContextProviderProps = {
function LensContextProvider (line 118) | function LensContextProvider({
function useLensContext (line 134) | function useLensContext(): LensContextValue {
type UseSessionStateArgs (line 148) | type UseSessionStateArgs = {
function useSessionState (line 155) | function useSessionState({
FILE: packages/react/src/ethers/useUnknownPostActionEncoder.ts
function useUnknownPostActionEncoder (line 16) | function useUnknownPostActionEncoder(
FILE: packages/react/src/feed/useFeed.ts
type UseFeedArgs (line 12) | type UseFeedArgs = FeedRequest;
function useFeed (line 36) | function useFeed({
FILE: packages/react/src/feed/useFeeds.ts
type UseFeedsArgs (line 15) | type UseFeedsArgs = FeedsRequest;
function useFeeds (line 53) | function useFeeds({
FILE: packages/react/src/follow/useFollow.ts
type UseFollowArgs (line 15) | type UseFollowArgs = {
function useFollow (line 24) | function useFollow(
FILE: packages/react/src/follow/useFollowStatus.ts
type UseFollowStatusArgs (line 15) | type UseFollowStatusArgs = FollowStatusRequest;
function useFollowStatus (line 56) | function useFollowStatus({
FILE: packages/react/src/follow/useFollowers.ts
type UseFollowersArgs (line 16) | type UseFollowersArgs = FollowersRequest;
function useFollowers (line 42) | function useFollowers({
FILE: packages/react/src/follow/useFollowersYouKnow.ts
type UseFollowersYouKnowArgs (line 16) | type UseFollowersYouKnowArgs = FollowersYouKnowRequest;
function useFollowersYouKnow (line 49) | function useFollowersYouKnow({
FILE: packages/react/src/follow/useFollowing.ts
type UseFollowingArgs (line 16) | type UseFollowingArgs = FollowingRequest;
function useFollowing (line 42) | function useFollowing({
FILE: packages/react/src/follow/useUnfollow.ts
type UseUnfollowArgs (line 15) | type UseUnfollowArgs = {
function useUnfollow (line 24) | function useUnfollow(
FILE: packages/react/src/graph/useGraph.ts
type UseGraphArgs (line 12) | type UseGraphArgs = GraphRequest;
function useGraph (line 36) | function useGraph({
FILE: packages/react/src/group/useGroup.ts
type UseGroupArgs (line 12) | type UseGroupArgs = GroupRequest;
function useGroup (line 36) | function useGroup({
FILE: packages/react/src/group/useGroupBannedAccounts.ts
type UseGroupBannedAccountsArgs (line 16) | type UseGroupBannedAccountsArgs = GroupBannedAccountsRequest;
function useGroupBannedAccounts (line 47) | function useGroupBannedAccounts({
FILE: packages/react/src/group/useGroupMembers.ts
type UseGroupMembersArgs (line 16) | type UseGroupMembersArgs = GroupMembersRequest;
function useGroupMembers (line 47) | function useGroupMembers({
FILE: packages/react/src/group/useGroupMembershipRequests.ts
type UseGroupMembershipRequestsArgs (line 16) | type UseGroupMembershipRequestsArgs = GroupMembershipRequestsRequest;
function useGroupMembershipRequests (line 47) | function useGroupMembershipRequests({
FILE: packages/react/src/group/useGroups.ts
type UseGroupsArgs (line 12) | type UseGroupsArgs = GroupsRequest;
function useGroups (line 43) | function useGroups({
FILE: packages/react/src/helpers/reads.ts
type Suspendable (line 10) | type Suspendable = { suspense: true };
type UseSuspendableQueryArgs (line 15) | type UseSuspendableQueryArgs<Value, Variables extends AnyVariables> = {
function useSuspendableQuery (line 24) | function useSuspendableQuery<Value, Variables extends AnyVariables>({
FILE: packages/react/src/helpers/results.ts
type ReadResult (line 8) | type ReadResult<T, E = never> =
type SuspenseResult (line 49) | type SuspenseResult<T> = { data: T };
type SuspendableResult (line 51) | type SuspendableResult<T> = ReadResult<T> | SuspenseResult<T>;
FILE: packages/react/src/helpers/tasks.ts
type AsyncTask (line 11) | type AsyncTask<TInput, TResult extends ResultAsync<unknown, unknown>> = (
type AuthenticatedAsyncTask (line 20) | type AuthenticatedAsyncTask<
type AsyncTaskIdle (line 28) | type AsyncTaskIdle = {
type AsyncTaskLoading (line 38) | type AsyncTaskLoading<TData> = {
type AsyncTaskSuccess (line 48) | type AsyncTaskSuccess<TData> = {
type AsyncTaskError (line 58) | type AsyncTaskError<TError> = {
type AsyncTaskState (line 68) | type AsyncTaskState<TData, TError> =
type UseAsyncTask (line 134) | type UseAsyncTask<TInput, TValue, TError> = AsyncTaskState<
function useAsyncTask (line 144) | function useAsyncTask<
type DeferredCall (line 186) | type DeferredCall<TInput, TValue, TError> = {
function createDeferredCall (line 192) | function createDeferredCall<TInput, TValue, TError>(
function useAuthenticatedAsyncTask (line 207) | function useAuthenticatedAsyncTask<
FILE: packages/react/src/ml/useAccountRecommendations.ts
type UseAccountRecommendationsArgs (line 16) | type UseAccountRecommendationsArgs = AccountRecommendationsRequest;
function useAccountRecommendations (line 42) | function useAccountRecommendations({
FILE: packages/react/src/ml/useDismissRecommendedAccounts.ts
function useDismissRecommendedAccounts (line 18) | function useDismissRecommendedAccounts(): UseAsyncTask<
FILE: packages/react/src/ml/usePostsForYou.ts
type UsePostsForYouArgs (line 12) | type UsePostsForYouArgs = PostsForYouRequest;
function usePostsForYou (line 38) | function usePostsForYou(
FILE: packages/react/src/ml/usePostsToExplore.ts
type UsePostsToExploreArgs (line 12) | type UsePostsToExploreArgs = PostsExploreRequest;
function usePostsToExplore (line 38) | function usePostsToExplore(
FILE: packages/react/src/notification/useNotifications.ts
type UseNotificationsArgs (line 16) | type UseNotificationsArgs = NotificationsRequest;
function useNotifications (line 42) | function useNotifications({
FILE: packages/react/src/post/useBookmarkPost.ts
function useBookmarkPost (line 29) | function useBookmarkPost(): UseAsyncTask<
FILE: packages/react/src/post/useCreatePost.ts
type UseCreatePostArgs (line 17) | type UseCreatePostArgs = {
function useCreatePost (line 26) | function useCreatePost(
FILE: packages/react/src/post/useExecutePostAction.ts
type UseExecutePostActionArgs (line 14) | type UseExecutePostActionArgs = {
function useExecutePostAction (line 23) | function useExecutePostAction(
FILE: packages/react/src/post/usePost.ts
type UsePostArgs (line 12) | type UsePostArgs = PostRequest;
function usePost (line 36) | function usePost({
FILE: packages/react/src/post/usePostBookmarks.ts
type UsePostBookmarksArgs (line 16) | type UsePostBookmarksArgs = PostBookmarksRequest;
function usePostBookmarks (line 42) | function usePostBookmarks({
FILE: packages/react/src/post/usePostReactions.ts
type UsePostReactionsArgs (line 16) | type UsePostReactionsArgs = PostReactionsRequest;
function usePostReactions (line 47) | function usePostReactions({
FILE: packages/react/src/post/usePostReferences.ts
type UsePostReferencesArgs (line 16) | type UsePostReferencesArgs = PostReferencesRequest;
function usePostReferences (line 49) | function usePostReferences({
FILE: packages/react/src/post/usePostTags.ts
type UsePostTagsArgs (line 16) | type UsePostTagsArgs = PostTagsRequest;
function usePostTags (line 51) | function usePostTags({
FILE: packages/react/src/post/usePosts.ts
type UsePostsArgs (line 12) | type UsePostsArgs = PostsRequest;
function usePosts (line 45) | function usePosts({
FILE: packages/react/src/post/useUndoBookmarkPost.ts
function useUndoBookmarkPost (line 29) | function useUndoBookmarkPost(): UseAsyncTask<
FILE: packages/react/src/post/useWhoExecutedActionOnPost.ts
type UseWhoExecutedActionOnPostArgs (line 16) | type UseWhoExecutedActionOnPostArgs = WhoExecutedActionOnPostRequest;
function useWhoExecutedActionOnPost (line 47) | function useWhoExecutedActionOnPost({
FILE: packages/react/src/post/useWhoReferencedPost.ts
type UseWhoReferencedPostArgs (line 16) | type UseWhoReferencedPostArgs = WhoReferencedPostRequest;
function useWhoReferencedPost (line 45) | function useWhoReferencedPost({
FILE: packages/react/src/test-utils.tsx
function createWrapper (line 7) | function createWrapper(client: PublicClient) {
type RenderHookWithContextOptions (line 17) | type RenderHookWithContextOptions<TProps> = Omit<
function renderHookWithContext (line 42) | function renderHookWithContext<TProps, TResult>(
FILE: packages/react/src/timeline/useTimeline.ts
type UseTimelineArgs (line 16) | type UseTimelineArgs = TimelineRequest;
function useTimeline (line 42) | function useTimeline({
FILE: packages/react/src/timeline/useTimelineHighlights.ts
type UseTimelineHighlightsArgs (line 16) | type UseTimelineHighlightsArgs = TimelineHighlightsRequest;
function useTimelineHighlights (line 42) | function useTimelineHighlights({
FILE: packages/react/src/tokenDistribution/useTokenDistributions.ts
type UseTokenDistributionsArgs (line 15) | type UseTokenDistributionsArgs = TokenDistributionsRequest;
function useTokenDistributions (line 41) | function useTokenDistributions(
FILE: packages/react/src/username/useCanCreateUsername.ts
function useCanCreateUsername (line 18) | function useCanCreateUsername(): UseAsyncTask<
FILE: packages/react/src/username/useNamespace.ts
type UseNamespaceArgs (line 15) | type UseNamespaceArgs = NamespaceRequest;
function useNamespace (line 41) | function useNamespace({
FILE: packages/react/src/username/useUsernames.ts
type UseUsernamesArgs (line 16) | type UseUsernamesArgs = UsernamesRequest;
function useUsernames (line 53) | function useUsernames({
FILE: packages/react/src/viem/useUnknownPostActionEncoder.ts
function useUnknownPostActionEncoder (line 16) | function useUnknownPostActionEncoder(
FILE: packages/storage/src/BaseStorageSchema.ts
class SchemaMismatchError (line 15) | class SchemaMismatchError extends ResultAwareError {
method constructor (line 18) | constructor(schemaId: string, errors: string) {
type StorageMetadata (line 31) | type StorageMetadata = z.infer<typeof storageMetadata>;
type IStorageItem (line 33) | interface IStorageItem<Data> {
type IStorageSchema (line 43) | interface IStorageSchema<Data> {
class BaseStorageSchema (line 57) | class BaseStorageSchema<
method constructor (line 65) | constructor(
method migrate (line 85) | protected async migrate(storageItem: IStorageItem<Input>): Promise<Out...
method parseData (line 114) | protected parseData(data: Input): Output {
FILE: packages/storage/src/CredentialsStorageSchema.ts
type Credentials (line 10) | type Credentials = {
class CredentialsStorageSchema (line 26) | class CredentialsStorageSchema extends BaseStorageSchema<
method constructor (line 31) | constructor(key: string) {
method migrate (line 35) | protected override async migrate(
class CredentialsStorage (line 45) | class CredentialsStorage extends Storage<Credentials> {
method constructor (line 46) | protected constructor(provider: IStorageProvider, namespace: string) {
method from (line 53) | static from(
FILE: packages/storage/src/IStorage.ts
type StorageSubscriber (line 10) | type StorageSubscriber<Data> = (
type StorageProviderSubscriber (line 18) | type StorageProviderSubscriber = StorageSubscriber<string>;
type IStorageProvider (line 23) | interface IStorageProvider {
type StorageSubscription (line 32) | type StorageSubscription = {
type IObservableStorageProvider (line 39) | interface IObservableStorageProvider extends IStorageProvider {
type IStorage (line 49) | interface IStorage<Data> {
FILE: packages/storage/src/InMemoryStorageProvider.ts
class InMemoryStorageProvider (line 3) | class InMemoryStorageProvider implements IStorageProvider {
method constructor (line 6) | constructor() {
method getItem (line 10) | getItem(key: string): string | null {
method setItem (line 14) | setItem(key: string, value: string): void {
method removeItem (line 18) | removeItem(key: string): void {
FILE: packages/storage/src/Storage.test.ts
function createStorage (line 27) | function createStorage(provider: IStorageProvider) {
class TestStorageSchema (line 82) | class TestStorageSchema extends BaseStorageSchema<typeof newSchema> {
method migrate (line 85) | protected async migrate(
class TestStorageSchema (line 126) | class TestStorageSchema extends BaseStorageSchema<typeof schema> {
method migrate (line 85) | protected async migrate(
FILE: packages/storage/src/Storage.ts
class StorageError (line 28) | class StorageError extends ResultAwareError {
class Storage (line 42) | class Storage<Data> implements IStorage<Data> {
method constructor (line 45) | constructor(
method get (line 50) | get(): Data | null {
method reset (line 54) | reset(): ResultAsync<Storage<Data>, StorageError> {
method set (line 64) | set(
method resume (line 88) | resume(): ResultAsync<IStorage<Data>, SchemaMismatchError | StorageErr...
method subscribe (line 104) | subscribe(subscriber: StorageSubscriber<Data>): StorageSubscription {
method create (line 127) | static create<D>(
method parse (line 135) | private parse(
FILE: packages/storage/src/__helpers__/mocks.ts
function mockStorageProvider (line 10) | function mockStorageProvider(
function mockStorageRoundTrip (line 43) | function mockStorageRoundTrip(data: unknown): unknown {
type IMockedStorage (line 47) | interface IMockedStorage<T> extends IStorage<T> {
function mockStorage (line 51) | function mockStorage<T>(initial: T | null = null): IMockedStorage<T> {
FILE: packages/types/src/errors.ts
class ResultAwareError (line 3) | class ResultAwareError extends Error {
method asResultAsync (line 7) | asResultAsync(): ResultAsync<never, typeof this> {
method asResult (line 14) | asResult(): Result<never, typeof this> {
method from (line 29) | static from<T extends typeof ResultAwareError>(
method is (line 43) | static is<T extends typeof ResultAwareError>(
method formatMessage (line 51) | private static formatMessage(cause: Error): string {
FILE: packages/types/src/helpers/Deferred.ts
class Deferred (line 4) | class Deferred<T = void> {
method constructor (line 9) | constructor() {
FILE: packages/types/src/helpers/assertions.ts
function isObject (line 5) | function isObject(value: unknown): value is UnknownRecord {
function assertError (line 10) | function assertError(error: unknown): asserts error is Error {
function assertNever (line 22) | function assertNever(
function assertOk (line 32) | function assertOk<T, E extends Error>(
function assertErr (line 45) | function assertErr<T, E extends Error>(
function assertNotNull (line 56) | function assertNotNull<T>(value: T): asserts value is Exclude<T, null> {
FILE: packages/types/src/helpers/fail.ts
function fail (line 11) | function fail(value: unknown): never {
FILE: packages/types/src/helpers/identity.ts
function identity (line 8) | function identity<T>(value: T): T {
FILE: packages/types/src/helpers/invariant.ts
class InvariantError (line 4) | class InvariantError extends Error {
function invariant (line 15) | function invariant(
FILE: packages/types/src/helpers/never.ts
function never (line 3) | function never(message = 'Unexpected call to never()'): never {
FILE: packages/types/src/helpers/refinements.ts
function nonNullable (line 6) | function nonNullable<T>(value: T): Exclude<T, null | undefined> {
function expectTypename (line 16) | function expectTypename<
FILE: packages/types/src/helpers/typeguards.ts
function isObject (line 1) | function isObject(value: unknown): value is Record<string, unknown> {
FILE: packages/types/src/hex.ts
type HexString (line 7) | type HexString = `0x${string}`;
function isValidHexString (line 12) | function isValidHexString(value: string): value is HexString {
function hexString (line 20) | function hexString<T extends string = HexString>(value: string): T {
type EvmAddress (line 31) | type EvmAddress = Tagged<HexString, 'EvmAddress'>;
function evmAddress (line 36) | function evmAddress(value: string) {
type BlockchainData (line 44) | type BlockchainData = Tagged<HexString, 'BlockchainData'>;
type Signature (line 50) | type Signature = Tagged<HexString, 'Signature'>;
type EncodedTransaction (line 56) | type EncodedTransaction = Tagged<HexString, 'EncodedTransaction'>;
type TxHash (line 61) | type TxHash = Tagged<HexString, 'TxHash'>;
type FixedBytes32 (line 69) | type FixedBytes32 = Tagged<HexString, 'FixedBytes32'>;
function fixedBytes32 (line 70) | function fixedBytes32(value: string) {
FILE: packages/types/src/id.ts
type ID (line 7) | type ID = Tagged<string, 'ID'>;
type UUID (line 12) | type UUID = Tagged<
type PostId (line 21) | type PostId = Tagged<string, 'PostId'>;
type RuleId (line 27) | type RuleId = Tagged<string, 'RuleId'>;
type GrantId (line 33) | type GrantId = Tagged<string, 'GrantId'>;
type LegacyProfileId (line 39) | type LegacyProfileId = Tagged<string, 'LegacyProfileId'>;
type UsernameValue (line 44) | type UsernameValue = Tagged<`${string}/${string}`, 'UsernameValue'>;
FILE: packages/types/src/jwt.ts
type CompactJwt (line 6) | type CompactJwt = `${string}.${string}.${string}`;
function compactJwt (line 7) | function compactJwt<T extends string = CompactJwt>(value: string): T {
type AccessToken (line 14) | type AccessToken = Tagged<CompactJwt, 'AccessToken'>;
type RefreshToken (line 23) | type RefreshToken = Tagged<CompactJwt, 'RefreshToken'>;
type IdToken (line 32) | type IdToken = Tagged<CompactJwt, 'IdToken'>;
FILE: packages/types/src/misc.ts
type Void (line 7) | type Void = Tagged<undefined, 'Void'>;
type Cursor (line 12) | type Cursor = Tagged<string, 'Cursor'>;
type DateTime (line 17) | type DateTime = Tagged<string, 'DateTime'>;
type JsonString (line 23) | type JsonString = Tagged<string, 'JsonString'>;
type Prettify (line 33) | type Prettify<T> = {
FILE: packages/types/src/number.ts
type BigDecimal (line 7) | type BigDecimal = Tagged<string, 'BigDecimal'>;
function bigDecimal (line 8) | function bigDecimal(value: string | number): BigDecimal {
type BigIntString (line 17) | type BigIntString = Tagged<string, 'BigIntString'>;
function bigIntString (line 18) | function bigIntString(value: string): BigIntString {
FILE: packages/types/src/tag.ts
type AnyTagged (line 3) | type AnyTagged = Tagged<unknown, PropertyKey>;
function tag (line 12) | function tag<T extends AnyTagged>(value: UnwrapTagged<T>): T {
FILE: packages/types/src/uri.ts
type URI (line 10) | type URI = Tagged<string, 'URI'>;
type URL (line 20) | type URL = Tagged<string, 'URL'>;
FILE: templates/example-react/src/App.tsx
function App (line 4) | function App() {
FILE: vite-env.d.ts
type ImportMetaEnv (line 3) | interface ImportMetaEnv {
type ImportMeta (line 13) | interface ImportMeta {
FILE: vitest.d.ts
type AsymmetricMatchersContaining (line 4) | interface AsymmetricMatchersContaining extends JestExtendedMatchers {}
Condensed preview — 423 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (2,081K chars).
[
{
"path": ".changeset/README.md",
"chars": 510,
"preview": "# Changesets\n\nHello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that wo"
},
{
"path": ".changeset/config.json",
"chars": 320,
"preview": "{\n \"$schema\": \"https://unpkg.com/@changesets/config@3.0.4/schema.json\",\n \"changelog\": \"@changesets/cli/changelog\",\n \""
},
{
"path": ".changeset/giant-buckets-melt.md",
"chars": 124,
"preview": "---\n\"@lens-protocol/client\": minor\n\"@lens-protocol/react\": minor\n---\n\n**feat**: add post action encoder and execution ho"
},
{
"path": ".changeset/nice-baboons-protect.md",
"chars": 235,
"preview": "---\n\"@lens-protocol/client\": major\n\"@lens-protocol/react\": major\n\"@lens-protocol/storage\": minor\n\"@lens-protocol/env\": m"
},
{
"path": ".changeset/pre.json",
"chars": 340,
"preview": "{\n \"mode\": \"pre\",\n \"tag\": \"alpha\",\n \"initialVersions\": {\n \"@lens-protocol/client\": \"2.3.2\",\n \"@lens-protocol/en"
},
{
"path": ".editorconfig",
"chars": 137,
"preview": "root = true\n\n[*]\ncharset = utf-8\ninsert_final_newline = true\nend_of_line = lf\nindent_style = space\nindent_size = 2\nmax_l"
},
{
"path": ".github/actions/setup/action.yml",
"chars": 383,
"preview": "name: 'Setup'\ndescription: 'Setup repo and install dependencies'\n\nruns:\n using: 'composite'\n steps:\n - name: Setup "
},
{
"path": ".github/actions/tests/action.yml",
"chars": 1894,
"preview": "name: 'Test Workflow'\ndescription: 'Run tests against a specified environment'\n\ninputs:\n environment:\n description: "
},
{
"path": ".github/workflows/dependency-review.yml",
"chars": 441,
"preview": "name: Dependency Review\non:\n - pull_request\n\npermissions:\n contents: read\n pull-requests: write\n\njobs:\n dependency-r"
},
{
"path": ".github/workflows/pull-request.yml",
"chars": 290,
"preview": "name: Pull Request\non:\n workflow_dispatch:\n pull_request:\n branches: [main]\n\nconcurrency:\n group: ${{ github.workf"
},
{
"path": ".github/workflows/snapshot.yml",
"chars": 1226,
"preview": "name: Canary Release\n\non:\n push:\n branches: [main]\n\nconcurrency:\n group: ${{ github.workflow }}-${{ github.head_ref"
},
{
"path": ".github/workflows/trigger-tests.yml",
"chars": 1270,
"preview": "name: Run Tests on Demand\n\non:\n repository_dispatch:\n types: [on-demand-test]\n workflow_dispatch:\n inputs:\n "
},
{
"path": ".github/workflows/verify.yml",
"chars": 895,
"preview": "name: 'Verify'\non:\n workflow_call:\n workflow_dispatch:\n\njobs:\n lint:\n name: Lint\n runs-on: ubuntu-latest\n\n s"
},
{
"path": ".gitignore",
"chars": 388,
"preview": "# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.\n\n# dependencies\nnode_modules\n.pnp\n"
},
{
"path": ".npmrc",
"chars": 105,
"preview": "engine-strict=true\nauto-install-peers=false\nstrict-peer-dependencies=false\nlink-workspace-packages=false\n"
},
{
"path": ".nvmrc",
"chars": 8,
"preview": "20.13.1\n"
},
{
"path": ".prettierignore",
"chars": 22,
"preview": "# use biome instead\n*\n"
},
{
"path": ".vscode/settings.json",
"chars": 1097,
"preview": "{\n \"[graphql]\": {\n \"editor.defaultFormatter\": \"biomejs.biome\",\n \"editor.formatOnSave\": false\n },\n \"[typescript]"
},
{
"path": "LICENSE",
"chars": 1083,
"preview": "MIT License\n\nCopyright (c) Avara Labs Cayman Holdings SEZC\n\nPermission is hereby granted, free of charge, to any person "
},
{
"path": "README.md",
"chars": 4239,
"preview": "# Lens SDK\n\nThe official SDK for the Lens 🌿.\n\n## Table of Contents <!-- omit in toc -->\n\n- [Installation](#installation)"
},
{
"path": "biome.json",
"chars": 2084,
"preview": "{\n\t\"$schema\": \"https://biomejs.dev/schemas/2.0.6/schema.json\",\n\t\"vcs\": {\n\t\t\"enabled\": true,\n\t\t\"clientKind\": \"git\",\n\t\t\"us"
},
{
"path": "examples/create-app/README.md",
"chars": 186,
"preview": "# Create an App\n\n[](https://stackblitz"
},
{
"path": "examples/create-app/index.html",
"chars": 565,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-w"
},
{
"path": "examples/create-app/index.ts",
"chars": 1949,
"preview": "import 'viem/window';\n\nimport { chains } from '@lens-chain/sdk/viem';\nimport { immutable, StorageClient } from '@lens-ch"
},
{
"path": "examples/create-app/package.json",
"chars": 395,
"preview": "{\n \"name\": \"example-create-app\",\n \"private\": true,\n \"type\": \"module\",\n \"scripts\": {\n \"dev\": \"vite\"\n },\n \"depend"
},
{
"path": "examples/create-app/tsconfig.json",
"chars": 447,
"preview": "{\n \"compilerOptions\": {\n \"target\": \"ESNext\",\n \"useDefineForClassFields\": true,\n \"lib\": [\"ESNext\", \"DOM\"],\n "
},
{
"path": "examples/custom-fragments/README.md",
"chars": 195,
"preview": "# Custom Fragments\n\n[](https://stackbl"
},
{
"path": "examples/custom-fragments/index.html",
"chars": 568,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-w"
},
{
"path": "examples/custom-fragments/index.ts",
"chars": 1790,
"preview": "import {\n type Account,\n ArticleMetadataFragment,\n AudioMetadataFragment,\n evmAddress,\n type FragmentOf,\n graphql,"
},
{
"path": "examples/custom-fragments/package.json",
"chars": 283,
"preview": "{\n \"name\": \"example-custom-fragments\",\n \"private\": true,\n \"type\": \"module\",\n \"scripts\": {\n \"dev\": \"vite\"\n },\n \""
},
{
"path": "examples/custom-fragments/tsconfig.json",
"chars": 447,
"preview": "{\n \"compilerOptions\": {\n \"target\": \"ESNext\",\n \"useDefineForClassFields\": true,\n \"lib\": [\"ESNext\", \"DOM\"],\n "
},
{
"path": "examples/nextjs-client/.gitignore",
"chars": 480,
"preview": "# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.\n\n# dependencies\n/node_modules\n/.pn"
},
{
"path": "examples/nextjs-client/.stackblitzrc",
"chars": 49,
"preview": "{\n \"startCommand\": \"npm run dev\",\n \"env\": {}\n}\n"
},
{
"path": "examples/nextjs-client/README.md",
"chars": 368,
"preview": "# Next.js - Lens Client Integration Example\n\nThis is a [Next.js](https://nextjs.org) project bootstrapped with [`create-"
},
{
"path": "examples/nextjs-client/next.config.ts",
"chars": 133,
"preview": "import type { NextConfig } from 'next';\n\nconst nextConfig: NextConfig = {\n /* config options here */\n};\n\nexport default"
},
{
"path": "examples/nextjs-client/package.json",
"chars": 493,
"preview": "{\n \"name\": \"nextjs-client\",\n \"version\": \"0.1.0\",\n \"private\": true,\n \"scripts\": {\n \"dev\": \"next dev\",\n \"build\":"
},
{
"path": "examples/nextjs-client/src/app/Web3Providers.tsx",
"chars": 249,
"preview": "'use client';\n\nimport { LensProvider } from '@lens-protocol/react';\nimport { client } from './client';\n\nexport function "
},
{
"path": "examples/nextjs-client/src/app/client.ts",
"chars": 135,
"preview": "import { PublicClient, testnet } from '@lens-protocol/react';\n\nexport const client = PublicClient.create({\n environment"
},
{
"path": "examples/nextjs-client/src/app/globals.css",
"chars": 608,
"preview": ":root {\n --background: #ffffff;\n --foreground: #171717;\n}\n\n@media (prefers-color-scheme: dark) {\n :root {\n --backg"
},
{
"path": "examples/nextjs-client/src/app/layout.tsx",
"chars": 906,
"preview": "import type { Metadata } from 'next';\nimport { Geist, Geist_Mono } from 'next/font/google';\nimport 'simpledotcss/simple."
},
{
"path": "examples/nextjs-client/src/app/page.tsx",
"chars": 487,
"preview": "'use client';\n\nimport { AccountsOrderBy, PageSize, useAccounts } from '@lens-protocol/react';\n\nexport default function H"
},
{
"path": "examples/nextjs-client/tsconfig.json",
"chars": 602,
"preview": "{\n \"compilerOptions\": {\n \"target\": \"ES2017\",\n \"lib\": [\"dom\", \"dom.iterable\", \"esnext\"],\n \"allowJs\": true,\n "
},
{
"path": "examples/react-follow/README.md",
"chars": 207,
"preview": "# Follow/Unfollow Accounts on Lens\n\n[]"
},
{
"path": "examples/react-follow/index.html",
"chars": 472,
"preview": "<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <link rel=\"icon\" type=\"image/svg+xml\" href=\"/"
},
{
"path": "examples/react-follow/package.json",
"chars": 629,
"preview": "{\n \"name\": \"react-follow\",\n \"description\": \"Follow/Unfollow accounts on Lens\",\n \"private\": true,\n \"version\": \"0.0.0\""
},
{
"path": "examples/react-follow/src/AccountToFollow.tsx",
"chars": 812,
"preview": "import { PageSize, useAccounts } from '@lens-protocol/react';\nimport { FollowButton } from './FollowButton';\n\nexport fun"
},
{
"path": "examples/react-follow/src/App.tsx",
"chars": 287,
"preview": "import { AccountsToFollow } from './AccountToFollow';\n\nexport function App() {\n return (\n <div style={{ padding: '20"
},
{
"path": "examples/react-follow/src/FollowButton.tsx",
"chars": 1109,
"preview": "import { type Account, useFollow, useUnfollow } from '@lens-protocol/react';\nimport { handleOperationWith } from '@lens-"
},
{
"path": "examples/react-follow/src/Web3Providers.tsx",
"chars": 714,
"preview": "import { LensProvider } from '@lens-protocol/react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-q"
},
{
"path": "examples/react-follow/src/client.ts",
"chars": 1165,
"preview": "import { fetchAccountsAvailable } from '@lens-protocol/client/actions';\nimport {\n assertOk,\n cache,\n invariant,\n Pub"
},
{
"path": "examples/react-follow/src/config.ts",
"chars": 660,
"preview": "import { chains } from '@lens-chain/sdk/viem';\nimport { getDefaultConfig } from 'connectkit';\nimport { createConfig, htt"
},
{
"path": "examples/react-follow/src/main.tsx",
"chars": 328,
"preview": "import { Suspense } from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { App } from './App';\nimport { W"
},
{
"path": "examples/react-follow/src/vite-env.d.ts",
"chars": 38,
"preview": "/// <reference types=\"vite/client\" />\n"
},
{
"path": "examples/react-follow/src/wallet.ts",
"chars": 589,
"preview": "import { chains } from '@lens-chain/sdk/viem';\nimport { type Address, createWalletClient, custom } from 'viem';\n\nconst c"
},
{
"path": "examples/react-follow/tsconfig.json",
"chars": 506,
"preview": "{\n \"compilerOptions\": {\n \"target\": \"ESNext\",\n \"useDefineForClassFields\": true,\n \"lib\": [\"ES2020\", \"DOM\", \"DOM."
},
{
"path": "examples/react-follow/vite.config.ts",
"chars": 140,
"preview": "import react from '@vitejs/plugin-react-swc';\nimport { defineConfig } from 'vite';\n\nexport default defineConfig({\n plug"
},
{
"path": "examples/react-login/README.md",
"chars": 188,
"preview": "# Log in to Lens\n\n[](https://stackblit"
},
{
"path": "examples/react-login/index.html",
"chars": 472,
"preview": "<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <link rel=\"icon\" type=\"image/svg+xml\" href=\"/"
},
{
"path": "examples/react-login/package.json",
"chars": 610,
"preview": "{\n \"name\": \"react-login\",\n \"description\": \"Log in to Lens\",\n \"private\": true,\n \"version\": \"0.0.0\",\n \"type\": \"module"
},
{
"path": "examples/react-login/src/App.tsx",
"chars": 324,
"preview": "import { useAuthenticatedUser } from '@lens-protocol/react';\nimport { LoginForm } from './LoginForm';\nimport { MyAccount"
},
{
"path": "examples/react-login/src/LoginForm.tsx",
"chars": 1758,
"preview": "import {\n type AccountAvailable,\n type EvmAddress,\n evmAddress,\n useAccountsAvailable,\n useLogin,\n} from '@lens-pro"
},
{
"path": "examples/react-login/src/LogoutButton.tsx",
"chars": 384,
"preview": "import { useLogout } from '@lens-protocol/react';\nimport { useDisconnect } from 'wagmi';\n\nexport function LogoutButton()"
},
{
"path": "examples/react-login/src/MyAccount.tsx",
"chars": 511,
"preview": "import { type EvmAddress, useAccount } from '@lens-protocol/react';\nimport { LogoutButton } from './LogoutButton';\n\nexpo"
},
{
"path": "examples/react-login/src/Web3Providers.tsx",
"chars": 714,
"preview": "import { LensProvider } from '@lens-protocol/react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-q"
},
{
"path": "examples/react-login/src/client.ts",
"chars": 167,
"preview": "import { mainnet, PublicClient } from '@lens-protocol/react';\n\nexport const client = PublicClient.create({\n environment"
},
{
"path": "examples/react-login/src/config.ts",
"chars": 673,
"preview": "import { chains } from '@lens-chain/sdk/viem';\nimport { getDefaultConfig } from 'connectkit';\nimport { createConfig, htt"
},
{
"path": "examples/react-login/src/main.tsx",
"chars": 328,
"preview": "import { Suspense } from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { App } from './App';\nimport { W"
},
{
"path": "examples/react-login/src/vite-env.d.ts",
"chars": 38,
"preview": "/// <reference types=\"vite/client\" />\n"
},
{
"path": "examples/react-login/tsconfig.json",
"chars": 506,
"preview": "{\n \"compilerOptions\": {\n \"target\": \"ESNext\",\n \"useDefineForClassFields\": true,\n \"lib\": [\"ES2020\", \"DOM\", \"DOM."
},
{
"path": "examples/react-login/vite.config.ts",
"chars": 140,
"preview": "import react from '@vitejs/plugin-react-swc';\nimport { defineConfig } from 'vite';\n\nexport default defineConfig({\n plug"
},
{
"path": "examples/react-post/README.md",
"chars": 213,
"preview": "# Create a Lens Post with Lens React Hooks\n\n[](https://stackbl"
},
{
"path": "examples/thirdweb-onramp/index.html",
"chars": 551,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-w"
},
{
"path": "examples/thirdweb-onramp/package.json",
"chars": 762,
"preview": "{\n \"name\": \"example-thirdweb-onramp\",\n \"private\": true,\n \"type\": \"module\",\n \"scripts\": {\n \"dev\": \"vite\"\n },\n \"d"
},
{
"path": "examples/thirdweb-onramp/src/App.tsx",
"chars": 2000,
"preview": "import 'viem/window';\nimport { chains } from '@lens-chain/sdk/viem';\nimport { createThirdwebClient } from 'thirdweb';\nim"
},
{
"path": "examples/thirdweb-onramp/src/main.tsx",
"chars": 762,
"preview": "import { chains } from '@lens-chain/sdk/viem';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';"
},
{
"path": "examples/thirdweb-onramp/tsconfig.json",
"chars": 506,
"preview": "{\n \"compilerOptions\": {\n \"target\": \"ESNext\",\n \"useDefineForClassFields\": true,\n \"lib\": [\"ES2020\", \"DOM\", \"DOM."
},
{
"path": "examples/thirdweb-onramp/vite.config.ts",
"chars": 140,
"preview": "import react from '@vitejs/plugin-react-swc';\nimport { defineConfig } from 'vite';\n\nexport default defineConfig({\n plug"
},
{
"path": "examples/user-onboarding/README.md",
"chars": 193,
"preview": "# User Onboarding\n\n[](https://stackbli"
},
{
"path": "examples/user-onboarding/index.html",
"chars": 575,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-w"
},
{
"path": "examples/user-onboarding/index.ts",
"chars": 1925,
"preview": "import 'viem/window';\n\nimport { chains } from '@lens-chain/sdk/viem';\nimport { immutable, StorageClient } from '@lens-ch"
},
{
"path": "examples/user-onboarding/package.json",
"chars": 400,
"preview": "{\n \"name\": \"example-user-onboarding\",\n \"private\": true,\n \"type\": \"module\",\n \"scripts\": {\n \"dev\": \"vite\"\n },\n \"d"
},
{
"path": "examples/user-onboarding/tsconfig.json",
"chars": 447,
"preview": "{\n \"compilerOptions\": {\n \"target\": \"ESNext\",\n \"useDefineForClassFields\": true,\n \"lib\": [\"ESNext\", \"DOM\"],\n "
},
{
"path": "jest-extended.d.ts",
"chars": 300,
"preview": "import type CustomMatchers from 'jest-extended';\nimport 'vitest';\n\ndeclare module 'vitest' {\n interface Assertion<T = u"
},
{
"path": "package.json",
"chars": 1303,
"preview": "{\n \"name\": \"lens-sdk\",\n \"version\": \"0.0.0\",\n \"description\": \"The quickest way to build on top of Lens.\",\n \"private\":"
},
{
"path": "packages/client/CHANGELOG.md",
"chars": 327,
"preview": "# @lens-protocol/client\n\n## 3.0.0-alpha.0\n\n### Major Changes\n\n- 8073fb7: **chore**: transition to new major release\n\n###"
},
{
"path": "packages/client/README.md",
"chars": 229,
"preview": "# Lens JavaScript SDK\n\nThe official framework-agnostic JavaScript SDK for Lens Protocol.\n\n---\n\nThis package enables you "
},
{
"path": "packages/client/package.json",
"chars": 2527,
"preview": "{\n \"name\": \"@lens-protocol/client\",\n \"version\": \"3.0.0-alpha.0\",\n \"description\": \"Low-level Lens API client\",\n \"repo"
},
{
"path": "packages/client/src/AuthenticatedUser.ts",
"chars": 1646,
"preview": "import { Role } from '@lens-protocol/graphql';\nimport {\n type EvmAddress,\n err,\n never,\n ok,\n type Result,\n type U"
},
{
"path": "packages/client/src/actions/account.test.ts",
"chars": 594,
"preview": "import { assertOk, evmAddress } from '@lens-protocol/types';\nimport { describe, it } from 'vitest';\n\nimport { createPubl"
},
{
"path": "packages/client/src/actions/account.ts",
"chars": 13229,
"preview": "import type {\n Account,\n AccountAvailable,\n AccountBlocked,\n AccountFeedsStats,\n AccountFeedsStatsRequest,\n Accoun"
},
{
"path": "packages/client/src/actions/accountManager.test.ts",
"chars": 2918,
"preview": "import { immutable } from '@lens-chain/storage-client';\nimport { type Account, assertTypename } from '@lens-protocol/gra"
},
{
"path": "packages/client/src/actions/accountManager.ts",
"chars": 4640,
"preview": "import type {\n AccountManager,\n AccountManagerPermissionsInput,\n AccountManagersRequest,\n AddAccountManagerResult,\n "
},
{
"path": "packages/client/src/actions/actions.ts",
"chars": 6501,
"preview": "import type {\n ConfigureAccountActionRequest,\n ConfigureAccountActionResult,\n ConfigurePostActionRequest,\n Configure"
},
{
"path": "packages/client/src/actions/admins.ts",
"chars": 2208,
"preview": "import type {\n AddAdminsRequest,\n AddAdminsResult,\n Admin,\n AdminsForRequest,\n Paginated,\n RemoveAdminsRequest,\n "
},
{
"path": "packages/client/src/actions/app.ts",
"chars": 16553,
"preview": "import type {\n AddAppAuthorizationEndpointRequest,\n AddAppFeedsRequest,\n AddAppFeedsResult,\n AddAppGroupsRequest,\n "
},
{
"path": "packages/client/src/actions/authentication.ts",
"chars": 5556,
"preview": "import type {\n Account,\n AuthenticatedSession,\n AuthenticatedSessionsRequest,\n LastLoggedInAccountRequest,\n MeResul"
},
{
"path": "packages/client/src/actions/feed.ts",
"chars": 3421,
"preview": "import type {\n CreateFeedRequest,\n CreateFeedResult,\n Feed,\n FeedRequest,\n FeedsRequest,\n Paginated,\n SetFeedMeta"
},
{
"path": "packages/client/src/actions/follow.ts",
"chars": 3946,
"preview": "import type {\n CreateFollowRequest,\n CreateUnfollowRequest,\n Follower,\n FollowersRequest,\n FollowersYouKnowRequest,"
},
{
"path": "packages/client/src/actions/frames.ts",
"chars": 3135,
"preview": "import type {\n CreateFrameEip712TypedDataFragment,\n CreateFrameTypedDataRequest,\n FrameLensManagerSignatureResultFrag"
},
{
"path": "packages/client/src/actions/funds.e2e.ts",
"chars": 7353,
"preview": "import type { Erc20Amount, NativeAmount } from '@lens-protocol/graphql';\nimport { assertOk, bigDecimal, evmAddress, Resu"
},
{
"path": "packages/client/src/actions/funds.ts",
"chars": 4455,
"preview": "import type {\n AccountBalancesRequest,\n AnyAccountBalance,\n AnyBalance,\n BalancesBulkRequest,\n DepositRequest,\n De"
},
{
"path": "packages/client/src/actions/graph.ts",
"chars": 3472,
"preview": "import type {\n CreateGraphRequest,\n CreateGraphResult,\n Graph,\n GraphRequest,\n GraphsRequest,\n Paginated,\n SetGra"
},
{
"path": "packages/client/src/actions/group.e2e.ts",
"chars": 2047,
"preview": "import type { EvmAddress } from '@lens-chain/storage-client';\nimport { group } from '@lens-protocol/metadata';\nimport { "
},
{
"path": "packages/client/src/actions/group.ts",
"chars": 12556,
"preview": "import type {\n ApproveGroupMembershipRequest,\n ApproveGroupMembershipResult,\n BanGroupAccountsRequest,\n BanGroupAcco"
},
{
"path": "packages/client/src/actions/helpers.ts",
"chars": 1845,
"preview": "import { InvariantError } from '@lens-chain/storage-client';\nimport type {\n AnyAccountBalance,\n Erc20Amount,\n NativeA"
},
{
"path": "packages/client/src/actions/index.ts",
"chars": 704,
"preview": "export * from './account';\nexport * from './accountManager';\nexport * from './actions';\nexport * from './admins';\nexport"
},
{
"path": "packages/client/src/actions/metadata.test.ts",
"chars": 2129,
"preview": "import { justPost, type Post } from '@lens-protocol/graphql';\nimport { textOnly } from '@lens-protocol/metadata';\nimport"
},
{
"path": "packages/client/src/actions/metadata.ts",
"chars": 3025,
"preview": "import type {\n RefreshMetadataRequest,\n RefreshMetadataResult,\n RefreshMetadataStatusRequest,\n RefreshMetadataStatus"
},
{
"path": "packages/client/src/actions/misc.ts",
"chars": 1836,
"preview": "import {\n AccessControlQuery,\n type AccessControlRequest,\n type AccessControlResult,\n HealthQuery,\n type Paginated,"
},
{
"path": "packages/client/src/actions/ml.e2e.ts",
"chars": 1382,
"preview": "import { assertOk } from '@lens-protocol/types';\nimport { beforeAll, describe, it } from 'vitest';\nimport type { Session"
},
{
"path": "packages/client/src/actions/ml.ts",
"chars": 3777,
"preview": "import type {\n Account,\n AccountRecommendationsRequest,\n DismissRecommendedAccountsRequest,\n Paginated,\n Post,\n Po"
},
{
"path": "packages/client/src/actions/namespace.ts",
"chars": 5276,
"preview": "import type {\n CreateUsernameNamespaceRequest,\n CreateUsernameNamespaceResult,\n NamespaceRequest,\n NamespaceReserved"
},
{
"path": "packages/client/src/actions/notifications.test.ts",
"chars": 493,
"preview": "import { assertOk } from '@lens-protocol/types';\nimport { describe, it } from 'vitest';\n\nimport { loginAsAccountOwner } "
},
{
"path": "packages/client/src/actions/notifications.ts",
"chars": 892,
"preview": "import type {\n Notification,\n NotificationsRequest,\n Paginated,\n} from '@lens-protocol/graphql';\nimport { Notificatio"
},
{
"path": "packages/client/src/actions/onboarding.e2e.ts",
"chars": 5316,
"preview": "import { type Account, RulesSubject } from '@lens-protocol/graphql';\nimport { account } from '@lens-protocol/metadata';\n"
},
{
"path": "packages/client/src/actions/post.test.ts",
"chars": 2232,
"preview": "import { justPost } from '@lens-protocol/graphql';\nimport { textOnly } from '@lens-protocol/metadata';\nimport { assertOk"
},
{
"path": "packages/client/src/actions/post.ts",
"chars": 6839,
"preview": "import type {\n AddReactionRequest,\n AddReactionResult,\n BookmarkPostRequest,\n CreatePostRequest,\n CreateRepostReque"
},
{
"path": "packages/client/src/actions/posts.test.ts",
"chars": 545,
"preview": "import { assertOk, postId } from '@lens-protocol/types';\nimport { describe, it } from 'vitest';\n\nimport { createPublicCl"
},
{
"path": "packages/client/src/actions/posts.ts",
"chars": 7467,
"preview": "import type {\n Account,\n AccountExecutedActions,\n AccountPostReaction,\n AnyPost,\n Paginated,\n PostActionContract,\n"
},
{
"path": "packages/client/src/actions/sns.ts",
"chars": 2275,
"preview": "import type {\n CreateSnsSubscriptionRequest,\n DeleteSnsSubscriptionRequest,\n GetSnsSubscriptionsRequest,\n SnsSubscri"
},
{
"path": "packages/client/src/actions/sponsorship.ts",
"chars": 9751,
"preview": "import {\n CreateSponsorshipMutation,\n type CreateSponsorshipRequest,\n type CreateSponsorshipResult,\n type Paginated,"
},
{
"path": "packages/client/src/actions/timeline.ts",
"chars": 1492,
"preview": "import type {\n AnyPost,\n Paginated,\n TimelineHighlightsRequest,\n TimelineItem,\n TimelineRequest,\n} from '@lens-prot"
},
{
"path": "packages/client/src/actions/tipping.e2e.ts",
"chars": 3795,
"preview": "import { justPost, type Post } from '@lens-protocol/graphql';\nimport { textOnly } from '@lens-protocol/metadata';\nimport"
},
{
"path": "packages/client/src/actions/transactions.ts",
"chars": 1677,
"preview": "import type {\n PrepareSignerErc20ApprovalRequest,\n PrepareSignerErc20ApprovalResult,\n TransactionStatusRequest,\n Tra"
},
{
"path": "packages/client/src/actions/transfer.ts",
"chars": 995,
"preview": "import type {\n TransferPrimitiveOwnershipRequest,\n TransferPrimitiveOwnershipResult,\n} from '@lens-protocol/graphql';\n"
},
{
"path": "packages/client/src/actions/username.ts",
"chars": 4109,
"preview": "import type {\n AssignUsernameToAccountRequest,\n AssignUsernameToAccountResult,\n CanCreateUsernameRequest,\n CanCreate"
},
{
"path": "packages/client/src/authorization.ts",
"chars": 775,
"preview": "/**\n * Operations types.\n */\nexport enum OperationType {\n Post = 'Post',\n Repost = 'Repost',\n EditPost = 'EditPost',\n"
},
{
"path": "packages/client/src/batch.ts",
"chars": 5221,
"preview": "import type { AnyVariables, StandardData } from '@lens-protocol/graphql';\nimport { Deferred, invariant, never, ResultAsy"
},
{
"path": "packages/client/src/cache.ts",
"chars": 12828,
"preview": "import type {\n Account,\n App,\n CreateFollowRequest,\n CreateUnfollowRequest,\n Feed,\n FollowResult,\n Graph,\n Group"
},
{
"path": "packages/client/src/clients.test.ts",
"chars": 11243,
"preview": "import type { Account } from '@lens-protocol/graphql';\nimport {\n AuthenticateMutation,\n CurrentSessionQuery,\n graphql"
},
{
"path": "packages/client/src/clients.ts",
"chars": 25533,
"preview": "import type {\n AuthenticationChallenge,\n ChallengeRequest,\n SignedAuthChallenge,\n StandardData,\n SwitchAccountReque"
},
{
"path": "packages/client/src/config.ts",
"chars": 1228,
"preview": "import type { EnvironmentConfig } from '@lens-protocol/env';\nimport type { IStorageProvider } from '@lens-protocol/stora"
},
{
"path": "packages/client/src/context.ts",
"chars": 876,
"preview": "import type { EnvironmentConfig } from '@lens-protocol/env';\nimport {\n InMemoryStorageProvider,\n type IStorageProvider"
},
{
"path": "packages/client/src/crossRegion.e2e.ts",
"chars": 4439,
"preview": "import * as storage from '@lens-chain/storage-client';\nimport type { Account } from '@lens-protocol/graphql';\nimport * a"
},
{
"path": "packages/client/src/errors.ts",
"chars": 2371,
"preview": "import { ResultAwareError } from '@lens-protocol/types';\nimport type { CombinedError } from '@urql/core';\nimport type { "
},
{
"path": "packages/client/src/ethers/__snapshots__/encoding.test.ts.snap",
"chars": 4554,
"preview": "// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html\n\nexports[`Given the encodeKeyValuePairs helper > When enco"
},
{
"path": "packages/client/src/ethers/encoding.test.ts",
"chars": 1901,
"preview": "import type { KeyValuePair } from '@lens-protocol/graphql';\nimport { fixedBytes32 } from '@lens-protocol/types';\nimport "
},
{
"path": "packages/client/src/ethers/encoding.ts",
"chars": 1363,
"preview": "import type { KeyValuePair } from '@lens-protocol/graphql';\nimport type { BlockchainData } from '@lens-protocol/types';\n"
},
{
"path": "packages/client/src/ethers/index.ts",
"chars": 85,
"preview": "export * from './encoding';\nexport * from './signer';\nexport * from './sponsorship';\n"
},
{
"path": "packages/client/src/ethers/signer.test.ts",
"chars": 1194,
"preview": "import { getDefaultProvider, Network, Wallet } from '@lens-chain/sdk/ethers';\nimport { assertOk, uri } from '@lens-proto"
},
{
"path": "packages/client/src/ethers/signer.ts",
"chars": 2846,
"preview": "import type {\n SelfFundedTransactionRequest,\n SponsoredTransactionRequest,\n} from '@lens-protocol/graphql';\nimport typ"
},
{
"path": "packages/client/src/ethers/sponsorship.test.ts",
"chars": 1353,
"preview": "import { getDefaultProvider, Network, Wallet } from '@lens-chain/sdk/ethers';\nimport { describe, it } from 'vitest';\n\nim"
},
{
"path": "packages/client/src/ethers/sponsorship.ts",
"chars": 3479,
"preview": "import type { Wallet } from '@lens-chain/sdk/ethers';\nimport { type EvmAddress, never } from '@lens-protocol/types';\nimp"
},
{
"path": "packages/client/src/fragments.test.ts",
"chars": 1998,
"preview": "import {\n AccountQuery,\n graphql,\n UsernameFragment,\n} from '@lens-protocol/graphql';\nimport { NoUnusedFragmentsRule "
},
{
"path": "packages/client/src/fragments.ts",
"chars": 6008,
"preview": "import { invariant } from '@lens-protocol/types';\nimport type { AnyVariables, TypedDocumentNode } from '@urql/core';\nimp"
},
{
"path": "packages/client/src/index.ts",
"chars": 470,
"preview": "export * from '@lens-protocol/env';\nexport * from '@lens-protocol/graphql';\nexport type {\n InMemoryStorageProvider,\n I"
},
{
"path": "packages/client/src/logger.ts",
"chars": 1145,
"preview": "type LogMethod = (...args: unknown[]) => void;\n\nexport enum LogLevel {\n TRACE = 0,\n DEBUG = 1,\n INFO = 2,\n WARN = 3,"
},
{
"path": "packages/client/src/sponsorship.ts",
"chars": 11,
"preview": "export {};\n"
},
{
"path": "packages/client/src/test-utils.ts",
"chars": 5904,
"preview": "/// <reference path=\"../../../vite-env.d.ts\" />\n\nimport { chains } from '@lens-chain/sdk/viem';\nimport {\n immutable,\n "
},
{
"path": "packages/client/src/tokens.ts",
"chars": 4176,
"preview": "import type { Role } from '@lens-protocol/graphql';\nimport type {\n AccessToken,\n EvmAddress,\n Result,\n UUID,\n} from "
},
{
"path": "packages/client/src/types.ts",
"chars": 1693,
"preview": "import type {\n SelfFundedTransactionRequest,\n SponsoredTransactionRequest,\n} from '@lens-protocol/graphql';\nimport typ"
},
{
"path": "packages/client/src/utils.ts",
"chars": 134,
"preview": "/**\n * @internal\n */\nexport function delay(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(res"
},
{
"path": "packages/client/src/viem/__snapshots__/encoding.test.ts.snap",
"chars": 4554,
"preview": "// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html\n\nexports[`Given the encodeKeyValuePairs helper > When enco"
},
{
"path": "packages/client/src/viem/authorization.test.ts",
"chars": 1510,
"preview": "import { chains } from '@lens-chain/sdk/viem';\nimport { evmAddress } from '@lens-protocol/types';\nimport { privateKeyToA"
},
{
"path": "packages/client/src/viem/authorization.ts",
"chars": 1861,
"preview": "import type { chains } from '@lens-chain/sdk/viem';\n\nimport { type EvmAddress, evmAddress } from '@lens-protocol/types';"
},
{
"path": "packages/client/src/viem/encoding.test.ts",
"chars": 1901,
"preview": "import type { KeyValuePair } from '@lens-protocol/graphql';\nimport { fixedBytes32 } from '@lens-protocol/types';\nimport "
},
{
"path": "packages/client/src/viem/encoding.ts",
"chars": 1358,
"preview": "import type { KeyValuePair } from '@lens-protocol/graphql';\nimport type { BlockchainData } from '@lens-protocol/types';\n"
},
{
"path": "packages/client/src/viem/index.ts",
"chars": 118,
"preview": "export * from './authorization';\nexport * from './encoding';\nexport * from './signer';\nexport * from './sponsorship';\n"
},
{
"path": "packages/client/src/viem/signer.test.ts",
"chars": 1233,
"preview": "import { chains } from '@lens-chain/sdk/viem';\nimport { uri } from '@lens-protocol/types';\nimport { createWalletClient, "
},
{
"path": "packages/client/src/viem/signer.ts",
"chars": 4322,
"preview": "import type { chains } from '@lens-chain/sdk/viem';\nimport type {\n SelfFundedTransactionRequest,\n SponsoredTransaction"
},
{
"path": "packages/client/src/viem/sponsorship.test.ts",
"chars": 1515,
"preview": "import { createWalletClient, http } from 'viem';\nimport { privateKeyToAccount } from 'viem/accounts';\nimport { waitForTr"
},
{
"path": "packages/client/src/viem/sponsorship.ts",
"chars": 3734,
"preview": "import type { chains } from '@lens-chain/sdk/viem';\nimport { type EvmAddress, invariant } from '@lens-protocol/types';\ni"
},
{
"path": "packages/client/src/viem/types.ts",
"chars": 628,
"preview": "import { chains } from '@lens-chain/sdk/viem';\nimport type { Account, Chain, Transport, WalletClient } from 'viem';\n\n/**"
},
{
"path": "packages/client/tsconfig.build.json",
"chars": 179,
"preview": "{\n \"$schema\": \"https://json.schemastore.org/tsconfig\",\n \"extends\": \"../../tsconfig.base.json\",\n \"compilerOptions\": {\n"
},
{
"path": "packages/client/tsconfig.json",
"chars": 120,
"preview": "{\n \"$schema\": \"https://json.schemastore.org/tsconfig\",\n \"extends\": [\"./tsconfig.build.json\", \"../../tsconfig.json\"]\n}\n"
},
{
"path": "packages/client/tsup.config.ts",
"chars": 488,
"preview": "/* eslint-disable import/no-default-export */\nimport { defineConfig } from 'tsup';\n\nexport default defineConfig(() => ({"
},
{
"path": "packages/env/CHANGELOG.md",
"chars": 205,
"preview": "# @lens-protocol/env\n\n## 0.1.0-alpha.0\n\n### Minor Changes\n\n- 8073fb7: **chore**: transition to new major release\n\n### Pa"
},
{
"path": "packages/env/README.md",
"chars": 165,
"preview": "# `@lens-protocol/env`\n\nThe Lens environments.\n\n---\n\n**It is not intended to be used directly. Its interface will change"
}
]
// ... and 223 more files (download for full content)
About this extraction
This page contains the full source code of the lens-protocol/lens-sdk GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 423 files (1.9 MB), approximately 497.6k tokens, and a symbol index with 1265 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.