Skip to content

Commit

Permalink
feat: support new post operations and other GQL updates
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarenaldi committed Feb 21, 2025
1 parent 3b960c3 commit 1076bb7
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 13 deletions.
49 changes: 43 additions & 6 deletions packages/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1300,8 +1300,8 @@ input CreateAppRequest {
"""The app signers leave empty if none"""
signers: [EvmAddress!]

"""The app paymaster leave empty if none"""
paymaster: EvmAddress
"""The app sponsorship leave empty if none"""
sponsorship: EvmAddress

"""The app treasury leave empty if none"""
treasury: EvmAddress
Expand Down Expand Up @@ -2442,6 +2442,10 @@ type ExecutePostActionResponse {

union ExecutePostActionResult = ExecutePostActionResponse | SponsoredTransactionRequest | SelfFundedTransactionRequest | TransactionWillFail

input ExecutedUnknownActionRequest {
address: EvmAddress!
}

"""The challenge has expired or was not found."""
type ExpiredChallengeError {
reason: String!
Expand Down Expand Up @@ -2670,8 +2674,8 @@ type Follower {
}

type FollowerOn {
globalGraph: Boolean
graph: EvmAddress
globalGraph: Boolean!
graph: EvmAddress!
}

input FollowerOnInput @oneOf {
Expand Down Expand Up @@ -3593,6 +3597,15 @@ type LoggedInPostOperations {
hasReposted: BooleanValue!
canEdit: PostOperationValidationOutcome!
canDelete: PostOperationValidationOutcome!
canTip: Boolean!
canSimpleCollect: SimpleCollectValidationOutcome!
executedUnknownActionCount(request: ExecutedUnknownActionRequest!): Int!
hasExecutedUnknownAction(request: ExecutedUnknownActionRequest!): Boolean!
simpleCollectCount: Int!
hasSimpleCollected: Boolean!
postTipCount: Int!
hasTipped: Boolean!
lastTip: PostTip
}

type LoggedInUsernameNamespaceOperations {
Expand Down Expand Up @@ -5732,6 +5745,11 @@ input PostTagsRequest {
cursor: Cursor
}

type PostTip {
amount: Erc20Amount!
date: DateTime!
}

enum PostType {
ROOT
COMMENT
Expand Down Expand Up @@ -5860,7 +5878,7 @@ type Query {
You MUST be authenticated as a builder to use this mutation.
"""
appServerApiKey(request: AppServerApiKeyRequest!): ServerAPIKey!
appServerApiKey(request: AppServerApiKeyRequest!): String

"""
List all active authenticated sessions for the current account.
Expand Down Expand Up @@ -6380,7 +6398,7 @@ input SimpleCollectActionConfigInput {
collectLimit: Int
followerOnGraph: FollowerOnInput
endsAt: DateTime
isImmutable: Boolean! = false
isImmutable: Boolean! = true
}

type SimpleCollectActionContract {
Expand All @@ -6392,6 +6410,25 @@ input SimpleCollectExecuteInput {
referrals: [ReferralCut!]
}

type SimpleCollectValidationFailed {
reasonType: SimpleCollectValidationFailedReason!
reason: String!
}

enum SimpleCollectValidationFailedReason {
NOT_ENABLED
END_DATE_REACHED
LIMIT_REACHED
NOT_ENOUGH_BALANCE
NOT_A_FOLLOWER
}

union SimpleCollectValidationOutcome = SimpleCollectValidationPassed | SimpleCollectValidationFailed

type SimpleCollectValidationPassed {
passed: AlwaysTrue!
}

input SimplePaymentFeedRuleConfig {
cost: AmountInput!
recipient: EvmAddress!
Expand Down
8 changes: 8 additions & 0 deletions packages/graphql/src/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1129,3 +1129,11 @@ export enum MarketplaceMetadataAttributeType {
String = 'STRING',
Date = 'DATE',
}

export enum SimpleCollectValidationFailedReason {
NotEnabled = 'NOT_ENABLED',
EndDateReached = 'END_DATE_REACHED',
LimitReached = 'LIMIT_REACHED',
NotEnoughBalance = 'NOT_ENOUGH_BALANCE',
NotAFollower = 'NOT_A_FOLLOWER',
}
3 changes: 3 additions & 0 deletions packages/graphql/src/fragments/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ export type FollowerOn = FragmentOf<typeof FollowerOnFragment>;

export const NetworkAddressFragment = graphql(
`fragment NetworkAddress on NetworkAddress {
__typename
address
chainId
}`,
Expand All @@ -308,6 +309,7 @@ export type NetworkAddress = FragmentOf<typeof NetworkAddressFragment>;

export const Erc20Fragment = graphql(
`fragment Erc20 on Erc20 {
__typename
name
symbol
decimals
Expand All @@ -321,6 +323,7 @@ export type Erc20 = FragmentOf<typeof Erc20Fragment>;

export const Erc20AmountFragment = graphql(
`fragment Erc20Amount on Erc20Amount {
__typename
asset {
...Erc20
}
Expand Down
68 changes: 66 additions & 2 deletions packages/graphql/src/fragments/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ export type PostOperationValidationFailed = FragmentOf<
typeof PostOperationValidationFailedFragment
>;

export const PostOperationValidationOutcome = graphql(
export const PostOperationValidationOutcomeFragment = graphql(
`fragment PostOperationValidationOutcome on PostOperationValidationOutcome {
... on PostOperationValidationPassed {
...PostOperationValidationPassed
Expand All @@ -264,6 +264,54 @@ export type OperationValidationOutcome =
| PostOperationValidationUnknown
| PostOperationValidationFailed;

export const PostTipFragment = graphql(
`fragment PostTip on PostTip {
__typename
amount {
...Erc20Amount
}
date
}`,
[Erc20AmountFragment],
);
export type PostTip = FragmentOf<typeof PostTipFragment>;

export const SimpleCollectValidationPassedFragment = graphql(
`fragment SimpleCollectValidationPassed on SimpleCollectValidationPassed {
__typename
}`,
);
export type SimpleCollectValidationPassed = FragmentOf<
typeof SimpleCollectValidationPassedFragment
>;

export const SimpleCollectValidationFailedFragment = graphql(
`fragment SimpleCollectValidationFailed on SimpleCollectValidationFailed {
__typename
reasonType
reason
}`,
);
export type SimpleCollectValidationFailed = FragmentOf<
typeof SimpleCollectValidationFailedFragment
>;

export const SimpleCollectValidationOutcomeFragment = graphql(
`fragment SimpleCollectValidationOutcome on SimpleCollectValidationOutcome {
__typename
... on SimpleCollectValidationPassed {
...SimpleCollectValidationPassed
}
... on SimpleCollectValidationFailed {
...SimpleCollectValidationFailed
}
}`,
[SimpleCollectValidationPassedFragment, SimpleCollectValidationFailedFragment],
);
export type SimpleCollectValidationOutcome =
| SimpleCollectValidationPassed
| SimpleCollectValidationFailed;

export const LoggedInPostOperationsFragment = graphql(
`fragment LoggedInPostOperations on LoggedInPostOperations {
__typename
Expand All @@ -283,6 +331,10 @@ export const LoggedInPostOperationsFragment = graphql(
canRepost {
...PostOperationValidationOutcome
}
canSimpleCollect {
...SimpleCollectValidationOutcome
}
canTip
hasBookmarked
hasCommented {
...BooleanValue
Expand All @@ -296,9 +348,21 @@ export const LoggedInPostOperationsFragment = graphql(
hasReposted {
...BooleanValue
}
hasSimpleCollected
hasTipped
isNotInterested
lastTip {
...PostTip
}
postTipCount
simpleCollectCount
}`,
[BooleanValueFragment, PostOperationValidationOutcome],
[
BooleanValueFragment,
PostOperationValidationOutcomeFragment,
PostTipFragment,
SimpleCollectValidationOutcomeFragment,
],
);
export type LoggedInPostOperations = FragmentOf<typeof LoggedInPostOperationsFragment>;

Expand Down
Loading

0 comments on commit 1076bb7

Please sign in to comment.