Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: prepare release react 2.0.0-alpha.37 #892

Merged
merged 9 commits into from
Apr 2, 2024
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [["@lens-protocol/react", "@lens-protocol/react-web"]],
"fixed": [["@lens-protocol/react", "@lens-protocol/react-web", "@lens-protocol/react-native"]],
"linked": [],
"access": "public",
"baseBranch": "develop",
Expand Down
11 changes: 11 additions & 0 deletions .changeset/early-keys-know.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@lens-protocol/blockchain-bindings": minor
"@lens-protocol/api-bindings": minor
"@lens-protocol/domain": minor
"@lens-protocol/react": minor
"@lens-protocol/react-native": minor
"@lens-protocol/react-web": minor
---

**feat:** added `useSignFrameAction` hook
**feat:** added `useIdentityToken` hook
9 changes: 9 additions & 0 deletions .changeset/hot-pumas-doubt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@lens-protocol/api-bindings": patch
"@lens-protocol/client": patch
"@lens-protocol/react": patch
"@lens-protocol/react-native": patch
"@lens-protocol/react-web": patch
---

**fix:** adds missing `small` and `medium` aliases to `EncryptedImageSet` and `ImageSet` fragments.
14 changes: 14 additions & 0 deletions .changeset/little-emus-lick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
"@lens-protocol/client": minor
---

**feat:** added Frames module

- `client.frames.createFrameTypedData` - create Frame action typed data to be signed by user wallet
- `client.frames.signFrameAction` - sign Frame action with Lens Manager if enabled
- `client.frames.verifyFrameSignature` - verify Frame signature

**feat:** added support for Identity Token

- `client.authentication.getIdentityToken` - retrieve Identity Token from authenticated LensClient
- `client.authentication.verify({ identityToken })` - verify the token, notice new argument format
7 changes: 7 additions & 0 deletions .changeset/modern-poems-battle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@lens-protocol/react-native": patch
"@lens-protocol/react-web": patch
"@lens-protocol/react": patch
---

**fix:** `useAccessToken` not picking up all possible token changes
6 changes: 6 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"dry-cobras-bow",
"dull-bags-nail",
"early-gorillas-enjoy",
"early-keys-know",
"early-penguins-whisper",
"early-spiders-scream",
"eighty-timers-mix",
Expand Down Expand Up @@ -108,6 +109,7 @@
"honest-drinks-try",
"hot-eels-divide",
"hot-hornets-drum",
"hot-pumas-doubt",
"itchy-mails-shout",
"khaki-students-pump",
"kind-wombats-serve",
Expand All @@ -121,6 +123,7 @@
"lemon-terms-perform",
"light-seas-cheat",
"light-suits-glow",
"little-emus-lick",
"long-ants-guess",
"long-carpets-marry",
"long-moose-reflect",
Expand All @@ -132,6 +135,7 @@
"metal-bikes-applaud",
"metal-cougars-train",
"mighty-planets-retire",
"modern-poems-battle",
"modern-spies-confess",
"modern-taxis-share",
"neat-cycles-doubt",
Expand Down Expand Up @@ -165,6 +169,7 @@
"rare-birds-breathe",
"rude-suns-visit",
"serious-bats-shake",
"serious-comics-jog",
"shaggy-carrots-cry",
"shaggy-colts-turn",
"shaggy-eagles-scream",
Expand Down Expand Up @@ -207,6 +212,7 @@
"thin-falcons-tap",
"thin-news-pull",
"thirty-eyes-act",
"three-books-sit",
"three-cougars-pay",
"three-tools-fly",
"tidy-kangaroos-bake",
Expand Down
7 changes: 7 additions & 0 deletions .changeset/serious-comics-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@lens-protocol/react": patch
"@lens-protocol/react-native": patch
"@lens-protocol/react-web": patch
---

**fix:** proactive refresh credentials
10 changes: 10 additions & 0 deletions .changeset/three-books-sit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@lens-protocol/blockchain-bindings": patch
"@lens-protocol/api-bindings": patch
"@lens-protocol/client": patch
"@lens-protocol/react": patch
"@lens-protocol/react-native": patch
"@lens-protocol/react-web": patch
---

**chore:** exported missing gql types
2 changes: 1 addition & 1 deletion examples/node/scripts/authentication/authenticate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async function main() {
console.log(`Is LensClient authenticated? `, await client.authentication.isAuthenticated());
console.log(`Authenticated profileId: `, profileId);
console.log(`Access token: `, accessToken);
console.log(`Is access token valid? `, await client.authentication.verify(accessToken));
console.log(`Is access token valid? `, await client.authentication.verify({ accessToken }));
}

main();
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async function main() {
console.log(`Is LensClient authenticated? `, await client.authentication.isAuthenticated());
console.log(`Authenticated wallet: `, walletAddress);
console.log(`Access token: `, accessToken);
console.log(`Is access token valid? `, await client.authentication.verify(accessToken));
console.log(`Is access token valid? `, await client.authentication.verify({ accessToken }));
}

main();
35 changes: 35 additions & 0 deletions examples/node/scripts/authentication/verifyIdentityToken.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { LensClient, development } from '@lens-protocol/client';

import { setupWallet } from '../shared/setupWallet';

async function main() {
const client = new LensClient({
environment: development,
});

const wallet = setupWallet();
const address = await wallet.getAddress();

const managedProfiles = await client.wallet.profilesManaged({ for: wallet.address });

if (managedProfiles.items.length === 0) {
throw new Error(`You don't manage any profiles, create one first`);
}

const { id, text } = await client.authentication.generateChallenge({
signedBy: address,
for: managedProfiles.items[0].id,
});

const signature = await wallet.signMessage(text);

await client.authentication.authenticate({ id, signature });

const identityTokenResult = await client.authentication.getIdentityToken();
const identityToken = identityTokenResult.unwrap();

console.log(`Identity token: `, identityToken);
console.log(`Is identity token valid? `, await client.authentication.verify({ identityToken }));
}

main();
23 changes: 23 additions & 0 deletions examples/node/scripts/frames/createFrameTypedData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { LensClient, development } from '@lens-protocol/client';

async function main() {
const client = new LensClient({
environment: development,
});

const result = await client.frames.createFrameTypedData({
actionResponse: '0x0000000000000000000000000000000000000000',
buttonIndex: 2,
deadline: new Date(Date.now() + 30 * 60 * 1000).getTime(), // 30 minutes from now
inputText: 'Hello, World!',
profileId: '0x01',
pubId: '0x01-0x01',
specVersion: '1.0.0',
state: '{"counter":1,"idempotency_key":"431b8b38-eb4d-455b"}',
url: 'https://mylensframe.xyz',
});

console.log(`Result: `, result);
}

main();
29 changes: 29 additions & 0 deletions examples/node/scripts/frames/signFrameAction.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { getAuthenticatedClient } from '../shared/getAuthenticatedClient';
import { setupWallet } from '../shared/setupWallet';

async function main() {
const wallet = setupWallet();
const client = await getAuthenticatedClient(wallet);

const result = await client.frames.signFrameAction({
actionResponse: '0x0000000000000000000000000000000000000000',
buttonIndex: 2,
inputText: 'Hello, World!',
profileId: '0x01',
pubId: '0x01-0x01',
specVersion: '1.0.0',
state: '{"counter":1,"idempotency_key":"431b8b38-eb4d-455b"}',
url: 'https://mylensframe.xyz',
});

if (result.isFailure()) {
console.error(result.error); // CredentialsExpiredError or NotAuthenticatedError
process.exit(1);
}

const data = result.value;

console.log(`Result: `, data);
}

main();
47 changes: 47 additions & 0 deletions examples/node/scripts/frames/verifyFrameSignature.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { FrameVerifySignatureResult } from '@lens-protocol/client';

import { getAuthenticatedClient } from '../shared/getAuthenticatedClient';
import { setupWallet } from '../shared/setupWallet';

async function main() {
const wallet = setupWallet();
const client = await getAuthenticatedClient(wallet);
const profileId = await client.authentication.getProfileId();

if (!profileId) {
throw new Error('Profile not authenticated');
}

const identityTokenResult = await client.authentication.getIdentityToken();
const identityToken = identityTokenResult.unwrap();

// get signature
const result = await client.frames.signFrameAction({
actionResponse: '0x0000000000000000000000000000000000000000',
buttonIndex: 2,
inputText: 'Hello, World!',
profileId: profileId,
pubId: '0x01-0x01',
specVersion: '1.0.0',
state: '{"counter":1,"idempotency_key":"431b8b38-eb4d-455b"}',
url: 'https://mylensframe.xyz',
});

if (result.isFailure()) {
console.error(result.error); // CredentialsExpiredError or NotAuthenticatedError
process.exit(1);
}

const data = result.value;

// verify
const verifyResult = await client.frames.verifyFrameSignature({
identityToken,
signature: data.signature,
signedTypedData: data.signedTypedData,
});

console.log(`Is signature valid? `, verifyResult === FrameVerifySignatureResult.Verified);
}

main();
2 changes: 2 additions & 0 deletions examples/web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
UseInviteWallets,
UseNotifications,
UseResolveAddress,
UseSignFrameAction,
UseValidateHandle,
} from './misc';
import {
Expand Down Expand Up @@ -193,6 +194,7 @@ export function App() {
path="lensClientInteroperability"
element={<LensClientInteroperability />}
/>
<Route path="useSignFrameAction" element={<UseSignFrameAction />} />
</Route>

<Route
Expand Down
15 changes: 10 additions & 5 deletions examples/web/src/misc/MiscPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ const hooks = [
description: `Invite wallets to Lens and check the invite status.`,
path: '/misc/useInviteWallets',
},
{
label: 'LensClient interoperability',
description: `Test ReactHooks SDK and Client SDK interoperability.`,
path: '/misc/lensClientInteroperability',
},
{
label: 'useResolveAddress',
description: `Resolves and EVM address from a Lens Handle.`,
Expand All @@ -41,6 +36,16 @@ const hooks = [
description: `Validate the proposed handle before profile creation.`,
path: '/misc/useValidateHandle',
},
{
label: 'useSignFrameAction',
description: `Sign a frame action and prepare it to be validated by frame server.`,
path: '/misc/useSignFrameAction',
},
{
label: 'LensClient interoperability',
description: `Test ReactHooks SDK and Client SDK interoperability.`,
path: '/misc/lensClientInteroperability',
},
];

export function MiscPage() {
Expand Down
Loading
Loading