Skip to content

Commit

Permalink
🌺 Lens and Hey v3: v25 (#lens-v3)
Browse files Browse the repository at this point in the history
Summary: Refactored GraphQL mutations to use fragments for transaction requests.

Highlights:

• Added `SelfFundedTransactionRequestFields` and `SponsoredTransactionRequestFields` fragments.
• Replaced inline fields with fragments in multiple mutation files.
• Enhanced transaction request handling with detailed field structures.

Read more: https://pierre.co/hey/hey/lens-v3
  • Loading branch information
Yoginth authored and Pierre committed Dec 4, 2024
1 parent 8ab700b commit d4f6b19
Show file tree
Hide file tree
Showing 37 changed files with 374 additions and 157 deletions.
6 changes: 6 additions & 0 deletions packages/indexer/documents/fragments/AmountFields.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
fragment AmountFields on Amount {
asset {
...AssetFields
}
value
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fragment NetworkAddressFields on NetworkAddress {
address
chainId
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
fragment SelfFundedTransactionRequestFields on SelfFundedTransactionRequest {
reason
raw {
chainId
data
from
gasLimit
maxFeePerGas
maxPriorityFeePerGas
nonce
to
type
value
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
fragment SponsoredTransactionRequestFields on SponsoredTransactionRequest {
reason
raw {
chainId
data
from
gasLimit
gasPrice
nonce
to
type
value
customData {
customSignature
factoryDeps
gasPerPubdata
paymasterParams {
paymaster
paymasterInput
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
fragment SimplePaymentFollowRuleFields on SimplePaymentFollowRule {
amount {
asset {
...AssetFields
}
value
...AmountFields
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fragment CommentNotificationFields on CommentNotification {
id
comment {
...PostFields
...AnyPostFields
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fragment MentionNotificationFields on MentionNotification {
id
post {
...PostFields
...AnyPostFields
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fragment QuoteNotificationFields on QuoteNotification {
id
quote {
...PostFields
...AnyPostFields
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
fragment ReactionNotificationFields on ReactionNotification {
id
post {
...PostFields
...AnyPostFields
}
reactions {
account {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
fragment RepostNotificationFields on RepostNotification {
id
post {
...PostFields
...AnyPostFields
}
reposts {
account {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
fragment AnyPostFields on AnyPost {
... on Post {
...PostFields
}
... on Repost {
...RepostFields
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
fragment PostActionFields on PostAction {
... on SimpleCollectActionSettings {
...SimpleCollectActionSettingsFields
}
... on UnknownActionSettings {
...UnknownActionSettingsFields
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ fragment PostBaseFields on Post {
stats {
...PostStatsFields
}
actions {
...PostActionFields
}
author {
...AccountFields
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
fragment SimpleCollectActionSettingsFields on SimpleCollectActionSettings {
collectLimit
collectNft
endsAt
followerOnly
recipient
referralFee
amount {
...AmountFields
}
contract {
...NetworkAddressFields
}
recipients {
recipient
split
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fragment UnknownActionSettingsFields on UnknownActionSettings {
__typename
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
mutation AddAccountManager($request: AddAccountManagerRequest!) {
addAccountManager(request: $request) {
... on SelfFundedTransactionRequest {
reason
...SelfFundedTransactionRequestFields
}
... on SponsoredTransactionRequest {
reason
...SponsoredTransactionRequestFields
}
... on TransactionWillFail {
reason
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ mutation AssignUsernameToAccount($request: AssignUsernameToAccountRequest!) {
hash
}
... on SelfFundedTransactionRequest {
reason
...SelfFundedTransactionRequestFields
}
... on SponsoredTransactionRequest {
reason
...SponsoredTransactionRequestFields
}
... on TransactionWillFail {
reason
Expand Down
4 changes: 2 additions & 2 deletions packages/indexer/documents/mutations/account/Block.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ mutation Block($request: BlockRequest!) {
error
}
... on SelfFundedTransactionRequest {
reason
...SelfFundedTransactionRequestFields
}
... on SponsoredTransactionRequest {
reason
...SponsoredTransactionRequestFields
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ mutation CreateAccountWithUsername(
reason
}
... on SelfFundedTransactionRequest {
reason
...SelfFundedTransactionRequestFields
}
... on SponsoredTransactionRequest {
reason
...SponsoredTransactionRequestFields
}
... on TransactionWillFail {
reason
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
mutation EnableSignless {
enableSignless {
... on SelfFundedTransactionRequest {
reason
...SelfFundedTransactionRequestFields
}
... on SponsoredTransactionRequest {
reason
...SponsoredTransactionRequestFields
}
... on TransactionWillFail {
reason
Expand Down
4 changes: 2 additions & 2 deletions packages/indexer/documents/mutations/account/Follow.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ mutation Follow($request: CreateFollowRequest!) {
hash
}
... on SelfFundedTransactionRequest {
reason
...SelfFundedTransactionRequestFields
}
... on SponsoredTransactionRequest {
reason
...SponsoredTransactionRequestFields
}
... on TransactionWillFail {
reason
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
mutation RemoveAccountManager($request: RemoveAccountManagerRequest!) {
removeAccountManager(request: $request) {
... on SelfFundedTransactionRequest {
reason
...SelfFundedTransactionRequestFields
}
... on SponsoredTransactionRequest {
reason
...SponsoredTransactionRequestFields
}
... on TransactionWillFail {
reason
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ mutation SetAccountMetadata($request: SetAccountMetadataRequest!) {
... on SetAccountMetadataResponse {
hash
}
... on SponsoredTransactionRequest {
reason
}
... on SelfFundedTransactionRequest {
reason
...SelfFundedTransactionRequestFields
}
... on SponsoredTransactionRequest {
...SponsoredTransactionRequestFields
}
... on TransactionWillFail {
reason
Expand Down
4 changes: 2 additions & 2 deletions packages/indexer/documents/mutations/account/Unblock.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ mutation Unblock($request: UnblockRequest!) {
error
}
... on SelfFundedTransactionRequest {
reason
...SelfFundedTransactionRequestFields
}
... on SponsoredTransactionRequest {
reason
...SponsoredTransactionRequestFields
}
}
}
4 changes: 2 additions & 2 deletions packages/indexer/documents/mutations/account/Unfollow.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ mutation Unfollow($request: CreateUnfollowRequest!) {
hash
}
... on SelfFundedTransactionRequest {
reason
...SelfFundedTransactionRequestFields
}
... on SponsoredTransactionRequest {
reason
...SponsoredTransactionRequestFields
}
... on TransactionWillFail {
reason
Expand Down
4 changes: 2 additions & 2 deletions packages/indexer/documents/mutations/group/JoinGroup.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ mutation JoinGroup($request: JoinGroupRequest!) {
hash
}
... on SelfFundedTransactionRequest {
reason
...SelfFundedTransactionRequestFields
}
... on SponsoredTransactionRequest {
reason
...SponsoredTransactionRequestFields
}
... on TransactionWillFail {
reason
Expand Down
4 changes: 2 additions & 2 deletions packages/indexer/documents/mutations/group/LeaveGroup.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ mutation LeaveGroup($request: LeaveGroupRequest!) {
hash
}
... on SelfFundedTransactionRequest {
reason
...SelfFundedTransactionRequestFields
}
... on SponsoredTransactionRequest {
reason
...SponsoredTransactionRequestFields
}
... on TransactionWillFail {
reason
Expand Down
4 changes: 2 additions & 2 deletions packages/indexer/documents/mutations/post/CreatePost.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ mutation CreatePost($request: CreatePostRequest!) {
hash
}
... on SelfFundedTransactionRequest {
reason
...SelfFundedTransactionRequestFields
}
... on SponsoredTransactionRequest {
reason
...SponsoredTransactionRequestFields
}
... on TransactionWillFail {
reason
Expand Down
4 changes: 2 additions & 2 deletions packages/indexer/documents/mutations/post/DeletePost.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ mutation DeletePost($request: DeletePostRequest!) {
hash
}
... on SelfFundedTransactionRequest {
reason
...SelfFundedTransactionRequestFields
}
... on SponsoredTransactionRequest {
reason
...SponsoredTransactionRequestFields
}
... on TransactionWillFail {
reason
Expand Down
4 changes: 2 additions & 2 deletions packages/indexer/documents/mutations/post/Repost.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ mutation Repost($request: CreateRepostRequest!) {
hash
}
... on SelfFundedTransactionRequest {
reason
...SelfFundedTransactionRequestFields
}
... on SponsoredTransactionRequest {
reason
...SponsoredTransactionRequestFields
}
... on TransactionWillFail {
reason
Expand Down
2 changes: 1 addition & 1 deletion packages/indexer/documents/queries/post/Post.graphql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
query Post($request: PostRequest!) {
post(request: $request) {
...PostFields
...AnyPostFields
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
query PostBookmarks($request: PostBookmarksRequest!) {
postBookmarks(request: $request) {
items {
... on Post {
...PostFields
}
... on Repost {
...RepostFields
}
...AnyPostFields
}
pageInfo {
...PaginatedResultInfoFields
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
query PostReferences($request: PostReferencesRequest!) {
postReferences(request: $request) {
items {
... on Post {
...PostFields
}
... on Repost {
...RepostFields
}
...AnyPostFields
}
pageInfo {
...PaginatedResultInfoFields
Expand Down
Loading

0 comments on commit d4f6b19

Please sign in to comment.