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 2.0.0-alpha.29 #819

Merged
merged 10 commits into from
Feb 1, 2024
Merged
8 changes: 8 additions & 0 deletions .changeset/dull-bags-nail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@lens-protocol/react-native": patch
"@lens-protocol/react-web": patch
"@lens-protocol/client": patch
"@lens-protocol/react": patch
---

**fix:** adds missing `publication.operations.canQuote` field
9 changes: 9 additions & 0 deletions .changeset/healthy-avocados-rhyme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@lens-protocol/react-native": minor
"@lens-protocol/react-web": minor
"@lens-protocol/react": minor
"@lens-protocol/api-bindings": patch
"@lens-protocol/domain": patch
---

**feat:** adds `resolveReferencePolicy` helper to create developer friendly ReferencePolicy out of publication sparse ReferenceModule
5 changes: 5 additions & 0 deletions .changeset/perfect-cups-suffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@lens-protocol/client": patch
---

feat: added `isOpenActionModuleWithReferralFee` helper function
8 changes: 8 additions & 0 deletions .changeset/perfect-monkeys-serve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@lens-protocol/api-bindings": patch
"@lens-protocol/react": patch
"@lens-protocol/react-native": patch
"@lens-protocol/react-web": patch
---

**fix:** `useOpenAction` takes Unknown Open Action Modules' `sponsoredApproved` and `signlessApproved` flags
7 changes: 7 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"cyan-radios-sniff",
"dirty-tools-hammer",
"dry-cobras-bow",
"dull-bags-nail",
"early-penguins-whisper",
"early-spiders-scream",
"eleven-numbers-wave",
Expand All @@ -76,6 +77,7 @@
"grumpy-coats-scream",
"happy-donuts-boil",
"happy-pumpkins-clean",
"healthy-avocados-rhyme",
"heavy-dodos-raise",
"heavy-lizards-eat",
"heavy-terms-prove",
Expand Down Expand Up @@ -120,6 +122,8 @@
"olive-beans-double",
"olive-trainers-march",
"orange-masks-punch",
"perfect-cups-suffer",
"perfect-monkeys-serve",
"plenty-emus-doubt",
"polite-pans-allow",
"poor-parrots-unite",
Expand All @@ -136,6 +140,7 @@
"sharp-snakes-push",
"shy-pugs-taste",
"silent-mangos-yawn",
"silly-meals-tell",
"six-cherries-notice",
"six-feet-sparkle",
"six-flowers-smell",
Expand All @@ -145,6 +150,7 @@
"small-forks-rest",
"small-hats-mix",
"small-seas-switch",
"smart-clocks-jog",
"smooth-ties-roll",
"sour-avocados-look",
"sour-tables-impress",
Expand All @@ -170,6 +176,7 @@
"tidy-pants-punch",
"tough-snakes-complain",
"tricky-planets-share",
"twenty-sloths-watch",
"two-geese-protect",
"violet-ads-warn",
"violet-impalas-grab",
Expand Down
9 changes: 9 additions & 0 deletions .changeset/silly-meals-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@lens-protocol/api-bindings": patch
"@lens-protocol/domain": patch
"@lens-protocol/react": patch
"@lens-protocol/react-native": patch
"@lens-protocol/react-web": patch
---

**fix:** supports `referrers` with Unknown Open Action module via `useOpenAction`
10 changes: 10 additions & 0 deletions .changeset/smart-clocks-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@lens-protocol/react": minor
"@lens-protocol/react-native": minor
"@lens-protocol/react-web": minor
"@lens-protocol/blockchain-bindings": patch
"@lens-protocol/api-bindings": patch
"@lens-protocol/domain": patch
---

**feat:** `useCreatePost` takes Open Action Modules Metadata into consideration when determining sponsored/signless experience
10 changes: 10 additions & 0 deletions .changeset/twenty-sloths-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@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 `useReportProfile` hook
chore: renamed `ReportReason` to `PublicationReportReason`, deprecate `ReportReason`
20 changes: 10 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
- uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v2.4.0
uses: pnpm/action-setup@v2

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "pnpm"
Expand All @@ -34,10 +34,10 @@ jobs:
- uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v2.4.0
uses: pnpm/action-setup@v2

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "pnpm"
Expand All @@ -60,10 +60,10 @@ jobs:
- uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v2.4.0
uses: pnpm/action-setup@v2

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "pnpm"
Expand All @@ -89,10 +89,10 @@ jobs:
- uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v2.4.0
uses: pnpm/action-setup@v2

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "pnpm"
Expand All @@ -110,10 +110,10 @@ jobs:
- uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v2.4.0
uses: pnpm/action-setup@v2

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "pnpm"
Expand Down
2 changes: 1 addition & 1 deletion examples/node/scripts/profile/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async function main() {
subreason: ProfileReportingSpamSubreason.Repetitive,
},
},
additionalComments: 'comment',
additionalComments: 'Human readable comments, if any.',
});

console.log(`Profile was reported: `, result);
Expand Down
117 changes: 117 additions & 0 deletions examples/node/scripts/publication/recipes/mirrorReferrer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import {
OpenActionModuleFragment,
PublicationType,
isMirrorPublication,
isOpenActionModuleWithReferralFee,
isRelaySuccess,
} from '@lens-protocol/client';

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

function mapOpenActionModuleToInputType(openActionModule: OpenActionModuleFragment) {
switch (openActionModule.__typename) {
case 'SimpleCollectOpenActionSettings':
return {
simpleCollectOpenAction: true,
};
case 'MultirecipientFeeCollectOpenActionSettings':
return {
multirecipientCollectOpenAction: true,
};
default:
throw new Error(`Unsupported openActionModule type: ${openActionModule.__typename}`);
}
}

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

// fetch mirrors
const mirrorsResult = await client.publication.fetchAll({
where: {
publicationTypes: [PublicationType.Mirror],
},
});

let mirror = undefined;

// iterate over pages of mirrors to find a mirror of a post with referralFee
while (mirrorsResult.pageInfo.next && !mirror) {
console.log(`Fetching page for cursor: ${mirrorsResult.pageInfo.next}`);

const nextPage = await mirrorsResult.next();

if (nextPage) {
// type safe as Mirror
const mirrors = mirrorsResult.items.filter(isMirrorPublication);

// look for referralFee
mirror = mirrors.find((m) =>
m.mirrorOn.openActionModules.find((o) => 'referralFee' in o && o.referralFee > 0),
);
}
}

if (!mirror) {
throw new Error('No mirror found with referralFee');
}

const openActionWithReferralFee = mirror.mirrorOn.openActionModules.find(
(o) => 'referralFee' in o && o.referralFee > 0,
);

// type safe as OpenActionModuleWithReferralFeeFragment
if (
!openActionWithReferralFee ||
(openActionWithReferralFee && !isOpenActionModuleWithReferralFee(openActionWithReferralFee))
) {
throw new Error('No openAction found with referralFee');
}

console.log(
`We found a mirror with ID ${mirror.id} by profile ${mirror.by.id}
of a publication ID ${mirror.mirrorOn.id} with openActionModule ${openActionWithReferralFee.__typename} and referralFee: ${openActionWithReferralFee.referralFee}`,
);

// map the openActionModule to the correct input type
const actOnInput = mapOpenActionModuleToInputType(openActionWithReferralFee);

// now collect the publication
// notice that paid actions need to be signed and sent through broadcast
const resultTypedData = await client.publication.actions.createActOnTypedData({
actOn: actOnInput,
for: mirror.mirrorOn.id,
referrers: [{ profileId: mirror.by.id }, { publicationId: mirror.id }],
});

const { id, typedData } = resultTypedData.unwrap();

console.log(`Typed data: `, typedData);

// sign with the wallet
const signedTypedData = await wallet._signTypedData(
typedData.domain,
typedData.types,
typedData.value,
);

console.log(`Broadcasting signed typed data...`);

const broadcastResult = await client.transaction.broadcastOnchain({
id,
signature: signedTypedData,
});

const broadcastValue = broadcastResult.unwrap();

if (!isRelaySuccess(broadcastValue)) {
console.log(`Something went wrong`, broadcastValue);
return;
}

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

main();
2 changes: 1 addition & 1 deletion examples/node/scripts/publication/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ async function main() {
subreason: PublicationReportingSpamSubreason.FakeEngagement,
},
},
additionalComments: 'comment',
additionalComments: 'Human readable comments, if any.',
});

console.log(`Publication was reported: `, result);
Expand Down
2 changes: 2 additions & 0 deletions examples/web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import {
UseProfileManagers,
UseProfiles,
UseProfilesManaged,
UseReportProfile,
UseSetProfileMetadata,
UseUpdateFollowPolicy,
UseUpdateProfileManagers,
Expand Down Expand Up @@ -166,6 +167,7 @@ export function App() {
<Route path="useBlockProfiles" element={<UseBlockAndUnblockProfiles />} />
<Route path="useBlockedProfiles" element={<UseBlockedProfiles />} />
<Route path="useLastLoggedInProfile" element={<UseLastLoggedInProfile />} />
<Route path="useReportProfile" element={<UseReportProfile />} />
</Route>

<Route path="/discovery">
Expand Down
5 changes: 5 additions & 0 deletions examples/web/src/profiles/ProfilesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ const profileHooks = [
description: 'Fetch the last logged in profile for a wallet address.',
path: '/profiles/useLastLoggedInProfile',
},
{
label: 'useReportProfile',
description: 'Report a profile.',
path: '/profiles/useReportProfile',
},
];

export function ProfilesPage() {
Expand Down
Loading
Loading