diff --git a/examples/node/scripts/follow/followProfileViaTypedData.ts b/examples/node/scripts/follow/followProfileViaTypedData.ts index 5f997ccf21..d613eb41ab 100644 --- a/examples/node/scripts/follow/followProfileViaTypedData.ts +++ b/examples/node/scripts/follow/followProfileViaTypedData.ts @@ -34,7 +34,7 @@ async function main() { } console.log( - `Transaction to follow ${following.items[1].id} was successfuly broadcasted with txId ${followBroadcastResultValue.txId}`, + `Transaction to follow ${following.items[1].id} was successfully broadcasted with txId ${followBroadcastResultValue.txId}`, ); // wait for follow to be indexed diff --git a/examples/node/scripts/follow/unfollowProfileViaTypedData.ts b/examples/node/scripts/follow/unfollowProfileViaTypedData.ts index 728aa75013..42d45d610c 100644 --- a/examples/node/scripts/follow/unfollowProfileViaTypedData.ts +++ b/examples/node/scripts/follow/unfollowProfileViaTypedData.ts @@ -36,7 +36,7 @@ async function main() { } console.log( - `Transaction to follow ${profileToUnfollowId} was successfuly broadcasted with txId ${followBroadcastResultValue.txId}`, + `Transaction to follow ${profileToUnfollowId} was successfully broadcasted with txId ${followBroadcastResultValue.txId}`, ); // wait for follow to be indexed diff --git a/examples/node/scripts/profile/blockProfileViaLensProfileManager.ts b/examples/node/scripts/profile/blockProfileViaLensProfileManager.ts new file mode 100644 index 0000000000..723208504e --- /dev/null +++ b/examples/node/scripts/profile/blockProfileViaLensProfileManager.ts @@ -0,0 +1,24 @@ +import { isRelaySuccess } from '@lens-protocol/client'; + +import { getAuthenticatedClientFromEthersWallet } from '../shared/getAuthenticatedClient'; +import { setupWallet } from '../shared/setupWallet'; + +async function main() { + const wallet = setupWallet(); + const lensClient = await getAuthenticatedClientFromEthersWallet(wallet); + + const result = await lensClient.profile.block({ + profiles: ['PROFILE_ID_TO_BLOCK'], + }); + + const data = result.unwrap(); + + if (!isRelaySuccess(data)) { + console.log(`Something went wrong`, data); + return; + } + + await lensClient.transaction.waitUntilComplete({ txId: data.txId }); +} + +main(); diff --git a/examples/node/scripts/profile/blockProfileViaTypedData.ts b/examples/node/scripts/profile/blockProfileViaTypedData.ts new file mode 100644 index 0000000000..d941fa0bde --- /dev/null +++ b/examples/node/scripts/profile/blockProfileViaTypedData.ts @@ -0,0 +1,39 @@ +import { isRelaySuccess } from '@lens-protocol/client'; + +import { getAuthenticatedClientFromEthersWallet } from '../shared/getAuthenticatedClient'; +import { setupWallet } from '../shared/setupWallet'; + +async function main() { + const wallet = setupWallet(); + const lensClient = await getAuthenticatedClientFromEthersWallet(wallet); + + const blockProfilesTypedData = await lensClient.profile.createBlockProfilesTypedData({ + profiles: ['PROFILE_ID_TO_BLOCK'], + }); + + const data = blockProfilesTypedData.unwrap(); + + const signedTypedData = await wallet._signTypedData( + data.typedData.domain, + data.typedData.types, + data.typedData.value, + ); + + const broadcastResult = await lensClient.transaction.broadcastOnchain({ + id: data.id, + signature: signedTypedData, + }); + + const broadcastResultValue = broadcastResult.unwrap(); + + if (!isRelaySuccess(broadcastResultValue)) { + console.log(`Something went wrong`, broadcastResultValue); + return; + } + + await lensClient.transaction.waitUntilComplete({ txId: broadcastResultValue.txId }); + + console.log(`Transaction was successfully broadcasted with txId ${broadcastResultValue.txId}`); +} + +main(); diff --git a/examples/node/scripts/profile/claimProfile.ts b/examples/node/scripts/profile/claimProfile.ts new file mode 100644 index 0000000000..a23b44fa64 --- /dev/null +++ b/examples/node/scripts/profile/claimProfile.ts @@ -0,0 +1,35 @@ +import { isRelaySuccess } from '@lens-protocol/client'; + +import { getAuthenticatedClientFromEthersWallet } from '../shared/getAuthenticatedClient'; +import { setupWallet } from '../shared/setupWallet'; + +async function main() { + const wallet = setupWallet(); + const address = await wallet.getAddress(); + const lensClient = await getAuthenticatedClientFromEthersWallet(wallet); + + const handle = Date.now().toString(); + + console.log(`Claiming a profile for ${address} with handle "${handle}"`); + + const result = await lensClient.profile.claim({ + id: 'ID', + freeTextHandle: 'CHOSEN_HANDLE', + }); + + const claimResultValue = result.unwrap(); + + if (!isRelaySuccess(claimResultValue)) { + console.log(`Something went wrong`, result); + return; + } + + console.log( + `Transaction to claim profile with handle "${handle}" was successfully broadcasted with txId ${claimResultValue.txId}`, + ); + + console.log(`Waiting for the transaction to be indexed...`); + await lensClient.transaction.waitUntilComplete({ txId: claimResultValue.txId }); +} + +main(); diff --git a/examples/node/scripts/profile/createProfile.ts b/examples/node/scripts/profile/createProfile.ts index b69e28eb25..50142b4176 100644 --- a/examples/node/scripts/profile/createProfile.ts +++ b/examples/node/scripts/profile/createProfile.ts @@ -24,7 +24,7 @@ async function main() { } console.log( - `Transaction to create a new profile with handle "${handle}" was successfuly broadcasted with txId ${profileCreateResult.txId}`, + `Transaction to create a new profile with handle "${handle}" was successfully broadcasted with txId ${profileCreateResult.txId}`, ); console.log(`Waiting for the transaction to be indexed...`); diff --git a/examples/node/scripts/profile/linkHandleToProfileViaLensManager.ts b/examples/node/scripts/profile/linkHandleToProfileViaLensManager.ts new file mode 100644 index 0000000000..96b182579d --- /dev/null +++ b/examples/node/scripts/profile/linkHandleToProfileViaLensManager.ts @@ -0,0 +1,13 @@ +import { getAuthenticatedClientFromEthersWallet } from '../shared/getAuthenticatedClient'; +import { setupWallet } from '../shared/setupWallet'; + +async function main() { + const wallet = setupWallet(); + const client = await getAuthenticatedClientFromEthersWallet(wallet); + + await client.profile.linkHandle({ + handle: 'HANDLE', + }); +} + +main(); diff --git a/examples/node/scripts/profile/linkHandleToProfileViaTypedData.ts b/examples/node/scripts/profile/linkHandleToProfileViaTypedData.ts new file mode 100644 index 0000000000..2910dbf4a4 --- /dev/null +++ b/examples/node/scripts/profile/linkHandleToProfileViaTypedData.ts @@ -0,0 +1,39 @@ +import { isRelaySuccess } from '@lens-protocol/client'; + +import { getAuthenticatedClientFromEthersWallet } from '../shared/getAuthenticatedClient'; +import { setupWallet } from '../shared/setupWallet'; + +async function main() { + const wallet = setupWallet(); + const lensClient = await getAuthenticatedClientFromEthersWallet(wallet); + + const linkHandleToProfileTypedData = await lensClient.profile.createLinkHandleTypedData({ + handle: 'HANDLE', + }); + + const data = linkHandleToProfileTypedData.unwrap(); + + const signedTypedData = await wallet._signTypedData( + data.typedData.domain, + data.typedData.types, + data.typedData.value, + ); + + const broadcastResult = await lensClient.transaction.broadcastOnchain({ + id: data.id, + signature: signedTypedData, + }); + + const broadcastResultValue = broadcastResult.unwrap(); + + if (!isRelaySuccess(broadcastResultValue)) { + console.log(`Something went wrong`, broadcastResultValue); + return; + } + + await lensClient.transaction.waitUntilComplete({ txId: broadcastResultValue.txId }); + + console.log(`Transaction was successfully broadcasted with txId ${broadcastResultValue.txId}`); +} + +main(); diff --git a/examples/node/scripts/profile/unblockProfileViaLensProfileManager.ts b/examples/node/scripts/profile/unblockProfileViaLensProfileManager.ts new file mode 100644 index 0000000000..eacf2f63d8 --- /dev/null +++ b/examples/node/scripts/profile/unblockProfileViaLensProfileManager.ts @@ -0,0 +1,24 @@ +import { isRelaySuccess } from '@lens-protocol/client'; + +import { getAuthenticatedClientFromEthersWallet } from '../shared/getAuthenticatedClient'; +import { setupWallet } from '../shared/setupWallet'; + +async function main() { + const wallet = setupWallet(); + const lensClient = await getAuthenticatedClientFromEthersWallet(wallet); + + const result = await lensClient.profile.unblock({ + profiles: ['PROFILE_ID_TO_BLOCK'], + }); + + const data = result.unwrap(); + + if (!isRelaySuccess(data)) { + console.log(`Something went wrong`, data); + return; + } + + await lensClient.transaction.waitUntilComplete({ txId: data.txId }); +} + +main(); diff --git a/examples/node/scripts/profile/unblockProfileViaTypedData.ts b/examples/node/scripts/profile/unblockProfileViaTypedData.ts new file mode 100644 index 0000000000..618cc1613d --- /dev/null +++ b/examples/node/scripts/profile/unblockProfileViaTypedData.ts @@ -0,0 +1,39 @@ +import { isRelaySuccess } from '@lens-protocol/client'; + +import { getAuthenticatedClientFromEthersWallet } from '../shared/getAuthenticatedClient'; +import { setupWallet } from '../shared/setupWallet'; + +async function main() { + const wallet = setupWallet(); + const lensClient = await getAuthenticatedClientFromEthersWallet(wallet); + + const unblockProfilesTypedData = await lensClient.profile.createUnblockProfileTypedData({ + profiles: ['PROFILE_ID_TO_BLOCK'], + }); + + const data = unblockProfilesTypedData.unwrap(); + + const signedTypedData = await wallet._signTypedData( + data.typedData.domain, + data.typedData.types, + data.typedData.value, + ); + + const broadcastResult = await lensClient.transaction.broadcastOnchain({ + id: data.id, + signature: signedTypedData, + }); + + const broadcastResultValue = broadcastResult.unwrap(); + + if (!isRelaySuccess(broadcastResultValue)) { + console.log(`Something went wrong`, broadcastResultValue); + return; + } + + await lensClient.transaction.waitUntilComplete({ txId: broadcastResultValue.txId }); + + console.log(`Transaction was successfully broadcasted with txId ${broadcastResultValue.txId}`); +} + +main(); diff --git a/examples/node/scripts/profile/unlinkHandleFromProfile.ts b/examples/node/scripts/profile/unlinkHandleFromProfile.ts new file mode 100644 index 0000000000..52c754c7c6 --- /dev/null +++ b/examples/node/scripts/profile/unlinkHandleFromProfile.ts @@ -0,0 +1,13 @@ +import { getAuthenticatedClientFromEthersWallet } from '../shared/getAuthenticatedClient'; +import { setupWallet } from '../shared/setupWallet'; + +async function main() { + const wallet = setupWallet(); + const client = await getAuthenticatedClientFromEthersWallet(wallet); + + await client.profile.unlinkHandle({ + handle: 'HANDLE', + }); +} + +main(); diff --git a/examples/node/scripts/profile/unlinkHandleToProfileViaTypedData.ts b/examples/node/scripts/profile/unlinkHandleToProfileViaTypedData.ts new file mode 100644 index 0000000000..5727e1639a --- /dev/null +++ b/examples/node/scripts/profile/unlinkHandleToProfileViaTypedData.ts @@ -0,0 +1,39 @@ +import { isRelaySuccess } from '@lens-protocol/client'; + +import { getAuthenticatedClientFromEthersWallet } from '../shared/getAuthenticatedClient'; +import { setupWallet } from '../shared/setupWallet'; + +async function main() { + const wallet = setupWallet(); + const lensClient = await getAuthenticatedClientFromEthersWallet(wallet); + + const unlinkHandleFromProfileTypedData = await lensClient.profile.createUnlinkHandleTypedData({ + handle: 'HANDLE', + }); + + const data = unlinkHandleFromProfileTypedData.unwrap(); + + const signedTypedData = await wallet._signTypedData( + data.typedData.domain, + data.typedData.types, + data.typedData.value, + ); + + const broadcastResult = await lensClient.transaction.broadcastOnchain({ + id: data.id, + signature: signedTypedData, + }); + + const broadcastResultValue = broadcastResult.unwrap(); + + if (!isRelaySuccess(broadcastResultValue)) { + console.log(`Something went wrong`, broadcastResultValue); + return; + } + + await lensClient.transaction.waitUntilComplete({ txId: broadcastResultValue.txId }); + + console.log(`Transaction was successfully broadcasted with txId ${broadcastResultValue.txId}`); +} + +main(); diff --git a/examples/node/scripts/publication/actions/actOn.ts b/examples/node/scripts/publication/actions/actOn.ts index 1444bc2bcd..d0ea8d1fe4 100644 --- a/examples/node/scripts/publication/actions/actOn.ts +++ b/examples/node/scripts/publication/actions/actOn.ts @@ -21,7 +21,7 @@ async function main() { return; } - console.log(`Transaction was successfuly broadcasted with txId ${resultValue.txId}`); + console.log(`Transaction was successfully broadcasted with txId ${resultValue.txId}`); // wait in a loop console.log(`Waiting for the transaction to be indexed...`); diff --git a/examples/node/scripts/publication/actions/createActOnTypedData.ts b/examples/node/scripts/publication/actions/createActOnTypedData.ts index 9ea2c6c3e8..a6a8ed1254 100644 --- a/examples/node/scripts/publication/actions/createActOnTypedData.ts +++ b/examples/node/scripts/publication/actions/createActOnTypedData.ts @@ -39,7 +39,7 @@ async function main() { return; } - console.log(`Transaction was successfuly broadcasted with txId ${broadcastValue.txId}`); + console.log(`Transaction was successfully broadcasted with txId ${broadcastValue.txId}`); // wait in a loop console.log(`Waiting for the transaction to be indexed...`); diff --git a/examples/node/scripts/publication/commentOnChain.ts b/examples/node/scripts/publication/commentOnChain.ts index e3a8b6ca68..208e41b50a 100644 --- a/examples/node/scripts/publication/commentOnChain.ts +++ b/examples/node/scripts/publication/commentOnChain.ts @@ -19,7 +19,7 @@ async function main() { return; } - console.log(`Transaction was successfuly broadcasted with txId ${resultValue.txId}`); + console.log(`Transaction was successfully broadcasted with txId ${resultValue.txId}`); // wait in a loop console.log(`Waiting for the transaction to be indexed...`); diff --git a/examples/node/scripts/publication/createLegacyCollectTypedData.ts b/examples/node/scripts/publication/createLegacyCollectTypedData.ts index 6bc70ec327..ad654f5302 100644 --- a/examples/node/scripts/publication/createLegacyCollectTypedData.ts +++ b/examples/node/scripts/publication/createLegacyCollectTypedData.ts @@ -36,7 +36,7 @@ async function main() { return; } - console.log(`Transaction was successfuly broadcasted with txId ${broadcastValue.txId}`); + console.log(`Transaction was successfully broadcasted with txId ${broadcastValue.txId}`); // wait in a loop console.log(`Waiting for the transaction to be indexed...`); diff --git a/examples/node/scripts/publication/createOnChainPostTypedData.ts b/examples/node/scripts/publication/createOnChainPostTypedData.ts index da9c4bb234..75b9c23685 100644 --- a/examples/node/scripts/publication/createOnChainPostTypedData.ts +++ b/examples/node/scripts/publication/createOnChainPostTypedData.ts @@ -39,7 +39,7 @@ async function main() { return; } - console.log(`Transaction was successfuly broadcasted with txId ${broadcastValue.txId}`); + console.log(`Transaction was successfully broadcasted with txId ${broadcastValue.txId}`); // wait in a loop console.log(`Waiting for the transaction to be indexed...`); diff --git a/examples/node/scripts/publication/createOnchainCommentTypedData.ts b/examples/node/scripts/publication/createOnchainCommentTypedData.ts index c6b71656c4..6e6effb8ab 100644 --- a/examples/node/scripts/publication/createOnchainCommentTypedData.ts +++ b/examples/node/scripts/publication/createOnchainCommentTypedData.ts @@ -37,7 +37,7 @@ async function main() { return; } - console.log(`Transaction was successfuly broadcasted with txId ${broadcastValue.txId}`); + console.log(`Transaction was successfully broadcasted with txId ${broadcastValue.txId}`); // wait in a loop console.log(`Waiting for the transaction to be indexed...`); diff --git a/examples/node/scripts/publication/createOnchainMirrorTypedData.ts b/examples/node/scripts/publication/createOnchainMirrorTypedData.ts index 0e6f712ce3..09dd2afbb5 100644 --- a/examples/node/scripts/publication/createOnchainMirrorTypedData.ts +++ b/examples/node/scripts/publication/createOnchainMirrorTypedData.ts @@ -36,7 +36,7 @@ async function main() { return; } - console.log(`Transaction was successfuly broadcasted with txId ${broadcastValue.txId}`); + console.log(`Transaction was successfully broadcasted with txId ${broadcastValue.txId}`); // wait in a loop console.log(`Waiting for the transaction to be indexed...`); diff --git a/examples/node/scripts/publication/createOnchainQuoteTypedData.ts b/examples/node/scripts/publication/createOnchainQuoteTypedData.ts index 62b2f33936..b27d37b298 100644 --- a/examples/node/scripts/publication/createOnchainQuoteTypedData.ts +++ b/examples/node/scripts/publication/createOnchainQuoteTypedData.ts @@ -37,7 +37,7 @@ async function main() { return; } - console.log(`Transaction was successfuly broadcasted with txId ${broadcastValue.txId}`); + console.log(`Transaction was successfully broadcasted with txId ${broadcastValue.txId}`); // wait in a loop console.log(`Waiting for the transaction to be indexed...`); diff --git a/examples/node/scripts/publication/legacyCollect.ts b/examples/node/scripts/publication/legacyCollect.ts index 2c111c8c82..4620b7874f 100644 --- a/examples/node/scripts/publication/legacyCollect.ts +++ b/examples/node/scripts/publication/legacyCollect.ts @@ -18,7 +18,7 @@ async function main() { return; } - console.log(`Transaction was successfuly broadcasted with txId ${resultValue.txId}`); + console.log(`Transaction was successfully broadcasted with txId ${resultValue.txId}`); // wait in a loop console.log(`Waiting for the transaction to be indexed...`); diff --git a/examples/node/scripts/publication/mirrorOnChain.ts b/examples/node/scripts/publication/mirrorOnChain.ts index bdbac67cd4..203fee7b67 100644 --- a/examples/node/scripts/publication/mirrorOnChain.ts +++ b/examples/node/scripts/publication/mirrorOnChain.ts @@ -18,7 +18,7 @@ async function main() { return; } - console.log(`Transaction was successfuly broadcasted with txId ${resultValue.txId}`); + console.log(`Transaction was successfully broadcasted with txId ${resultValue.txId}`); // wait in a loop console.log(`Waiting for the transaction to be indexed...`); diff --git a/examples/node/scripts/publication/postOnChain.ts b/examples/node/scripts/publication/postOnChain.ts index d0a6a97ca1..8b68b75925 100644 --- a/examples/node/scripts/publication/postOnChain.ts +++ b/examples/node/scripts/publication/postOnChain.ts @@ -21,7 +21,7 @@ async function main() { return; } - console.log(`Transaction was successfuly broadcasted with txId ${resultValue.txId}`); + console.log(`Transaction was successfully broadcasted with txId ${resultValue.txId}`); // wait in a loop console.log(`Waiting for the transaction to be indexed...`); diff --git a/examples/node/scripts/publication/quoteOnChain.ts b/examples/node/scripts/publication/quoteOnChain.ts index 1add68fdce..1e4c042969 100644 --- a/examples/node/scripts/publication/quoteOnChain.ts +++ b/examples/node/scripts/publication/quoteOnChain.ts @@ -19,7 +19,7 @@ async function main() { return; } - console.log(`Transaction was successfuly broadcasted with txId ${resultValue.txId}`); + console.log(`Transaction was successfully broadcasted with txId ${resultValue.txId}`); // wait in a loop console.log(`Waiting for the transaction to be indexed...`); diff --git a/packages/client/src/submodules/profile/Profile.ts b/packages/client/src/submodules/profile/Profile.ts index fe1b3163d9..db2e57a7c9 100644 --- a/packages/client/src/submodules/profile/Profile.ts +++ b/packages/client/src/submodules/profile/Profile.ts @@ -45,6 +45,8 @@ import { CreateBlockProfilesBroadcastItemResultFragment, CreateChangeProfileManagersBroadcastItemResultFragment, CreateFollowBroadcastItemResultFragment, + CreateHandleLinkToProfileBroadcastItemResultFragment, + CreateHandleUnlinkFromProfileBroadcastItemResultFragment, CreateOnchainSetProfileMetadataBroadcastItemResultFragment, CreateProfileWithHandleErrorResultFragment, CreateSetFollowModuleBroadcastItemResultFragment, @@ -444,11 +446,37 @@ export class Profile { }); } - async unlinkHandleFromProfile( + async createLinkHandleTypedData( + request: HandleLinkToProfileRequest, + ): PromiseResult< + CreateHandleLinkToProfileBroadcastItemResultFragment, + CredentialsExpiredError | NotAuthenticatedError + > { + return requireAuthHeaders(this.authentication, async (headers) => { + const result = await this.sdk.CreateHandleLinkToProfileTypedData({ request }, headers); + + return result.data.result; + }); + } + + async unlinkHandle( request: HandleUnlinkFromProfileRequest, ): PromiseResult { return requireAuthHeaders(this.authentication, async (headers) => { await this.sdk.HandleUnlinkFromProfile({ request }, headers); }); } + + async createUnlinkHandleTypedData( + request: HandleUnlinkFromProfileRequest, + ): PromiseResult< + CreateHandleUnlinkFromProfileBroadcastItemResultFragment, + CredentialsExpiredError | NotAuthenticatedError + > { + return requireAuthHeaders(this.authentication, async (headers) => { + const result = await this.sdk.CreateHandleUnlinkFromProfileTypedData({ request }, headers); + + return result.data.result; + }); + } } diff --git a/packages/client/src/submodules/profile/graphql/profile.generated.ts b/packages/client/src/submodules/profile/graphql/profile.generated.ts index e87888d5b8..4671993193 100644 --- a/packages/client/src/submodules/profile/graphql/profile.generated.ts +++ b/packages/client/src/submodules/profile/graphql/profile.generated.ts @@ -7,6 +7,7 @@ import { PaginatedResultInfoFragment, RelaySuccessFragment, LensProfileManagerRelayErrorFragment, + Eip712TypedDataFieldFragment, } from '../../../graphql/fragments.generated'; import { GraphQLClient } from 'graphql-request'; import { GraphQLClientRequestHeaders } from 'graphql-request/build/cjs/types'; @@ -18,6 +19,7 @@ import { PaginatedResultInfoFragmentDoc, RelaySuccessFragmentDoc, LensProfileManagerRelayErrorFragmentDoc, + Eip712TypedDataFieldFragmentDoc, } from '../../../graphql/fragments.generated'; export type ProfileManagerFragment = { address: string }; @@ -340,6 +342,42 @@ export type HandleUnlinkFromProfileMutation = { result: LensProfileManagerRelayErrorFragment | RelaySuccessFragment; }; +export type CreateHandleLinkToProfileBroadcastItemResultFragment = { + id: string; + expiresAt: string; + typedData: { + types: { Link: Array }; + domain: Eip712TypedDataDomainFragment; + value: { nonce: string; deadline: string; profileId: string; handleId: string }; + }; +}; + +export type CreateHandleLinkToProfileTypedDataMutationVariables = Types.Exact<{ + request: Types.HandleLinkToProfileRequest; +}>; + +export type CreateHandleLinkToProfileTypedDataMutation = { + result: CreateHandleLinkToProfileBroadcastItemResultFragment; +}; + +export type CreateHandleUnlinkFromProfileBroadcastItemResultFragment = { + id: string; + expiresAt: string; + typedData: { + types: { Unlink: Array }; + domain: Eip712TypedDataDomainFragment; + value: { nonce: string; deadline: string; profileId: string; handleId: string }; + }; +}; + +export type CreateHandleUnlinkFromProfileTypedDataMutationVariables = Types.Exact<{ + request: Types.HandleUnlinkFromProfileRequest; +}>; + +export type CreateHandleUnlinkFromProfileTypedDataMutation = { + result: CreateHandleUnlinkFromProfileBroadcastItemResultFragment; +}; + export const ProfileManagerFragmentDoc = gql` fragment ProfileManager on ProfilesManagedResult { address @@ -521,6 +559,54 @@ export const ProfileStatsFragmentDoc = gql` countOpenActions(request: $profileStatsCountOpenActionArgs) } `; +export const CreateHandleLinkToProfileBroadcastItemResultFragmentDoc = gql` + fragment CreateHandleLinkToProfileBroadcastItemResult on CreateHandleLinkToProfileBroadcastItemResult { + id + expiresAt + typedData { + types { + Link { + ...EIP712TypedDataField + } + } + domain { + ...EIP712TypedDataDomain + } + value { + nonce + deadline + profileId + handleId + } + } + } + ${Eip712TypedDataFieldFragmentDoc} + ${Eip712TypedDataDomainFragmentDoc} +`; +export const CreateHandleUnlinkFromProfileBroadcastItemResultFragmentDoc = gql` + fragment CreateHandleUnlinkFromProfileBroadcastItemResult on CreateHandleUnlinkFromProfileBroadcastItemResult { + id + expiresAt + typedData { + types { + Unlink { + ...EIP712TypedDataField + } + } + domain { + ...EIP712TypedDataDomain + } + value { + nonce + deadline + profileId + handleId + } + } + } + ${Eip712TypedDataFieldFragmentDoc} + ${Eip712TypedDataDomainFragmentDoc} +`; export const ProfileDocument = gql` query Profile($request: ProfileRequest!, $rateRequest: RateRequest = { for: USD }) { result: profile(request: $request) { @@ -867,6 +953,22 @@ export const HandleUnlinkFromProfileDocument = gql` ${RelaySuccessFragmentDoc} ${LensProfileManagerRelayErrorFragmentDoc} `; +export const CreateHandleLinkToProfileTypedDataDocument = gql` + mutation CreateHandleLinkToProfileTypedData($request: HandleLinkToProfileRequest!) { + result: createHandleLinkToProfileTypedData(request: $request) { + ...CreateHandleLinkToProfileBroadcastItemResult + } + } + ${CreateHandleLinkToProfileBroadcastItemResultFragmentDoc} +`; +export const CreateHandleUnlinkFromProfileTypedDataDocument = gql` + mutation CreateHandleUnlinkFromProfileTypedData($request: HandleUnlinkFromProfileRequest!) { + result: createHandleUnlinkFromProfileTypedData(request: $request) { + ...CreateHandleUnlinkFromProfileBroadcastItemResult + } + } + ${CreateHandleUnlinkFromProfileBroadcastItemResultFragmentDoc} +`; export type SdkFunctionWrapper = ( action: (requestHeaders?: Record) => Promise, @@ -907,6 +1009,12 @@ const SetFollowModuleDocumentString = print(SetFollowModuleDocument); const CreateSetFollowModuleTypedDataDocumentString = print(CreateSetFollowModuleTypedDataDocument); const HandleLinkToProfileDocumentString = print(HandleLinkToProfileDocument); const HandleUnlinkFromProfileDocumentString = print(HandleUnlinkFromProfileDocument); +const CreateHandleLinkToProfileTypedDataDocumentString = print( + CreateHandleLinkToProfileTypedDataDocument, +); +const CreateHandleUnlinkFromProfileTypedDataDocumentString = print( + CreateHandleUnlinkFromProfileTypedDataDocument, +); export function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper = defaultWrapper) { return { Profile( @@ -1416,6 +1524,46 @@ export function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper = 'mutation', ); }, + CreateHandleLinkToProfileTypedData( + variables: CreateHandleLinkToProfileTypedDataMutationVariables, + requestHeaders?: GraphQLClientRequestHeaders, + ): Promise<{ + data: CreateHandleLinkToProfileTypedDataMutation; + extensions?: any; + headers: Dom.Headers; + status: number; + }> { + return withWrapper( + (wrappedRequestHeaders) => + client.rawRequest( + CreateHandleLinkToProfileTypedDataDocumentString, + variables, + { ...requestHeaders, ...wrappedRequestHeaders }, + ), + 'CreateHandleLinkToProfileTypedData', + 'mutation', + ); + }, + CreateHandleUnlinkFromProfileTypedData( + variables: CreateHandleUnlinkFromProfileTypedDataMutationVariables, + requestHeaders?: GraphQLClientRequestHeaders, + ): Promise<{ + data: CreateHandleUnlinkFromProfileTypedDataMutation; + extensions?: any; + headers: Dom.Headers; + status: number; + }> { + return withWrapper( + (wrappedRequestHeaders) => + client.rawRequest( + CreateHandleUnlinkFromProfileTypedDataDocumentString, + variables, + { ...requestHeaders, ...wrappedRequestHeaders }, + ), + 'CreateHandleUnlinkFromProfileTypedData', + 'mutation', + ); + }, }; } export type Sdk = ReturnType; diff --git a/packages/client/src/submodules/profile/graphql/profile.graphql b/packages/client/src/submodules/profile/graphql/profile.graphql index 2fc71173d5..2aac952599 100644 --- a/packages/client/src/submodules/profile/graphql/profile.graphql +++ b/packages/client/src/submodules/profile/graphql/profile.graphql @@ -450,3 +450,57 @@ mutation HandleUnlinkFromProfile($request: HandleUnlinkFromProfileRequest!) { } } } + +fragment CreateHandleLinkToProfileBroadcastItemResult on CreateHandleLinkToProfileBroadcastItemResult { + id + expiresAt + typedData { + types { + Link { + ...EIP712TypedDataField + } + } + domain { + ...EIP712TypedDataDomain + } + value { + nonce + deadline + profileId + handleId + } + } +} + +mutation CreateHandleLinkToProfileTypedData($request: HandleLinkToProfileRequest!) { + result: createHandleLinkToProfileTypedData(request: $request) { + ...CreateHandleLinkToProfileBroadcastItemResult + } +} + +fragment CreateHandleUnlinkFromProfileBroadcastItemResult on CreateHandleUnlinkFromProfileBroadcastItemResult { + id + expiresAt + typedData { + types { + Unlink { + ...EIP712TypedDataField + } + } + domain { + ...EIP712TypedDataDomain + } + value { + nonce + deadline + profileId + handleId + } + } +} + +mutation CreateHandleUnlinkFromProfileTypedData($request: HandleUnlinkFromProfileRequest!) { + result: createHandleUnlinkFromProfileTypedData(request: $request) { + ...CreateHandleUnlinkFromProfileBroadcastItemResult + } +}