-
Notifications
You must be signed in to change notification settings - Fork 81
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
Showing
20 changed files
with
1,092 additions
and
18 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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { FramesEip721TypedDataSpec, LensClient, development } from '@lens-protocol/client'; | ||
|
||
async function main() { | ||
const client = new LensClient({ | ||
environment: development, | ||
}); | ||
|
||
const deadline = new Date(); | ||
deadline.setMinutes(deadline.getMinutes() + 30); | ||
|
||
const result = await client.frames.createFrameTypedData({ | ||
actionResponse: '0x0000000000000000000000000000000000000000', | ||
buttonIndex: 2, | ||
deadline: deadline.getTime(), | ||
inputText: 'Hello, World!', | ||
profileId: '0x01', | ||
pubId: '0x01-0x01', | ||
specVersion: FramesEip721TypedDataSpec.OnePointOnePointOne, | ||
state: '{"counter":1,"idempotency_key":"431b8b38-eb4d-455b"}', | ||
url: 'https://mylensframe.xyz', | ||
}); | ||
|
||
console.log(`Result: `, result); | ||
} | ||
|
||
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,31 @@ | ||
import { FramesEip721TypedDataSpec } from '@lens-protocol/client'; | ||
|
||
import { getAuthenticatedClient } from '../shared/getAuthenticatedClient'; | ||
import { setupWallet } from '../shared/setupWallet'; | ||
|
||
async function main() { | ||
const wallet = setupWallet(); | ||
const client = await getAuthenticatedClient(wallet, '0x58'); | ||
|
||
const result = await client.frames.signFrameAction({ | ||
actionResponse: '0x0000000000000000000000000000000000000000', | ||
buttonIndex: 2, | ||
inputText: 'Hello, World!', | ||
profileId: '0x01', | ||
pubId: '0x01-0x01', | ||
specVersion: FramesEip721TypedDataSpec.OnePointOnePointOne, | ||
state: '{"counter":1,"idempotency_key":"431b8b38-eb4d-455b"}', | ||
url: 'https://mylensframe.xyz', | ||
}); | ||
|
||
if (result.isFailure()) { | ||
console.error(result.error); // CredentialsExpiredError or NotAuthenticatedError | ||
process.exit(1); | ||
} | ||
|
||
const data = result.value; | ||
|
||
console.log(`Result: `, data); | ||
} | ||
|
||
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,44 @@ | ||
import { FramesEip721TypedDataSpec } from '@lens-protocol/client'; | ||
|
||
import { getAuthenticatedClient } from '../shared/getAuthenticatedClient'; | ||
import { setupWallet } from '../shared/setupWallet'; | ||
|
||
async function main() { | ||
const wallet = setupWallet(); | ||
const client = await getAuthenticatedClient(wallet, '0x58'); | ||
const idTokenResult = await client.authentication.getIdentityToken(); | ||
|
||
const idToken = idTokenResult.unwrap(); | ||
|
||
// get signature | ||
const result = await client.frames.signFrameAction({ | ||
actionResponse: '0x0000000000000000000000000000000000000000', | ||
buttonIndex: 2, | ||
inputText: 'Hello, World!', | ||
profileId: '0x01', | ||
pubId: '0x01-0x01', | ||
specVersion: FramesEip721TypedDataSpec.OnePointOnePointOne, | ||
state: '{"counter":1,"idempotency_key":"431b8b38-eb4d-455b"}', | ||
url: 'https://mylensframe.xyz', | ||
}); | ||
|
||
if (result.isFailure()) { | ||
console.error(result.error); // CredentialsExpiredError or NotAuthenticatedError | ||
process.exit(1); | ||
} | ||
|
||
const data = result.value; | ||
|
||
console.log(`SignFrameAction result: `, data); | ||
|
||
// verify | ||
const verifyResult = await client.frames.verifyFrameSignature({ | ||
identityToken: idToken, | ||
signature: data.signature, | ||
signedTypedData: data.signedTypedData, | ||
}); | ||
|
||
console.log(`Is signature valid? `, verifyResult); | ||
} | ||
|
||
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
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.