-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
54 changed files
with
291 additions
and
535 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = { | ||
root: true, | ||
extends: ['@lens-protocol/eslint-config'], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: ['./tsconfig.json'], | ||
tsconfigRootDir: __dirname, | ||
}, | ||
rules: { | ||
'no-console': 'off', | ||
'@typescript-eslint/no-floating-promises': 'off', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,36 @@ | ||
import { LensClient, development } from "@lens-protocol/client"; | ||
import { setupWallet } from "./shared/setupWallet"; | ||
import { LensClient, development } from '@lens-protocol/client'; | ||
|
||
import { setupWallet } from './shared/setupWallet'; | ||
|
||
async function main() { | ||
const lensClient = new LensClient({ | ||
const client = new LensClient({ | ||
environment: development, | ||
storage: { | ||
getItem: async (key: string) => { | ||
const value = localStorage.getItem(key); | ||
return localStorage.getItem(key); | ||
}, | ||
setItem: async (key: string, value: string) => { | ||
localStorage.setItem(key, value); | ||
}, | ||
removeItem: async (key: string) => { | ||
localStorage.removeItem(key); | ||
}, | ||
}, | ||
}); | ||
|
||
const wallet = setupWallet(); | ||
const address = await wallet.getAddress(); | ||
|
||
const challenge = await lensClient.authentication.generateChallenge(address); | ||
const signature = await wallet.signMessage(challenge); | ||
const ownedProfiles = await client.profile.fetchAll({ where: { ownedBy: [address] } }); | ||
|
||
if (ownedProfiles.items.length === 0) { | ||
throw new Error(`You don't have any profiles, create one first`); | ||
} | ||
|
||
const { id, text } = await client.authentication.generateChallenge({ | ||
profileId: ownedProfiles.items[0].id, | ||
address, | ||
}); | ||
|
||
const signature = await wallet.signMessage(text); | ||
|
||
await lensClient.authentication.authenticate(address, signature); | ||
await client.authentication.authenticate({ id, signature }); | ||
|
||
const accessTokenResult = await lensClient.authentication.getAccessToken(); | ||
const accessTokenResult = await client.authentication.getAccessToken(); | ||
const accessToken = accessTokenResult.unwrap(); | ||
|
||
console.log(`Is LensClient authenticated? `, await lensClient.authentication.isAuthenticated()); | ||
console.log(`Is LensClient authenticated? `, await client.authentication.isAuthenticated()); | ||
console.log(`Access token: `, accessToken); | ||
console.log(`Is access token valid? `, await lensClient.authentication.verify(accessToken)); | ||
console.log(`Is access token valid? `, await client.authentication.verify(accessToken)); | ||
} | ||
|
||
main(); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 9 additions & 8 deletions
17
examples/node/scripts/follow/followProfileUsingLensProfileManager.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.