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

Release react 2.0.0 alpha.24 #757

Merged
merged 17 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/eleven-numbers-wave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@lens-protocol/domain": minor
"@lens-protocol/react": minor
---

**feat:** adds support for self-funded `useBlockProfiles`
6 changes: 6 additions & 0 deletions .changeset/friendly-monkeys-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@lens-protocol/domain": minor
"@lens-protocol/react": minor
---

**feat:** adds support for self-funded `useUpdateFollowPolicy`
5 changes: 5 additions & 0 deletions .changeset/giant-games-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@lens-protocol/client": minor
---

**feat:** Added `client.authentication.getWalletAddress` and `client.authentication.getAuthorizationId` methods to retrieve data from the refresh token. Fixed `client.authentication.getProfileId` method to return the profileId only if authenticated with profile.
10 changes: 10 additions & 0 deletions .changeset/gorgeous-rice-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@lens-protocol/api-bindings": patch
"@lens-protocol/storage": patch
"@lens-protocol/domain": patch
"@lens-protocol/react": patch
"@lens-protocol/react-native": patch
"@lens-protocol/react-web": patch
---

**fix:** Added session revoke on logout + more logout improvements
8 changes: 8 additions & 0 deletions .changeset/light-suits-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@lens-protocol/react-web": patch
"@lens-protocol/client": patch
"@lens-protocol/react": patch
"@lens-protocol/react-native": patch
---

**feat:** Ensured interoperability between Client and React SDKs, exported `localStorage()`, added new hook `useStorage`
6 changes: 6 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,24 @@
"dry-cobras-bow",
"early-penguins-whisper",
"early-spiders-scream",
"eleven-numbers-wave",
"empty-apricots-cross",
"five-seals-tap",
"fluffy-apricots-provide",
"forty-brooms-wonder",
"fresh-lamps-explain",
"friendly-monkeys-relax",
"friendly-planes-run",
"friendly-pumpkins-turn",
"funny-radios-clap",
"fuzzy-balloons-check",
"fuzzy-dodos-greet",
"fuzzy-pillows-unite",
"giant-games-type",
"gold-dolphins-pump",
"gold-radios-hunt",
"gorgeous-pigs-kneel",
"gorgeous-rice-trade",
"grumpy-coats-scream",
"happy-donuts-boil",
"happy-pumpkins-clean",
Expand All @@ -77,6 +81,7 @@
"lemon-drinks-exercise",
"lemon-schools-decide",
"lemon-terms-perform",
"light-suits-glow",
"long-ants-guess",
"long-carpets-marry",
"loud-pets-decide",
Expand Down Expand Up @@ -140,6 +145,7 @@
"violet-ads-warn",
"violet-impalas-grab",
"yellow-cows-push",
"young-carrots-jump",
"young-jeans-reflect"
]
}
9 changes: 9 additions & 0 deletions .changeset/young-carrots-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@lens-protocol/storage": patch
"@lens-protocol/client": patch
"@lens-protocol/react": patch
"@lens-protocol/react-native": patch
"@lens-protocol/react-web": patch
---

**fix:** `LensClient` and Lens React Hooks interoperability
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ git push --follow-tags

7. It's important that the last commit, from which the release was made and the git tags are associated with, is correctly merged to the `main` branch. Use `"Create a merge commit"` option when merging the release branch to the `main`.

8. Finally, to avoid any differences between merge commit hashes, merge `main` to `develop` branch.

## License

Lens SDK is [MIT licensed](./LICENSE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async function main() {
const accessTokenResult = await client.authentication.getAccessToken();
const accessToken = accessTokenResult.unwrap();

const walletAddress = await client.authentication.getProfileId();
const walletAddress = await client.authentication.getWalletAddress();

console.log(`Is LensClient authenticated? `, await client.authentication.isAuthenticated());
console.log(`Authenticated wallet: `, walletAddress);
Expand Down
17 changes: 8 additions & 9 deletions examples/node/scripts/authentication/revoke.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,21 @@ import { setupWallet } from '../shared/setupWallet';
async function main() {
const wallet = setupWallet();
const client = await getAuthenticatedClient(wallet);
const profileId = await client.authentication.getProfileId();
const authorizationId = await client.authentication.getAuthorizationId();

const result = await client.authentication.fetchAll();
const value = result.unwrap();
if (!authorizationId) {
throw new Error(`Not authenticated`);
}

console.log(`All active sessions for ${profileId}: `, value.items);

// revoke the oldest session
await client.authentication.revoke({
authorizationId: value.items[value.items.length - 1].authorizationId,
authorizationId,
});

const after = await client.authentication.fetchAll();
// fetch current session
const after = await client.authentication.fetch();
const afterValue = after.unwrap();

console.log(`All active sessions: `, afterValue.items);
console.log(`Active session: `, afterValue);
}

main();
1 change: 0 additions & 1 deletion examples/node/scripts/follow/createFollowTypedData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ async function main() {
followBroadcastResultValue.txId,
);

// wait for follow to be indexed
console.log(`Waiting for the transaction to be indexed...`);
await client.transaction.waitUntilComplete({ forTxId: followBroadcastResultValue.txId });
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async function main() {
followBroadcastResultValue.txId,
);

// wait for follow to be indexed
console.log(`Waiting for the transaction to be indexed...`);
await client.transaction.waitUntilComplete({ forTxId: followBroadcastResultValue.txId });
}

Expand Down
1 change: 1 addition & 0 deletions examples/node/scripts/follow/follow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ async function main() {
throw new Error(`Something went wrong`);
}

console.log(`Waiting for the transaction to be indexed...`);
await client.transaction.waitUntilComplete({ forTxId: followResultValue.txId });
}

Expand Down
1 change: 1 addition & 0 deletions examples/node/scripts/follow/setFollowModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ async function main() {
throw new Error('Failed to set follow module');
}

console.log(`Waiting for the transaction to be indexed...`);
await client.transaction.waitUntilComplete({ forTxId: followModuleResultValue.txId });
}

Expand Down
1 change: 1 addition & 0 deletions examples/node/scripts/follow/unfollow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ async function main() {
throw new Error(`Something went wrong`);
}

console.log(`Waiting for the transaction to be indexed...`);
await client.transaction.waitUntilComplete({ forTxId: unfollowResultValue.txId });
}

Expand Down
1 change: 1 addition & 0 deletions examples/node/scripts/profile/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ async function main() {
return;
}

console.log(`Waiting for the transaction to be indexed...`);
await client.transaction.waitUntilComplete({ forTxId: data.txId });
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ async function main() {
return;
}

console.log(`Waiting for the transaction to be indexed...`);
await client.transaction.waitUntilComplete({ forTxId: broadcastResultValue.txId });

console.log(`Transaction was successfully broadcasted with txId`, broadcastResultValue.txId);
}

main();
3 changes: 1 addition & 2 deletions examples/node/scripts/profile/createLinkHandleTypedData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ async function main() {
return;
}

console.log(`Waiting for the transaction to be indexed...`);
await client.transaction.waitUntilComplete({ forTxId: broadcastResultValue.txId });

console.log(`Transaction was successfully broadcasted with txId`, broadcastResultValue.txId);
}

main();
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ async function main() {
return;
}

// or wait till transaction is indexed
console.log(`Waiting for the transaction to be indexed...`);
await client.transaction.waitUntilComplete({ forTxId: broadcastResultValue.txId });

console.log(`Transaction was successfully broadcasted with txId`, broadcastResultValue.txId);
}

main();
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ async function main() {
return;
}

console.log(`Waiting for the transaction to be indexed...`);
await client.transaction.waitUntilComplete({ forTxId: broadcastResultValue.txId });

console.log(`Transaction was successfully broadcasted with txId`, broadcastResultValue.txId);
}

main();
3 changes: 1 addition & 2 deletions examples/node/scripts/profile/createUnlinkHandleTypedData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ async function main() {
return;
}

console.log(`Waiting for the transaction to be indexed...`);
await client.transaction.waitUntilComplete({ forTxId: broadcastResultValue.txId });

console.log(`Transaction was successfully broadcasted with txId`, broadcastResultValue.txId);
}

main();
1 change: 1 addition & 0 deletions examples/node/scripts/profile/setProfileMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ async function main() {
return;
}

console.log(`Waiting for the transaction to be indexed...`);
await client.transaction.waitUntilComplete({ forTxId: data.txId });
}

Expand Down
1 change: 1 addition & 0 deletions examples/node/scripts/profile/unblock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ async function main() {
return;
}

console.log(`Waiting for the transaction to be indexed...`);
await client.transaction.waitUntilComplete({ forTxId: data.txId });
}

Expand Down
1 change: 1 addition & 0 deletions examples/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@ethersproject/providers": "^5.7.2",
"@irys/sdk": "^0.0.4",
"@lens-protocol/metadata": "^1.0.5",
"@lens-protocol/client": "workspace:*",
"@lens-protocol/react-web": "workspace:*",
"@lens-protocol/wagmi": "workspace:*",
"@xmtp/react-sdk": "1.0.0-preview.40",
Expand Down
5 changes: 5 additions & 0 deletions examples/web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
UseSearchPublications,
} from './discovery';
import {
LensClientInteroperability,
MiscPage,
UseApproveModule,
UseClaimHandle,
Expand Down Expand Up @@ -196,6 +197,10 @@ export function App() {
<Route path="useApproveModule" element={<UseApproveModule />} />
<Route path="useClaimHandle" element={<UseClaimHandle />} />
<Route path="useInviteWallets" element={<UseInviteWallets />} />
<Route
path="lensClientInteroperability"
element={<LensClientInteroperability />}
/>
</Route>
</Route>

Expand Down
42 changes: 42 additions & 0 deletions examples/web/src/misc/LensClientInteroperability.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { LensClient, development } from '@lens-protocol/client';
import { useSession, useStorage } from '@lens-protocol/react-web';
import { useEffect, useMemo, useState } from 'react';

import { RequireProfileSession } from '../components/auth';

export function LensClientInteroperability() {
const { data: session } = useSession();
const [isAuthenticated, setIsAuthenticated] = useState(false);

// initialize LensClient with React SDK storage
const storage = useStorage();
const client = useMemo(
() =>
new LensClient({
environment: development,
storage,
}),
[storage],
);

useEffect(() => {
void (async () => {
const status = await client.authentication.isAuthenticated();
setIsAuthenticated(status);
})();
}, [client, session?.authenticated]);

return (
<div>
<h1>
<code>LensClient interoperability</code>
</h1>

<div>Is LensClient authenticated? {isAuthenticated ? 'true' : 'false'}</div>

<RequireProfileSession message="Login with React Hooks SDK and notice that LensClient instance is also authenticated.">
<div>Is React SDK authenticated? {session?.authenticated ? 'true' : 'false'}</div>
</RequireProfileSession>
</div>
);
}
5 changes: 5 additions & 0 deletions examples/web/src/misc/MiscPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ 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',
},
];

export function MiscPage() {
Expand Down
1 change: 1 addition & 0 deletions examples/web/src/misc/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './LensClientInteroperability';
export * from './MiscPage';
export * from './UseApproveModule';
export * from './UseClaimHandle';
Expand Down
Loading
Loading