-
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
4117a7d
commit 950403b
Showing
12 changed files
with
431 additions
and
105 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
examples/node/scripts/profile/blockProfileViaLensProfileManager.ts
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,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(); |
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,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(); |
30 changes: 28 additions & 2 deletions
30
examples/node/scripts/profile/linkHandleToProfileViaTypedData.ts
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,13 +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 client = await getAuthenticatedClientFromEthersWallet(wallet); | ||
const lensClient = await getAuthenticatedClientFromEthersWallet(wallet); | ||
|
||
await client.profile.linkHandle({ | ||
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(); |
24 changes: 24 additions & 0 deletions
24
examples/node/scripts/profile/unblockProfileViaLensProfileManager.ts
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,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(); |
39 changes: 39 additions & 0 deletions
39
examples/node/scripts/profile/unblockProfileViaTypedData.ts
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,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(); |
39 changes: 39 additions & 0 deletions
39
examples/node/scripts/profile/unlinkHandleToProfileViaTypedData.ts
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,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(); |
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.