-
Notifications
You must be signed in to change notification settings - Fork 79
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
1 parent
6cb9528
commit 7be751f
Showing
31 changed files
with
332 additions
and
7 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 |
---|---|---|
@@ -1,12 +1,54 @@ | ||
import { isSuccessfulLensProfileManagerResponse } from "@lens-protocol/client"; | ||
import { getAuthenticatedClientFromEthersWallet } from "../shared/getAuthenticatedClient"; | ||
import { setupWallet } from "../shared/setupWallet"; | ||
import { | ||
CustomFiltersType, | ||
OpenActionCategoryType, | ||
OpenActionModuleType, | ||
} from "@lens-protocol/client/src/graphql/types.generated"; | ||
|
||
async function main() { | ||
const wallet = setupWallet(); | ||
const lensClient = await getAuthenticatedClientFromEthersWallet(wallet); | ||
|
||
const recommendedProfiles = await lensClient.profile.fetch({ profileId: "YOUR_PROFILE_ID" }); | ||
// stats across the whole protocol | ||
const protocolWideStats = await lensClient.profile.stats({ profileId: "PROFILE_ID" }); | ||
|
||
// stats for a specified apps | ||
const statsForSpecifiedApps = await lensClient.profile.stats( | ||
{ | ||
profileId: "PROFILE_ID", | ||
}, | ||
{ profileStatsArg: { forApps: ["APP_ID", "ANOTHER_APP_ID"] } } | ||
); | ||
|
||
// filter open actions | ||
const filteredOpenActions = await lensClient.profile.stats( | ||
{ | ||
profileId: "PROFILE_ID", | ||
}, | ||
{ | ||
profileStatsCountOpenActionArgs: { | ||
anyOf: [ | ||
{ | ||
address: "0x00", | ||
type: OpenActionModuleType.SimpleCollectOpenActionModule, | ||
category: OpenActionCategoryType.Collect, | ||
}, | ||
], | ||
}, | ||
} | ||
); | ||
|
||
// stats for a specified app and with custom filters | ||
const customFilteredStats = await lensClient.profile.stats( | ||
{ | ||
profileId: "PROFILE_ID", | ||
}, | ||
{ | ||
profileStatsArg: { forApps: ["APP_ID"], customFilters: [CustomFiltersType.Gardeners] }, | ||
} | ||
); | ||
} | ||
|
||
main(); |
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 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,20 @@ | ||
import { LensConfig } from '../consts/config'; | ||
import { ProfileStatsArg, ProfileStatsCountOpenActionArgs } from '../graphql/types.generated'; | ||
|
||
export type ProfileQueryOptions = { | ||
profileStatsArg?: ProfileStatsArg; | ||
profileStatsCountOpenActionArgs?: ProfileStatsCountOpenActionArgs; | ||
}; | ||
|
||
export function buildProfileQueryOptions(args: { | ||
config: LensConfig; | ||
profileStatsArg?: ProfileStatsArg; | ||
profileStatsCountOpenActionArgs?: ProfileStatsCountOpenActionArgs; | ||
}): ProfileQueryOptions { | ||
return { | ||
profileStatsArg: args.profileStatsArg ?? { forApps: args.config.forApps }, | ||
profileStatsCountOpenActionArgs: args.profileStatsCountOpenActionArgs ?? { | ||
anyOf: [], | ||
}, | ||
}; | ||
} |
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 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
Oops, something went wrong.