-
Notifications
You must be signed in to change notification settings - Fork 87
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
feat: frames 1.1 #1085
base: next
Are you sure you want to change the base?
feat: frames 1.1 #1085
Conversation
|
@defispartan is attempting to deploy a commit to the Avara Team on Vercel. A member of the Team first needs to authorize it. |
@@ -1137,3 +1137,17 @@ export enum SimpleCollectValidationFailedReason { | |||
NotEnoughBalance = 'NOT_ENOUGH_BALANCE', | |||
NotAFollower = 'NOT_A_FOLLOWER', | |||
} | |||
|
|||
export enum FrameVerifySignatureResult { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please bind this new enum to the corresponding type in here? This results in GQL inferred types that reference this enum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the binding
After I added it though this line now returns a type error
Is there an example of another API endpoint that directly returns an enum? I tried searching to see how the types were implemented in the SDK but I couldn't find one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returning an enum should not be different than returning a scalar.
The closest thing I can think of is Query. appServerApiKey
which returns a string.
Since you told the type system that the FrameVerifySignatureResult
binds to the provided enum, you should not need to do lookup (with type assertion) at all.
export function verifyFrameSignature(
client: AnyClient,
request: VerifyFrameSignatureRequest,
): ResultAsync<FrameVerifySignatureResult, UnexpectedError> {
return client
.query(VerifyFrameSignatureQuery, { request })
- .map((result) => FrameVerifySignatureResult[result as keyof typeof FrameVerifySignatureResult]);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TSDocs examples have the Lens SDK v2 signature and jargon (e.g. 'LensClient'). Can we please update them according to the new implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
* | ||
* @example | ||
* ```ts | ||
* const result = await createFrameTypedData(client, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use this naming convention to re-inforce in the example what it can be used.
* const result = await createFrameTypedData(client, { | |
* const result = await createFrameTypedData(anyClient, { |
* | ||
* @example | ||
* ```ts | ||
* const result = await signFrameAction(client, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* const result = await signFrameAction(client, { | |
* const result = await signFrameAction(sessionClient, { |
Similarly, just reinforcing what's needed.
* | ||
* @example | ||
* ```ts | ||
* const result = await verifyFrameSignature(client, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* const result = await verifyFrameSignature(client, { | |
* const result = await verifyFrameSignature(anyClient, { |
/** | ||
* Sign Frame action with Lens Manager if enabled | ||
* | ||
* ⚠️ Requires authenticated LensClient. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* ⚠️ Requires authenticated LensClient. | |
* ⚠️ Requires authenticated SessionClient. |
verified = 'VERIFIED', | ||
postDoesntExist = 'POST_DOESNT_EXIST', | ||
identityUnauthorized = 'IDENTITY_UNAUTHORIZED', | ||
identityTokenNotValid = 'IDENTITY_TOKEN_NOT_VALID', | ||
typedDataTypesIncorrectFields = 'TYPED_DATA_TYPES_INCORRECT_FIELDS', | ||
typedDataDomainIncorrect = 'TYPED_DATA_DOMAIN_INCORRECT', | ||
typedDataAccountNotMatchingIdentityToken = 'TYPED_DATA_ACCOUNT_NOT_MATCHING_IDENTITY_TOKEN', | ||
identityCannotUseAccount = 'IDENTITY_CANNOT_USE_ACCOUNT', | ||
signatureNotValid = 'SIGNATURE_NOT_VALID', | ||
deadlineExpired = 'DEADLINE_EXPIRED', | ||
signerAddressCannotUseAccount = 'SIGNER_ADDRESS_CANNOT_USE_ACCOUNT', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please PascalCase these?
@@ -1137,3 +1137,17 @@ export enum SimpleCollectValidationFailedReason { | |||
NotEnoughBalance = 'NOT_ENOUGH_BALANCE', | |||
NotAFollower = 'NOT_A_FOLLOWER', | |||
} | |||
|
|||
export enum FrameVerifySignatureResult { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returning an enum should not be different than returning a scalar.
The closest thing I can think of is Query. appServerApiKey
which returns a string.
Since you told the type system that the FrameVerifySignatureResult
binds to the provided enum, you should not need to do lookup (with type assertion) at all.
export function verifyFrameSignature(
client: AnyClient,
request: VerifyFrameSignatureRequest,
): ResultAsync<FrameVerifySignatureResult, UnexpectedError> {
return client
.query(VerifyFrameSignatureQuery, { request })
- .map((result) => FrameVerifySignatureResult[result as keyof typeof FrameVerifySignatureResult]);
}
No description provided.