@playthecut/agent 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/api.md +264 -0
- package/dist/contract.d.ts +45 -578
- package/dist/contract.d.ts.map +1 -1
- package/docs/agents.md +1 -1
- package/docs/api.md +264 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ const { lineupId } = await agent.lineupUpsert({
|
|
|
26
26
|
await agent.join({ contestId: contests[0].contestId, lineupId });
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
The account is one wallet. A person signs in with Privy in the browser, installs or revokes a delegate, and can enter a contest from the app. An agent can register that wallet itself and sign the same player routes. The route list is
|
|
29
|
+
The account is one wallet. A person signs in with Privy in the browser, installs or revokes a delegate, and can enter a contest from the app. An agent can register that wallet itself and sign the same player routes. The route list is [api.md](api.md). This page is how to sign, and how the play actions work.
|
|
30
30
|
|
|
31
31
|
A delegate is a key the user installs on that wallet so another client can act for them. The delegate signs this API. The server may hold the key, or the caller may hold it. Both are the same kind of key.
|
|
32
32
|
|
package/api.md
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
# Server API reference (v4)
|
|
2
|
+
|
|
3
|
+
Base URL: `/api` (e.g. `http://localhost:3000/api`)
|
|
4
|
+
|
|
5
|
+
Signing for agents is in [README.md](README.md). This file is the route list.
|
|
6
|
+
|
|
7
|
+
Two ways to write a lineup or a paid contest:
|
|
8
|
+
|
|
9
|
+
- `/api/lineups` and `/api/contests` record a transaction the wallet already sent.
|
|
10
|
+
- `POST /api/bot/actions` is where the server builds and submits the user operation (`lineupUpsert`, `join`, `leave`, `createContest`).
|
|
11
|
+
|
|
12
|
+
A lineup roster is `candidates` on every request and response. A write is an ordered array of `eventParticipantId` strings. A read is that roster with scores. `GET /api/sports/:sportId/events/:eventId/candidates` is the field pool, a different shape under the same word.
|
|
13
|
+
|
|
14
|
+
## Authentication
|
|
15
|
+
|
|
16
|
+
| Value | Meaning |
|
|
17
|
+
|-------|---------|
|
|
18
|
+
| `none` | No credential. A bearer or signature is optional where the description says so. |
|
|
19
|
+
| `either` | Privy bearer or an ERC-8128 signature. One is required. |
|
|
20
|
+
| `signature` | ERC-8128 only. |
|
|
21
|
+
| `privy` | Privy bearer only. |
|
|
22
|
+
| `staff` | Privy bearer and `userType` `ADMIN` or `SUPER_ADMIN`. |
|
|
23
|
+
|
|
24
|
+
Player routes accept either a Privy bearer token or an [ERC-8128](https://erc8128.org) HTTP message signature. The headers are `Signature-Input` and `Signature`, plus `Content-Digest` when the request has a body. Sending both credentials is `400`. The signer is an active delegate for the signed `smartWallet` query, or the wallet verified with ERC-1271 when that query is omitted. `user.address` is the wallet. `keyid` is `eip8128:<chainId>:0x<signer>` and its chain must equal `X-Cut-Chain-Id` when that header is present (`8453` or `84532`). The signature is Request-Bound and Non-Replayable: `created` and `expires` are at most one hour apart, and `(keyid, nonce)` is consumed until `expires`.
|
|
25
|
+
|
|
26
|
+
`AGENT` is a player type. It is not staff.
|
|
27
|
+
|
|
28
|
+
The browser sends:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
Authorization: Bearer <privy_access_token>
|
|
32
|
+
X-Cut-Chain-Id: <8453 or 84532; required on on-chain routes via requireWalletChain>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Bearer middleware verifies the Privy JWT and loads the Cut user from Postgres (`User` + primary `UserWallet`). It does not call Privy `users()._get` or write identity rows. Browser signup and wallet sync happen on `POST /auth/session` and `POST /auth/sync-wallets`. An agent account is created on `POST /auth/register`. A later Privy login on that wallet attaches `privyUserId` and leaves `userType` `AGENT`.
|
|
36
|
+
|
|
37
|
+
**Auth error codes**
|
|
38
|
+
|
|
39
|
+
| Code | HTTP | Meaning |
|
|
40
|
+
|------|------|---------|
|
|
41
|
+
| `NEEDS_PROVISIONING` | 401 | Valid JWT, no Cut user — client should `POST /auth/session` |
|
|
42
|
+
| `WALLET_NOT_PROVISIONED_FOR_CHAIN` | 409 | User exists, no primary wallet for `X-Cut-Chain-Id` |
|
|
43
|
+
| `WALLET_OWNED_BY_OTHER_ACCOUNT` | 409 | Privy-linked address belongs to another user |
|
|
44
|
+
| `EMAIL_ALREADY_BOUND` | 400 | Email already linked to another Cut user |
|
|
45
|
+
|
|
46
|
+
JSON bodies are capped at 128 KiB.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Route index
|
|
51
|
+
|
|
52
|
+
| Prefix | Router file |
|
|
53
|
+
|--------|-------------|
|
|
54
|
+
| `/health` | `api.ts` |
|
|
55
|
+
| `/auth` | `auth.ts` |
|
|
56
|
+
| `/sports` | `sports.ts` |
|
|
57
|
+
| `/lineups` | `lineups.ts` |
|
|
58
|
+
| `/contests` | `contest.ts` |
|
|
59
|
+
| `/userGroups` | `userGroup.ts` |
|
|
60
|
+
| `/admin` | `admin.ts` |
|
|
61
|
+
| `/cron` | `cron.ts` |
|
|
62
|
+
| `/unsubscribe` | `unsubscribe.ts` |
|
|
63
|
+
| `/stream` | `stream.ts` |
|
|
64
|
+
| `/bot` | `bot.ts` |
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Health
|
|
69
|
+
|
|
70
|
+
| Method | Path | Auth | Description |
|
|
71
|
+
|--------|------|------|-------------|
|
|
72
|
+
| GET | `/api/health` | none | `{ status, service, gitSha, timestamp }` |
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Auth (`/api/auth`)
|
|
77
|
+
|
|
78
|
+
| Method | Path | Auth | Description |
|
|
79
|
+
|--------|------|------|-------------|
|
|
80
|
+
| POST | `/register` | signature | Create an agent account. Wallet signer only. Body requires `email`; optional `name`, `referralCode`. New accounts are `userType` `AGENT`. A `smartWallet` query that is not the signer is `403`. Repeating register for the same wallet returns that account and does not change email or type. `201` when created, `200` when the wallet already has an account. Response: `userId`, `email`, `userType`, `name`, `referralCode`, `smartWallet`, `created`. |
|
|
81
|
+
| POST | `/session` | privy | Signup / sync from Privy. Optional `X-Cut-Referral-Code` is best-effort. Privy dashboard test accounts are stored as `userType` `TEST`. |
|
|
82
|
+
| POST | `/sync-wallets` | privy | Re-sync `UserWallet` rows from Privy linked accounts. |
|
|
83
|
+
| GET | `/me` | either | Profile, leagues, and `referralCode`. Mints a code if the user has none. |
|
|
84
|
+
| GET | `/referrals/summary` | either | Referral tree summary. |
|
|
85
|
+
| PUT | `/update` | either | Display name, 1–80 characters. |
|
|
86
|
+
| PUT | `/settings` | either | Merge `color`, `oddsFormat` (`american`, `decimal`, `english`), and `onboardingDismissed`. Does not change `marketingUnsubscribed`. |
|
|
87
|
+
| GET | `/contests` | either | This account's contest history. |
|
|
88
|
+
| GET | `/transactions` | either | Activity feed: entries, predictions, payouts. |
|
|
89
|
+
| POST | `/onchain-payments` | either | Record a confirmed value transfer. `X-Cut-Chain-Id` required. Body: `kind` (`ENTRY`, `WAGER`, `WITHDRAW`, `REFUND`, `SEND`, `PRIMARY`, `SECONDARY`), `tokenAddress`, `amountWei`, `from`, `to`, `transactionHash`, `logIndex`. `contestId` is required except for `SEND`. Optional `entryId`, `lineupId`. The server loads the receipt and stores the log amount. `ENTRY` and `WAGER` require an ERC-20 `Transfer` at `logIndex` from the account to the contest, in the contest payment token. `REFUND` and `WITHDRAW` require that transfer in the other direction. `SEND` requires a `Transfer` from the account in the platform payment token. `PRIMARY` and `SECONDARY` require `PrimaryPayoutClaimed` or `SecondaryPayoutClaimed` for this account, entry, and amount. |
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Sports (`/api/sports`)
|
|
94
|
+
|
|
95
|
+
Unsigned.
|
|
96
|
+
|
|
97
|
+
| Method | Path | Auth | Description |
|
|
98
|
+
|--------|------|------|-------------|
|
|
99
|
+
| GET | `/` | none | Enabled sports. |
|
|
100
|
+
| GET | `/:sportId/events/active` | none | Active event and status. `404` if none. |
|
|
101
|
+
| GET | `/:sportId/events/:eventId` | none | One event for that sport. `404` if it is not that sport's event. |
|
|
102
|
+
| GET | `/:sportId/events/:eventId/candidates` | none | Field pool: `{ candidates }`. |
|
|
103
|
+
|
|
104
|
+
Event responses are `{ sport, event, status }`. `event.metadata` is sport JSON (golf: name, dates, course, round status).
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Lineups (`/api/lineups`)
|
|
109
|
+
|
|
110
|
+
| Method | Path | Auth | Description |
|
|
111
|
+
|--------|------|------|-------------|
|
|
112
|
+
| GET | `/:eventId` | either | This account's lineups for the event. `{ lineups }`. |
|
|
113
|
+
| POST | `/:eventId` | either | Create a lineup. |
|
|
114
|
+
| POST | `/clone/:lineupId` | either | Copy a lineup into `contestId`. |
|
|
115
|
+
| PUT | `/:lineupId` | either | Update that lineup. |
|
|
116
|
+
|
|
117
|
+
**POST / PUT body:**
|
|
118
|
+
|
|
119
|
+
```json
|
|
120
|
+
{
|
|
121
|
+
"candidates": ["<eventParticipantId>"],
|
|
122
|
+
"name": "optional",
|
|
123
|
+
"contestId": "optional on create",
|
|
124
|
+
"prediction": { "type": "winningLineupTotal", "value": 142 }
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
- `candidates` is an ordered array of `eventParticipantId` values, at most 8.
|
|
129
|
+
- `POST` creates a new row. The same roster and prediction in the same contest is rejected when `contestId` is set.
|
|
130
|
+
- `PUT` updates candidates, name, and prediction.
|
|
131
|
+
- `prediction` is `{ "type": "winningLineupTotal", "value": <int> }` inside the sport's range. Omit it on create and the server stores a sport default.
|
|
132
|
+
- `name` is optional, max 80 characters.
|
|
133
|
+
- Create and update are rejected after the event is live or complete.
|
|
134
|
+
- Clone body is `{ "contestId", "name"? }`.
|
|
135
|
+
|
|
136
|
+
A lineup read includes `candidates` (id, slot, participant, `scoreData`, `total`) and `score`.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Contests (`/api/contests`)
|
|
141
|
+
|
|
142
|
+
| Method | Path | Auth | Description |
|
|
143
|
+
|--------|------|------|-------------|
|
|
144
|
+
| GET | `/directory` | none | Cross-event list. Query `scope`: `live`, `past`, or `all` (default). A bearer or signature is optional and includes that account's league contests. |
|
|
145
|
+
| GET | `/` | none | Contests for one event. A bearer or signature is optional. |
|
|
146
|
+
| GET | `/:id` | none | Lobby payload. `:id` is the contest id or the contract address. |
|
|
147
|
+
| GET | `/:id/lobby` | none | Same payload as `GET /:id`, with `Cache-Control: private, max-age=15`. |
|
|
148
|
+
| GET | `/:id/timeline` | none | Score timeline. Optional `?since=` ISO timestamp. |
|
|
149
|
+
| POST | `/` | either | Create a contest. Staff for a public contest, league admin for a league contest. |
|
|
150
|
+
| POST | `/:id/lineups` | either | Join with a lineup. `X-Cut-Chain-Id` when the contest has escrow. |
|
|
151
|
+
| DELETE | `/:id/lineups/:lineupId` | either | Leave. `:lineupId` is the contest-lineup id. |
|
|
152
|
+
| DELETE | `/:id` | either | Delete an open league contest. League admin. Paid contests that already have entries are rejected. |
|
|
153
|
+
| POST | `/:id/secondary-participants` | either | Index a winner-pool buy from a confirmed transaction. `X-Cut-Chain-Id` required. |
|
|
154
|
+
|
|
155
|
+
**GET `/` query:** `eventId` (required), optional `chainId`, optional `userGroupId` (member required).
|
|
156
|
+
|
|
157
|
+
League contests are `404` to non-members.
|
|
158
|
+
|
|
159
|
+
**POST `/`** is two creates. `settings.primaryDeposit` of `0` omits `address` and `transactionHash`. A paid contest requires both. The server loads the factory receipt once, requires a `ContestCreated` log for `address`, and requires that log's `host` to be the authenticated wallet (`403` otherwise). It overwrites `settings.operator` and `settings.paymentTokenAddress` from the clone. One row per chain and contract address; a second registration is `409`. `transactionId` is an alias of `transactionHash` on this route only. A paid contest the server must deploy is `createContest` on `POST /api/bot/actions`, not this route.
|
|
160
|
+
|
|
161
|
+
Other body fields: `eventId`, `name`, `endDate`, `chainId`, `settings`, optional `userGroupId`, `description`, `notifyLeagueMembers`. `notifyLeagueMembers` emails opted-in league members after the row is written. It is ignored without `userGroupId`.
|
|
162
|
+
|
|
163
|
+
**POST `/:id/lineups` body:** `lineupId`. An optional `entryId` is ignored. The server sets `entryId` from the contest address and lineup id. On-chain `entryOwner(entryId)` must be the authenticated wallet.
|
|
164
|
+
|
|
165
|
+
**POST `/:id/secondary-participants` body:** `entryId`, `transactionHash`, `chainId`, optional `amountWei`. The server requires a `SecondaryPositionAdded` log on this contest for the caller and `entryId`. Replays of the same `transactionHash` are idempotent.
|
|
166
|
+
|
|
167
|
+
A signed-in lobby may include `contestLineups[].referralStake` (`{ depth }`, 1–10) when that entry owner is in the viewer's invite tree and the contest has a referral-network fee. Unsigned payloads omit it. Open contests omit roster `candidates`.
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Leagues (`/api/userGroups`)
|
|
172
|
+
|
|
173
|
+
The product name is league. The path is `/api/userGroups`. Client pages are `/leagues`.
|
|
174
|
+
|
|
175
|
+
| Method | Path | Auth | Description |
|
|
176
|
+
|--------|------|------|-------------|
|
|
177
|
+
| GET | `/` | either | Leagues for the current account. |
|
|
178
|
+
| POST | `/` | either | Create a league. The creator is the league admin. |
|
|
179
|
+
| POST | `/join` | either | Join with an invite code. |
|
|
180
|
+
| GET | `/:id` | either | League detail and members. Member required. |
|
|
181
|
+
| PUT | `/:id` | either | Update name and description. League admin. |
|
|
182
|
+
| DELETE | `/:id` | either | Delete the league. League admin. |
|
|
183
|
+
| GET | `/:id/contests` | either | League contests across events. Member required. |
|
|
184
|
+
| GET | `/:id/members` | either | Member list. Member required. |
|
|
185
|
+
| DELETE | `/:id/members/:userId` | either | Remove a member. |
|
|
186
|
+
| POST | `/:id/invite` | either | Generate an invite code. League admin. |
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Admin (`/api/admin`)
|
|
191
|
+
|
|
192
|
+
`staff`. An agent signature is `403`.
|
|
193
|
+
|
|
194
|
+
| Method | Path | Auth | Description |
|
|
195
|
+
|--------|------|------|-------------|
|
|
196
|
+
| GET | `/dashboard` | staff | Ops dashboard. Query `eventId`. `tournamentId` is accepted as an alias on this route only. |
|
|
197
|
+
| POST | `/contests/lock-eligible` | staff | Batch lock contests. |
|
|
198
|
+
| POST | `/contests/:contestId/lock` | staff | Lock one active contest. |
|
|
199
|
+
| GET | `/users` | staff | User list and payment-token balances. Query `userType`: `USER` (default), `TEST`, `ADMIN`, `SUPER_ADMIN`, `PUBLIC`, `AGENT`. `X-Cut-Chain-Id` required. |
|
|
200
|
+
| GET | `/users/:id` | staff | User detail. |
|
|
201
|
+
| POST | `/test-email` | staff | Send a preview email. |
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Cron (`/api/cron`)
|
|
206
|
+
|
|
207
|
+
| Method | Path | Auth | Description |
|
|
208
|
+
|--------|------|------|-------------|
|
|
209
|
+
| GET | `/status` | staff | Scheduler enabled and active job names. |
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## Unsubscribe (`/api/unsubscribe`)
|
|
214
|
+
|
|
215
|
+
| Method | Path | Auth | Description |
|
|
216
|
+
|--------|------|------|-------------|
|
|
217
|
+
| GET | `/` | none | Marketing unsubscribe. The link carries its own signed token. |
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## Stream (`/api/stream`)
|
|
222
|
+
|
|
223
|
+
| Method | Path | Auth | Description |
|
|
224
|
+
|--------|------|------|-------------|
|
|
225
|
+
| GET | `/token` | either | Stream Feeds user token. `{ apiKey, token, userId, expiresInSeconds }`. `503` when Stream is disabled. |
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Bot (`/api/bot`)
|
|
230
|
+
|
|
231
|
+
| Method | Path | Auth | Description |
|
|
232
|
+
|--------|------|------|-------------|
|
|
233
|
+
| GET | `/delegate-address` | none | Public address of the server-held delegate, or `null` when that key is unset. |
|
|
234
|
+
| GET | `/contests` | signature | Contests this signer can enter, each with its field. |
|
|
235
|
+
| POST | `/actions` | signature | `lineupUpsert`, `join`, `leave`, or `createContest`. |
|
|
236
|
+
| GET | `/delegates` | either | Delegates for the account. |
|
|
237
|
+
| POST | `/delegates` | privy | Record an approved session key. |
|
|
238
|
+
| POST | `/delegates/revoke` | privy | Mark a delegate revoked. |
|
|
239
|
+
|
|
240
|
+
**GET `/contests` query:** `chainId` (`8453` or `84532`), `smartWallet`, optional `eventId`. Visibility matches `GET /api/contests`: public contests, plus league contests for that account.
|
|
241
|
+
|
|
242
|
+
**POST `/actions` lineup body:**
|
|
243
|
+
|
|
244
|
+
```json
|
|
245
|
+
{
|
|
246
|
+
"chainId": 8453,
|
|
247
|
+
"action": "lineupUpsert",
|
|
248
|
+
"smartWallet": "0x…",
|
|
249
|
+
"contestId": "contest id",
|
|
250
|
+
"lineupId": "",
|
|
251
|
+
"candidates": ["eventParticipantId"],
|
|
252
|
+
"prediction": { "type": "winningLineupTotal", "value": 142 }
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
`lineupId` `""` creates a lineup. A lineup id updates it. `join` and `leave` send the lineup id and omit `candidates`. `prediction` is optional on `lineupUpsert`.
|
|
257
|
+
|
|
258
|
+
A delegate signer must be an active `BotDelegate` whose permission is still installed on the wallet. The wallet signer can list contests and save a lineup with no delegate. Join and leave for that wallet submit only when a server-held delegate (`kind` `cut_bot`) is active.
|
|
259
|
+
|
|
260
|
+
A server-held delegate submits the user operation. A caller-held delegate's first join or leave returns `{ preparedUserOp, lineupId, userOpHash, userOp }`. The second request sends the same body plus `userOp` and `userOpSignature`, under a new nonce.
|
|
261
|
+
|
|
262
|
+
`createContest` deploys a paid contest. The body includes `name`, `eventId`, `endDate`, and `settings.primaryDeposit` greater than zero, with optional `description`, `userGroupId`, and `notifyLeagueMembers`. The caller must be a league admin or staff. An `AGENT` creating a public contest is rejected. The server builds the factory user operation, then records the contest with the same rules as `POST /api/contests`. A caller-held delegate uses the same `preparedUserOp` step. The response is `{ preparedUserOp, userOpHash, userOp }` or `{ ok, contestId, address }`.
|
|
263
|
+
|
|
264
|
+
**POST `/delegates` body:** `kind` (`cut_bot` or `external`), `delegateAddress`, `smartWallet`, `approval`, `permissionId` (4-byte hex). `smartWallet` must be the signed-in account's wallet.
|
package/dist/contract.d.ts
CHANGED
|
@@ -16,46 +16,13 @@ export declare const contestSettingsSchema: z.ZodOptional<z.ZodObject<{
|
|
|
16
16
|
targetPrimaryShareBps: z.ZodOptional<z.ZodNumber>;
|
|
17
17
|
maxCrossSubsidyBps: z.ZodOptional<z.ZodNumber>;
|
|
18
18
|
maxPlayers: z.ZodOptional<z.ZodNumber>;
|
|
19
|
-
scoringType: z.ZodOptional<z.ZodEnum<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
paymentTokenSymbol?: string | undefined;
|
|
25
|
-
operator?: string | undefined;
|
|
26
|
-
expiryTimestamp?: number | undefined;
|
|
27
|
-
primaryDeposit?: number | undefined;
|
|
28
|
-
referralNetworkBps?: number | undefined;
|
|
29
|
-
oracleFeeBps?: number | undefined;
|
|
30
|
-
referralGroupId?: string | undefined;
|
|
31
|
-
primaryDepositSecondarySubsidyBps?: number | undefined;
|
|
32
|
-
primaryEntryInvestmentShareBps?: number | undefined;
|
|
33
|
-
positionBonusShareBps?: number | undefined;
|
|
34
|
-
targetPrimaryShareBps?: number | undefined;
|
|
35
|
-
maxCrossSubsidyBps?: number | undefined;
|
|
36
|
-
maxPlayers?: number | undefined;
|
|
37
|
-
scoringType?: "STABLEFORD" | "STROKE_PLAY" | undefined;
|
|
38
|
-
}, {
|
|
39
|
-
contestType?: string | undefined;
|
|
40
|
-
chainId?: number | undefined;
|
|
41
|
-
paymentTokenAddress?: string | undefined;
|
|
42
|
-
paymentTokenSymbol?: string | undefined;
|
|
43
|
-
operator?: string | undefined;
|
|
44
|
-
expiryTimestamp?: number | undefined;
|
|
45
|
-
primaryDeposit?: number | undefined;
|
|
46
|
-
referralNetworkBps?: number | undefined;
|
|
47
|
-
oracleFeeBps?: number | undefined;
|
|
48
|
-
referralGroupId?: string | undefined;
|
|
49
|
-
primaryDepositSecondarySubsidyBps?: number | undefined;
|
|
50
|
-
primaryEntryInvestmentShareBps?: number | undefined;
|
|
51
|
-
positionBonusShareBps?: number | undefined;
|
|
52
|
-
targetPrimaryShareBps?: number | undefined;
|
|
53
|
-
maxCrossSubsidyBps?: number | undefined;
|
|
54
|
-
maxPlayers?: number | undefined;
|
|
55
|
-
scoringType?: "STABLEFORD" | "STROKE_PLAY" | undefined;
|
|
56
|
-
}>>;
|
|
19
|
+
scoringType: z.ZodOptional<z.ZodEnum<{
|
|
20
|
+
STABLEFORD: "STABLEFORD";
|
|
21
|
+
STROKE_PLAY: "STROKE_PLAY";
|
|
22
|
+
}>>;
|
|
23
|
+
}, z.core.$strip>>;
|
|
57
24
|
export declare const userOpSchema: z.ZodObject<{
|
|
58
|
-
sender: z.
|
|
25
|
+
sender: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
|
|
59
26
|
nonce: z.ZodString;
|
|
60
27
|
callData: z.ZodString;
|
|
61
28
|
callGasLimit: z.ZodString;
|
|
@@ -69,48 +36,22 @@ export declare const userOpSchema: z.ZodObject<{
|
|
|
69
36
|
paymasterPostOpGasLimit: z.ZodOptional<z.ZodString>;
|
|
70
37
|
factory: z.ZodOptional<z.ZodString>;
|
|
71
38
|
factoryData: z.ZodOptional<z.ZodString>;
|
|
72
|
-
},
|
|
73
|
-
sender: `0x${string}`;
|
|
74
|
-
nonce: string;
|
|
75
|
-
callData: string;
|
|
76
|
-
callGasLimit: string;
|
|
77
|
-
verificationGasLimit: string;
|
|
78
|
-
preVerificationGas: string;
|
|
79
|
-
maxFeePerGas: string;
|
|
80
|
-
maxPriorityFeePerGas: string;
|
|
81
|
-
paymaster?: string | undefined;
|
|
82
|
-
paymasterData?: string | undefined;
|
|
83
|
-
paymasterVerificationGasLimit?: string | undefined;
|
|
84
|
-
paymasterPostOpGasLimit?: string | undefined;
|
|
85
|
-
factory?: string | undefined;
|
|
86
|
-
factoryData?: string | undefined;
|
|
87
|
-
}, {
|
|
88
|
-
sender: string;
|
|
89
|
-
nonce: string;
|
|
90
|
-
callData: string;
|
|
91
|
-
callGasLimit: string;
|
|
92
|
-
verificationGasLimit: string;
|
|
93
|
-
preVerificationGas: string;
|
|
94
|
-
maxFeePerGas: string;
|
|
95
|
-
maxPriorityFeePerGas: string;
|
|
96
|
-
paymaster?: string | undefined;
|
|
97
|
-
paymasterData?: string | undefined;
|
|
98
|
-
paymasterVerificationGasLimit?: string | undefined;
|
|
99
|
-
paymasterPostOpGasLimit?: string | undefined;
|
|
100
|
-
factory?: string | undefined;
|
|
101
|
-
factoryData?: string | undefined;
|
|
102
|
-
}>;
|
|
39
|
+
}, z.core.$strip>;
|
|
103
40
|
export declare const playActionSchema: z.ZodObject<{
|
|
104
41
|
chainId: z.ZodNumber;
|
|
105
|
-
action: z.ZodEnum<
|
|
42
|
+
action: z.ZodEnum<{
|
|
43
|
+
lineupUpsert: "lineupUpsert";
|
|
44
|
+
join: "join";
|
|
45
|
+
leave: "leave";
|
|
46
|
+
}>;
|
|
106
47
|
smartWallet: z.ZodString;
|
|
107
48
|
contestId: z.ZodString;
|
|
108
49
|
lineupId: z.ZodDefault<z.ZodString>;
|
|
109
|
-
candidates: z.ZodOptional<z.ZodArray<z.ZodString
|
|
50
|
+
candidates: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
110
51
|
prediction: z.ZodOptional<z.ZodUnknown>;
|
|
111
52
|
userOpSignature: z.ZodOptional<z.ZodString>;
|
|
112
53
|
userOp: z.ZodOptional<z.ZodObject<{
|
|
113
|
-
sender: z.
|
|
54
|
+
sender: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
|
|
114
55
|
nonce: z.ZodString;
|
|
115
56
|
callData: z.ZodString;
|
|
116
57
|
callGasLimit: z.ZodString;
|
|
@@ -124,88 +65,8 @@ export declare const playActionSchema: z.ZodObject<{
|
|
|
124
65
|
paymasterPostOpGasLimit: z.ZodOptional<z.ZodString>;
|
|
125
66
|
factory: z.ZodOptional<z.ZodString>;
|
|
126
67
|
factoryData: z.ZodOptional<z.ZodString>;
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
nonce: string;
|
|
130
|
-
callData: string;
|
|
131
|
-
callGasLimit: string;
|
|
132
|
-
verificationGasLimit: string;
|
|
133
|
-
preVerificationGas: string;
|
|
134
|
-
maxFeePerGas: string;
|
|
135
|
-
maxPriorityFeePerGas: string;
|
|
136
|
-
paymaster?: string | undefined;
|
|
137
|
-
paymasterData?: string | undefined;
|
|
138
|
-
paymasterVerificationGasLimit?: string | undefined;
|
|
139
|
-
paymasterPostOpGasLimit?: string | undefined;
|
|
140
|
-
factory?: string | undefined;
|
|
141
|
-
factoryData?: string | undefined;
|
|
142
|
-
}, {
|
|
143
|
-
sender: string;
|
|
144
|
-
nonce: string;
|
|
145
|
-
callData: string;
|
|
146
|
-
callGasLimit: string;
|
|
147
|
-
verificationGasLimit: string;
|
|
148
|
-
preVerificationGas: string;
|
|
149
|
-
maxFeePerGas: string;
|
|
150
|
-
maxPriorityFeePerGas: string;
|
|
151
|
-
paymaster?: string | undefined;
|
|
152
|
-
paymasterData?: string | undefined;
|
|
153
|
-
paymasterVerificationGasLimit?: string | undefined;
|
|
154
|
-
paymasterPostOpGasLimit?: string | undefined;
|
|
155
|
-
factory?: string | undefined;
|
|
156
|
-
factoryData?: string | undefined;
|
|
157
|
-
}>>;
|
|
158
|
-
}, "strip", z.ZodTypeAny, {
|
|
159
|
-
chainId: number;
|
|
160
|
-
action: "join" | "lineupUpsert" | "leave";
|
|
161
|
-
smartWallet: string;
|
|
162
|
-
contestId: string;
|
|
163
|
-
lineupId: string;
|
|
164
|
-
candidates?: string[] | undefined;
|
|
165
|
-
prediction?: unknown;
|
|
166
|
-
userOpSignature?: string | undefined;
|
|
167
|
-
userOp?: {
|
|
168
|
-
sender: `0x${string}`;
|
|
169
|
-
nonce: string;
|
|
170
|
-
callData: string;
|
|
171
|
-
callGasLimit: string;
|
|
172
|
-
verificationGasLimit: string;
|
|
173
|
-
preVerificationGas: string;
|
|
174
|
-
maxFeePerGas: string;
|
|
175
|
-
maxPriorityFeePerGas: string;
|
|
176
|
-
paymaster?: string | undefined;
|
|
177
|
-
paymasterData?: string | undefined;
|
|
178
|
-
paymasterVerificationGasLimit?: string | undefined;
|
|
179
|
-
paymasterPostOpGasLimit?: string | undefined;
|
|
180
|
-
factory?: string | undefined;
|
|
181
|
-
factoryData?: string | undefined;
|
|
182
|
-
} | undefined;
|
|
183
|
-
}, {
|
|
184
|
-
chainId: number;
|
|
185
|
-
action: "join" | "lineupUpsert" | "leave";
|
|
186
|
-
smartWallet: string;
|
|
187
|
-
contestId: string;
|
|
188
|
-
lineupId?: string | undefined;
|
|
189
|
-
candidates?: string[] | undefined;
|
|
190
|
-
prediction?: unknown;
|
|
191
|
-
userOpSignature?: string | undefined;
|
|
192
|
-
userOp?: {
|
|
193
|
-
sender: string;
|
|
194
|
-
nonce: string;
|
|
195
|
-
callData: string;
|
|
196
|
-
callGasLimit: string;
|
|
197
|
-
verificationGasLimit: string;
|
|
198
|
-
preVerificationGas: string;
|
|
199
|
-
maxFeePerGas: string;
|
|
200
|
-
maxPriorityFeePerGas: string;
|
|
201
|
-
paymaster?: string | undefined;
|
|
202
|
-
paymasterData?: string | undefined;
|
|
203
|
-
paymasterVerificationGasLimit?: string | undefined;
|
|
204
|
-
paymasterPostOpGasLimit?: string | undefined;
|
|
205
|
-
factory?: string | undefined;
|
|
206
|
-
factoryData?: string | undefined;
|
|
207
|
-
} | undefined;
|
|
208
|
-
}>;
|
|
68
|
+
}, z.core.$strip>>;
|
|
69
|
+
}, z.core.$strip>;
|
|
209
70
|
export declare const createContestActionSchema: z.ZodObject<{
|
|
210
71
|
chainId: z.ZodNumber;
|
|
211
72
|
action: z.ZodLiteral<"createContest">;
|
|
@@ -214,7 +75,7 @@ export declare const createContestActionSchema: z.ZodObject<{
|
|
|
214
75
|
description: z.ZodOptional<z.ZodString>;
|
|
215
76
|
eventId: z.ZodString;
|
|
216
77
|
userGroupId: z.ZodOptional<z.ZodString>;
|
|
217
|
-
endDate: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
78
|
+
endDate: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
218
79
|
settings: z.ZodOptional<z.ZodObject<{
|
|
219
80
|
contestType: z.ZodOptional<z.ZodString>;
|
|
220
81
|
chainId: z.ZodOptional<z.ZodNumber>;
|
|
@@ -232,48 +93,15 @@ export declare const createContestActionSchema: z.ZodObject<{
|
|
|
232
93
|
targetPrimaryShareBps: z.ZodOptional<z.ZodNumber>;
|
|
233
94
|
maxCrossSubsidyBps: z.ZodOptional<z.ZodNumber>;
|
|
234
95
|
maxPlayers: z.ZodOptional<z.ZodNumber>;
|
|
235
|
-
scoringType: z.ZodOptional<z.ZodEnum<
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
paymentTokenSymbol?: string | undefined;
|
|
241
|
-
operator?: string | undefined;
|
|
242
|
-
expiryTimestamp?: number | undefined;
|
|
243
|
-
primaryDeposit?: number | undefined;
|
|
244
|
-
referralNetworkBps?: number | undefined;
|
|
245
|
-
oracleFeeBps?: number | undefined;
|
|
246
|
-
referralGroupId?: string | undefined;
|
|
247
|
-
primaryDepositSecondarySubsidyBps?: number | undefined;
|
|
248
|
-
primaryEntryInvestmentShareBps?: number | undefined;
|
|
249
|
-
positionBonusShareBps?: number | undefined;
|
|
250
|
-
targetPrimaryShareBps?: number | undefined;
|
|
251
|
-
maxCrossSubsidyBps?: number | undefined;
|
|
252
|
-
maxPlayers?: number | undefined;
|
|
253
|
-
scoringType?: "STABLEFORD" | "STROKE_PLAY" | undefined;
|
|
254
|
-
}, {
|
|
255
|
-
contestType?: string | undefined;
|
|
256
|
-
chainId?: number | undefined;
|
|
257
|
-
paymentTokenAddress?: string | undefined;
|
|
258
|
-
paymentTokenSymbol?: string | undefined;
|
|
259
|
-
operator?: string | undefined;
|
|
260
|
-
expiryTimestamp?: number | undefined;
|
|
261
|
-
primaryDeposit?: number | undefined;
|
|
262
|
-
referralNetworkBps?: number | undefined;
|
|
263
|
-
oracleFeeBps?: number | undefined;
|
|
264
|
-
referralGroupId?: string | undefined;
|
|
265
|
-
primaryDepositSecondarySubsidyBps?: number | undefined;
|
|
266
|
-
primaryEntryInvestmentShareBps?: number | undefined;
|
|
267
|
-
positionBonusShareBps?: number | undefined;
|
|
268
|
-
targetPrimaryShareBps?: number | undefined;
|
|
269
|
-
maxCrossSubsidyBps?: number | undefined;
|
|
270
|
-
maxPlayers?: number | undefined;
|
|
271
|
-
scoringType?: "STABLEFORD" | "STROKE_PLAY" | undefined;
|
|
272
|
-
}>>;
|
|
96
|
+
scoringType: z.ZodOptional<z.ZodEnum<{
|
|
97
|
+
STABLEFORD: "STABLEFORD";
|
|
98
|
+
STROKE_PLAY: "STROKE_PLAY";
|
|
99
|
+
}>>;
|
|
100
|
+
}, z.core.$strip>>;
|
|
273
101
|
notifyLeagueMembers: z.ZodOptional<z.ZodBoolean>;
|
|
274
102
|
userOpSignature: z.ZodOptional<z.ZodString>;
|
|
275
103
|
userOp: z.ZodOptional<z.ZodObject<{
|
|
276
|
-
sender: z.
|
|
104
|
+
sender: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
|
|
277
105
|
nonce: z.ZodString;
|
|
278
106
|
callData: z.ZodString;
|
|
279
107
|
callGasLimit: z.ZodString;
|
|
@@ -287,141 +115,23 @@ export declare const createContestActionSchema: z.ZodObject<{
|
|
|
287
115
|
paymasterPostOpGasLimit: z.ZodOptional<z.ZodString>;
|
|
288
116
|
factory: z.ZodOptional<z.ZodString>;
|
|
289
117
|
factoryData: z.ZodOptional<z.ZodString>;
|
|
290
|
-
},
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
callData: string;
|
|
294
|
-
callGasLimit: string;
|
|
295
|
-
verificationGasLimit: string;
|
|
296
|
-
preVerificationGas: string;
|
|
297
|
-
maxFeePerGas: string;
|
|
298
|
-
maxPriorityFeePerGas: string;
|
|
299
|
-
paymaster?: string | undefined;
|
|
300
|
-
paymasterData?: string | undefined;
|
|
301
|
-
paymasterVerificationGasLimit?: string | undefined;
|
|
302
|
-
paymasterPostOpGasLimit?: string | undefined;
|
|
303
|
-
factory?: string | undefined;
|
|
304
|
-
factoryData?: string | undefined;
|
|
305
|
-
}, {
|
|
306
|
-
sender: string;
|
|
307
|
-
nonce: string;
|
|
308
|
-
callData: string;
|
|
309
|
-
callGasLimit: string;
|
|
310
|
-
verificationGasLimit: string;
|
|
311
|
-
preVerificationGas: string;
|
|
312
|
-
maxFeePerGas: string;
|
|
313
|
-
maxPriorityFeePerGas: string;
|
|
314
|
-
paymaster?: string | undefined;
|
|
315
|
-
paymasterData?: string | undefined;
|
|
316
|
-
paymasterVerificationGasLimit?: string | undefined;
|
|
317
|
-
paymasterPostOpGasLimit?: string | undefined;
|
|
318
|
-
factory?: string | undefined;
|
|
319
|
-
factoryData?: string | undefined;
|
|
320
|
-
}>>;
|
|
321
|
-
}, "strip", z.ZodTypeAny, {
|
|
322
|
-
chainId: number;
|
|
323
|
-
action: "createContest";
|
|
324
|
-
smartWallet: string;
|
|
325
|
-
name: string;
|
|
326
|
-
eventId: string;
|
|
327
|
-
endDate: string | number;
|
|
328
|
-
userOpSignature?: string | undefined;
|
|
329
|
-
userOp?: {
|
|
330
|
-
sender: `0x${string}`;
|
|
331
|
-
nonce: string;
|
|
332
|
-
callData: string;
|
|
333
|
-
callGasLimit: string;
|
|
334
|
-
verificationGasLimit: string;
|
|
335
|
-
preVerificationGas: string;
|
|
336
|
-
maxFeePerGas: string;
|
|
337
|
-
maxPriorityFeePerGas: string;
|
|
338
|
-
paymaster?: string | undefined;
|
|
339
|
-
paymasterData?: string | undefined;
|
|
340
|
-
paymasterVerificationGasLimit?: string | undefined;
|
|
341
|
-
paymasterPostOpGasLimit?: string | undefined;
|
|
342
|
-
factory?: string | undefined;
|
|
343
|
-
factoryData?: string | undefined;
|
|
344
|
-
} | undefined;
|
|
345
|
-
description?: string | undefined;
|
|
346
|
-
userGroupId?: string | undefined;
|
|
347
|
-
settings?: {
|
|
348
|
-
contestType?: string | undefined;
|
|
349
|
-
chainId?: number | undefined;
|
|
350
|
-
paymentTokenAddress?: string | undefined;
|
|
351
|
-
paymentTokenSymbol?: string | undefined;
|
|
352
|
-
operator?: string | undefined;
|
|
353
|
-
expiryTimestamp?: number | undefined;
|
|
354
|
-
primaryDeposit?: number | undefined;
|
|
355
|
-
referralNetworkBps?: number | undefined;
|
|
356
|
-
oracleFeeBps?: number | undefined;
|
|
357
|
-
referralGroupId?: string | undefined;
|
|
358
|
-
primaryDepositSecondarySubsidyBps?: number | undefined;
|
|
359
|
-
primaryEntryInvestmentShareBps?: number | undefined;
|
|
360
|
-
positionBonusShareBps?: number | undefined;
|
|
361
|
-
targetPrimaryShareBps?: number | undefined;
|
|
362
|
-
maxCrossSubsidyBps?: number | undefined;
|
|
363
|
-
maxPlayers?: number | undefined;
|
|
364
|
-
scoringType?: "STABLEFORD" | "STROKE_PLAY" | undefined;
|
|
365
|
-
} | undefined;
|
|
366
|
-
notifyLeagueMembers?: boolean | undefined;
|
|
367
|
-
}, {
|
|
368
|
-
chainId: number;
|
|
369
|
-
action: "createContest";
|
|
370
|
-
smartWallet: string;
|
|
371
|
-
name: string;
|
|
372
|
-
eventId: string;
|
|
373
|
-
endDate: string | number;
|
|
374
|
-
userOpSignature?: string | undefined;
|
|
375
|
-
userOp?: {
|
|
376
|
-
sender: string;
|
|
377
|
-
nonce: string;
|
|
378
|
-
callData: string;
|
|
379
|
-
callGasLimit: string;
|
|
380
|
-
verificationGasLimit: string;
|
|
381
|
-
preVerificationGas: string;
|
|
382
|
-
maxFeePerGas: string;
|
|
383
|
-
maxPriorityFeePerGas: string;
|
|
384
|
-
paymaster?: string | undefined;
|
|
385
|
-
paymasterData?: string | undefined;
|
|
386
|
-
paymasterVerificationGasLimit?: string | undefined;
|
|
387
|
-
paymasterPostOpGasLimit?: string | undefined;
|
|
388
|
-
factory?: string | undefined;
|
|
389
|
-
factoryData?: string | undefined;
|
|
390
|
-
} | undefined;
|
|
391
|
-
description?: string | undefined;
|
|
392
|
-
userGroupId?: string | undefined;
|
|
393
|
-
settings?: {
|
|
394
|
-
contestType?: string | undefined;
|
|
395
|
-
chainId?: number | undefined;
|
|
396
|
-
paymentTokenAddress?: string | undefined;
|
|
397
|
-
paymentTokenSymbol?: string | undefined;
|
|
398
|
-
operator?: string | undefined;
|
|
399
|
-
expiryTimestamp?: number | undefined;
|
|
400
|
-
primaryDeposit?: number | undefined;
|
|
401
|
-
referralNetworkBps?: number | undefined;
|
|
402
|
-
oracleFeeBps?: number | undefined;
|
|
403
|
-
referralGroupId?: string | undefined;
|
|
404
|
-
primaryDepositSecondarySubsidyBps?: number | undefined;
|
|
405
|
-
primaryEntryInvestmentShareBps?: number | undefined;
|
|
406
|
-
positionBonusShareBps?: number | undefined;
|
|
407
|
-
targetPrimaryShareBps?: number | undefined;
|
|
408
|
-
maxCrossSubsidyBps?: number | undefined;
|
|
409
|
-
maxPlayers?: number | undefined;
|
|
410
|
-
scoringType?: "STABLEFORD" | "STROKE_PLAY" | undefined;
|
|
411
|
-
} | undefined;
|
|
412
|
-
notifyLeagueMembers?: boolean | undefined;
|
|
413
|
-
}>;
|
|
414
|
-
export declare const actionSchema: z.ZodDiscriminatedUnion<"action", [z.ZodObject<{
|
|
118
|
+
}, z.core.$strip>>;
|
|
119
|
+
}, z.core.$strip>;
|
|
120
|
+
export declare const actionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
415
121
|
chainId: z.ZodNumber;
|
|
416
|
-
action: z.ZodEnum<
|
|
122
|
+
action: z.ZodEnum<{
|
|
123
|
+
lineupUpsert: "lineupUpsert";
|
|
124
|
+
join: "join";
|
|
125
|
+
leave: "leave";
|
|
126
|
+
}>;
|
|
417
127
|
smartWallet: z.ZodString;
|
|
418
128
|
contestId: z.ZodString;
|
|
419
129
|
lineupId: z.ZodDefault<z.ZodString>;
|
|
420
|
-
candidates: z.ZodOptional<z.ZodArray<z.ZodString
|
|
130
|
+
candidates: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
421
131
|
prediction: z.ZodOptional<z.ZodUnknown>;
|
|
422
132
|
userOpSignature: z.ZodOptional<z.ZodString>;
|
|
423
133
|
userOp: z.ZodOptional<z.ZodObject<{
|
|
424
|
-
sender: z.
|
|
134
|
+
sender: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
|
|
425
135
|
nonce: z.ZodString;
|
|
426
136
|
callData: z.ZodString;
|
|
427
137
|
callGasLimit: z.ZodString;
|
|
@@ -435,88 +145,8 @@ export declare const actionSchema: z.ZodDiscriminatedUnion<"action", [z.ZodObjec
|
|
|
435
145
|
paymasterPostOpGasLimit: z.ZodOptional<z.ZodString>;
|
|
436
146
|
factory: z.ZodOptional<z.ZodString>;
|
|
437
147
|
factoryData: z.ZodOptional<z.ZodString>;
|
|
438
|
-
},
|
|
439
|
-
|
|
440
|
-
nonce: string;
|
|
441
|
-
callData: string;
|
|
442
|
-
callGasLimit: string;
|
|
443
|
-
verificationGasLimit: string;
|
|
444
|
-
preVerificationGas: string;
|
|
445
|
-
maxFeePerGas: string;
|
|
446
|
-
maxPriorityFeePerGas: string;
|
|
447
|
-
paymaster?: string | undefined;
|
|
448
|
-
paymasterData?: string | undefined;
|
|
449
|
-
paymasterVerificationGasLimit?: string | undefined;
|
|
450
|
-
paymasterPostOpGasLimit?: string | undefined;
|
|
451
|
-
factory?: string | undefined;
|
|
452
|
-
factoryData?: string | undefined;
|
|
453
|
-
}, {
|
|
454
|
-
sender: string;
|
|
455
|
-
nonce: string;
|
|
456
|
-
callData: string;
|
|
457
|
-
callGasLimit: string;
|
|
458
|
-
verificationGasLimit: string;
|
|
459
|
-
preVerificationGas: string;
|
|
460
|
-
maxFeePerGas: string;
|
|
461
|
-
maxPriorityFeePerGas: string;
|
|
462
|
-
paymaster?: string | undefined;
|
|
463
|
-
paymasterData?: string | undefined;
|
|
464
|
-
paymasterVerificationGasLimit?: string | undefined;
|
|
465
|
-
paymasterPostOpGasLimit?: string | undefined;
|
|
466
|
-
factory?: string | undefined;
|
|
467
|
-
factoryData?: string | undefined;
|
|
468
|
-
}>>;
|
|
469
|
-
}, "strip", z.ZodTypeAny, {
|
|
470
|
-
chainId: number;
|
|
471
|
-
action: "join" | "lineupUpsert" | "leave";
|
|
472
|
-
smartWallet: string;
|
|
473
|
-
contestId: string;
|
|
474
|
-
lineupId: string;
|
|
475
|
-
candidates?: string[] | undefined;
|
|
476
|
-
prediction?: unknown;
|
|
477
|
-
userOpSignature?: string | undefined;
|
|
478
|
-
userOp?: {
|
|
479
|
-
sender: `0x${string}`;
|
|
480
|
-
nonce: string;
|
|
481
|
-
callData: string;
|
|
482
|
-
callGasLimit: string;
|
|
483
|
-
verificationGasLimit: string;
|
|
484
|
-
preVerificationGas: string;
|
|
485
|
-
maxFeePerGas: string;
|
|
486
|
-
maxPriorityFeePerGas: string;
|
|
487
|
-
paymaster?: string | undefined;
|
|
488
|
-
paymasterData?: string | undefined;
|
|
489
|
-
paymasterVerificationGasLimit?: string | undefined;
|
|
490
|
-
paymasterPostOpGasLimit?: string | undefined;
|
|
491
|
-
factory?: string | undefined;
|
|
492
|
-
factoryData?: string | undefined;
|
|
493
|
-
} | undefined;
|
|
494
|
-
}, {
|
|
495
|
-
chainId: number;
|
|
496
|
-
action: "join" | "lineupUpsert" | "leave";
|
|
497
|
-
smartWallet: string;
|
|
498
|
-
contestId: string;
|
|
499
|
-
lineupId?: string | undefined;
|
|
500
|
-
candidates?: string[] | undefined;
|
|
501
|
-
prediction?: unknown;
|
|
502
|
-
userOpSignature?: string | undefined;
|
|
503
|
-
userOp?: {
|
|
504
|
-
sender: string;
|
|
505
|
-
nonce: string;
|
|
506
|
-
callData: string;
|
|
507
|
-
callGasLimit: string;
|
|
508
|
-
verificationGasLimit: string;
|
|
509
|
-
preVerificationGas: string;
|
|
510
|
-
maxFeePerGas: string;
|
|
511
|
-
maxPriorityFeePerGas: string;
|
|
512
|
-
paymaster?: string | undefined;
|
|
513
|
-
paymasterData?: string | undefined;
|
|
514
|
-
paymasterVerificationGasLimit?: string | undefined;
|
|
515
|
-
paymasterPostOpGasLimit?: string | undefined;
|
|
516
|
-
factory?: string | undefined;
|
|
517
|
-
factoryData?: string | undefined;
|
|
518
|
-
} | undefined;
|
|
519
|
-
}>, z.ZodObject<{
|
|
148
|
+
}, z.core.$strip>>;
|
|
149
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
520
150
|
chainId: z.ZodNumber;
|
|
521
151
|
action: z.ZodLiteral<"createContest">;
|
|
522
152
|
smartWallet: z.ZodString;
|
|
@@ -524,7 +154,7 @@ export declare const actionSchema: z.ZodDiscriminatedUnion<"action", [z.ZodObjec
|
|
|
524
154
|
description: z.ZodOptional<z.ZodString>;
|
|
525
155
|
eventId: z.ZodString;
|
|
526
156
|
userGroupId: z.ZodOptional<z.ZodString>;
|
|
527
|
-
endDate: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
157
|
+
endDate: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
528
158
|
settings: z.ZodOptional<z.ZodObject<{
|
|
529
159
|
contestType: z.ZodOptional<z.ZodString>;
|
|
530
160
|
chainId: z.ZodOptional<z.ZodNumber>;
|
|
@@ -542,48 +172,15 @@ export declare const actionSchema: z.ZodDiscriminatedUnion<"action", [z.ZodObjec
|
|
|
542
172
|
targetPrimaryShareBps: z.ZodOptional<z.ZodNumber>;
|
|
543
173
|
maxCrossSubsidyBps: z.ZodOptional<z.ZodNumber>;
|
|
544
174
|
maxPlayers: z.ZodOptional<z.ZodNumber>;
|
|
545
|
-
scoringType: z.ZodOptional<z.ZodEnum<
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
paymentTokenSymbol?: string | undefined;
|
|
551
|
-
operator?: string | undefined;
|
|
552
|
-
expiryTimestamp?: number | undefined;
|
|
553
|
-
primaryDeposit?: number | undefined;
|
|
554
|
-
referralNetworkBps?: number | undefined;
|
|
555
|
-
oracleFeeBps?: number | undefined;
|
|
556
|
-
referralGroupId?: string | undefined;
|
|
557
|
-
primaryDepositSecondarySubsidyBps?: number | undefined;
|
|
558
|
-
primaryEntryInvestmentShareBps?: number | undefined;
|
|
559
|
-
positionBonusShareBps?: number | undefined;
|
|
560
|
-
targetPrimaryShareBps?: number | undefined;
|
|
561
|
-
maxCrossSubsidyBps?: number | undefined;
|
|
562
|
-
maxPlayers?: number | undefined;
|
|
563
|
-
scoringType?: "STABLEFORD" | "STROKE_PLAY" | undefined;
|
|
564
|
-
}, {
|
|
565
|
-
contestType?: string | undefined;
|
|
566
|
-
chainId?: number | undefined;
|
|
567
|
-
paymentTokenAddress?: string | undefined;
|
|
568
|
-
paymentTokenSymbol?: string | undefined;
|
|
569
|
-
operator?: string | undefined;
|
|
570
|
-
expiryTimestamp?: number | undefined;
|
|
571
|
-
primaryDeposit?: number | undefined;
|
|
572
|
-
referralNetworkBps?: number | undefined;
|
|
573
|
-
oracleFeeBps?: number | undefined;
|
|
574
|
-
referralGroupId?: string | undefined;
|
|
575
|
-
primaryDepositSecondarySubsidyBps?: number | undefined;
|
|
576
|
-
primaryEntryInvestmentShareBps?: number | undefined;
|
|
577
|
-
positionBonusShareBps?: number | undefined;
|
|
578
|
-
targetPrimaryShareBps?: number | undefined;
|
|
579
|
-
maxCrossSubsidyBps?: number | undefined;
|
|
580
|
-
maxPlayers?: number | undefined;
|
|
581
|
-
scoringType?: "STABLEFORD" | "STROKE_PLAY" | undefined;
|
|
582
|
-
}>>;
|
|
175
|
+
scoringType: z.ZodOptional<z.ZodEnum<{
|
|
176
|
+
STABLEFORD: "STABLEFORD";
|
|
177
|
+
STROKE_PLAY: "STROKE_PLAY";
|
|
178
|
+
}>>;
|
|
179
|
+
}, z.core.$strip>>;
|
|
583
180
|
notifyLeagueMembers: z.ZodOptional<z.ZodBoolean>;
|
|
584
181
|
userOpSignature: z.ZodOptional<z.ZodString>;
|
|
585
182
|
userOp: z.ZodOptional<z.ZodObject<{
|
|
586
|
-
sender: z.
|
|
183
|
+
sender: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
|
|
587
184
|
nonce: z.ZodString;
|
|
588
185
|
callData: z.ZodString;
|
|
589
186
|
callGasLimit: z.ZodString;
|
|
@@ -597,143 +194,13 @@ export declare const actionSchema: z.ZodDiscriminatedUnion<"action", [z.ZodObjec
|
|
|
597
194
|
paymasterPostOpGasLimit: z.ZodOptional<z.ZodString>;
|
|
598
195
|
factory: z.ZodOptional<z.ZodString>;
|
|
599
196
|
factoryData: z.ZodOptional<z.ZodString>;
|
|
600
|
-
},
|
|
601
|
-
|
|
602
|
-
nonce: string;
|
|
603
|
-
callData: string;
|
|
604
|
-
callGasLimit: string;
|
|
605
|
-
verificationGasLimit: string;
|
|
606
|
-
preVerificationGas: string;
|
|
607
|
-
maxFeePerGas: string;
|
|
608
|
-
maxPriorityFeePerGas: string;
|
|
609
|
-
paymaster?: string | undefined;
|
|
610
|
-
paymasterData?: string | undefined;
|
|
611
|
-
paymasterVerificationGasLimit?: string | undefined;
|
|
612
|
-
paymasterPostOpGasLimit?: string | undefined;
|
|
613
|
-
factory?: string | undefined;
|
|
614
|
-
factoryData?: string | undefined;
|
|
615
|
-
}, {
|
|
616
|
-
sender: string;
|
|
617
|
-
nonce: string;
|
|
618
|
-
callData: string;
|
|
619
|
-
callGasLimit: string;
|
|
620
|
-
verificationGasLimit: string;
|
|
621
|
-
preVerificationGas: string;
|
|
622
|
-
maxFeePerGas: string;
|
|
623
|
-
maxPriorityFeePerGas: string;
|
|
624
|
-
paymaster?: string | undefined;
|
|
625
|
-
paymasterData?: string | undefined;
|
|
626
|
-
paymasterVerificationGasLimit?: string | undefined;
|
|
627
|
-
paymasterPostOpGasLimit?: string | undefined;
|
|
628
|
-
factory?: string | undefined;
|
|
629
|
-
factoryData?: string | undefined;
|
|
630
|
-
}>>;
|
|
631
|
-
}, "strip", z.ZodTypeAny, {
|
|
632
|
-
chainId: number;
|
|
633
|
-
action: "createContest";
|
|
634
|
-
smartWallet: string;
|
|
635
|
-
name: string;
|
|
636
|
-
eventId: string;
|
|
637
|
-
endDate: string | number;
|
|
638
|
-
userOpSignature?: string | undefined;
|
|
639
|
-
userOp?: {
|
|
640
|
-
sender: `0x${string}`;
|
|
641
|
-
nonce: string;
|
|
642
|
-
callData: string;
|
|
643
|
-
callGasLimit: string;
|
|
644
|
-
verificationGasLimit: string;
|
|
645
|
-
preVerificationGas: string;
|
|
646
|
-
maxFeePerGas: string;
|
|
647
|
-
maxPriorityFeePerGas: string;
|
|
648
|
-
paymaster?: string | undefined;
|
|
649
|
-
paymasterData?: string | undefined;
|
|
650
|
-
paymasterVerificationGasLimit?: string | undefined;
|
|
651
|
-
paymasterPostOpGasLimit?: string | undefined;
|
|
652
|
-
factory?: string | undefined;
|
|
653
|
-
factoryData?: string | undefined;
|
|
654
|
-
} | undefined;
|
|
655
|
-
description?: string | undefined;
|
|
656
|
-
userGroupId?: string | undefined;
|
|
657
|
-
settings?: {
|
|
658
|
-
contestType?: string | undefined;
|
|
659
|
-
chainId?: number | undefined;
|
|
660
|
-
paymentTokenAddress?: string | undefined;
|
|
661
|
-
paymentTokenSymbol?: string | undefined;
|
|
662
|
-
operator?: string | undefined;
|
|
663
|
-
expiryTimestamp?: number | undefined;
|
|
664
|
-
primaryDeposit?: number | undefined;
|
|
665
|
-
referralNetworkBps?: number | undefined;
|
|
666
|
-
oracleFeeBps?: number | undefined;
|
|
667
|
-
referralGroupId?: string | undefined;
|
|
668
|
-
primaryDepositSecondarySubsidyBps?: number | undefined;
|
|
669
|
-
primaryEntryInvestmentShareBps?: number | undefined;
|
|
670
|
-
positionBonusShareBps?: number | undefined;
|
|
671
|
-
targetPrimaryShareBps?: number | undefined;
|
|
672
|
-
maxCrossSubsidyBps?: number | undefined;
|
|
673
|
-
maxPlayers?: number | undefined;
|
|
674
|
-
scoringType?: "STABLEFORD" | "STROKE_PLAY" | undefined;
|
|
675
|
-
} | undefined;
|
|
676
|
-
notifyLeagueMembers?: boolean | undefined;
|
|
677
|
-
}, {
|
|
678
|
-
chainId: number;
|
|
679
|
-
action: "createContest";
|
|
680
|
-
smartWallet: string;
|
|
681
|
-
name: string;
|
|
682
|
-
eventId: string;
|
|
683
|
-
endDate: string | number;
|
|
684
|
-
userOpSignature?: string | undefined;
|
|
685
|
-
userOp?: {
|
|
686
|
-
sender: string;
|
|
687
|
-
nonce: string;
|
|
688
|
-
callData: string;
|
|
689
|
-
callGasLimit: string;
|
|
690
|
-
verificationGasLimit: string;
|
|
691
|
-
preVerificationGas: string;
|
|
692
|
-
maxFeePerGas: string;
|
|
693
|
-
maxPriorityFeePerGas: string;
|
|
694
|
-
paymaster?: string | undefined;
|
|
695
|
-
paymasterData?: string | undefined;
|
|
696
|
-
paymasterVerificationGasLimit?: string | undefined;
|
|
697
|
-
paymasterPostOpGasLimit?: string | undefined;
|
|
698
|
-
factory?: string | undefined;
|
|
699
|
-
factoryData?: string | undefined;
|
|
700
|
-
} | undefined;
|
|
701
|
-
description?: string | undefined;
|
|
702
|
-
userGroupId?: string | undefined;
|
|
703
|
-
settings?: {
|
|
704
|
-
contestType?: string | undefined;
|
|
705
|
-
chainId?: number | undefined;
|
|
706
|
-
paymentTokenAddress?: string | undefined;
|
|
707
|
-
paymentTokenSymbol?: string | undefined;
|
|
708
|
-
operator?: string | undefined;
|
|
709
|
-
expiryTimestamp?: number | undefined;
|
|
710
|
-
primaryDeposit?: number | undefined;
|
|
711
|
-
referralNetworkBps?: number | undefined;
|
|
712
|
-
oracleFeeBps?: number | undefined;
|
|
713
|
-
referralGroupId?: string | undefined;
|
|
714
|
-
primaryDepositSecondarySubsidyBps?: number | undefined;
|
|
715
|
-
primaryEntryInvestmentShareBps?: number | undefined;
|
|
716
|
-
positionBonusShareBps?: number | undefined;
|
|
717
|
-
targetPrimaryShareBps?: number | undefined;
|
|
718
|
-
maxCrossSubsidyBps?: number | undefined;
|
|
719
|
-
maxPlayers?: number | undefined;
|
|
720
|
-
scoringType?: "STABLEFORD" | "STROKE_PLAY" | undefined;
|
|
721
|
-
} | undefined;
|
|
722
|
-
notifyLeagueMembers?: boolean | undefined;
|
|
723
|
-
}>]>;
|
|
197
|
+
}, z.core.$strip>>;
|
|
198
|
+
}, z.core.$strip>], "action">;
|
|
724
199
|
export declare const registerSchema: z.ZodObject<{
|
|
725
200
|
email: z.ZodString;
|
|
726
201
|
name: z.ZodOptional<z.ZodString>;
|
|
727
202
|
referralCode: z.ZodOptional<z.ZodString>;
|
|
728
|
-
},
|
|
729
|
-
email: string;
|
|
730
|
-
name?: string | undefined;
|
|
731
|
-
referralCode?: string | undefined;
|
|
732
|
-
}, {
|
|
733
|
-
email: string;
|
|
734
|
-
name?: string | undefined;
|
|
735
|
-
referralCode?: string | undefined;
|
|
736
|
-
}>;
|
|
203
|
+
}, z.core.$strip>;
|
|
737
204
|
export type UserOpBody = z.infer<typeof userOpSchema>;
|
|
738
205
|
export type PlayActionBody = z.infer<typeof playActionSchema>;
|
|
739
206
|
export type CreateContestActionBody = z.infer<typeof createContestActionSchema>;
|
package/dist/contract.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB,eAAO,MAAM,qBAAqB
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;kBAoBrB,CAAC;AAEd,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;iBAevB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAU3B,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAapC,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAGvB,CAAC;AAEH,eAAO,MAAM,cAAc;;;;iBAIzB,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AACtD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC9D,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAChF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AACtD,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE1D,MAAM,MAAM,YAAY,GAAG;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IAC1C,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,YAAY,EAAE,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAC1D,MAAM,MAAM,cAAc,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAC9E,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,EAAE,UAAU,EAAE,CAAA;CAAE,CAAC"}
|
package/docs/agents.md
CHANGED
|
@@ -26,7 +26,7 @@ const { lineupId } = await agent.lineupUpsert({
|
|
|
26
26
|
await agent.join({ contestId: contests[0].contestId, lineupId });
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
The account is one wallet. A person signs in with Privy in the browser, installs or revokes a delegate, and can enter a contest from the app. An agent can register that wallet itself and sign the same player routes. The route list is
|
|
29
|
+
The account is one wallet. A person signs in with Privy in the browser, installs or revokes a delegate, and can enter a contest from the app. An agent can register that wallet itself and sign the same player routes. The route list is [api.md](api.md). This page is how to sign, and how the play actions work.
|
|
30
30
|
|
|
31
31
|
A delegate is a key the user installs on that wallet so another client can act for them. The delegate signs this API. The server may hold the key, or the caller may hold it. Both are the same kind of key.
|
|
32
32
|
|
package/docs/api.md
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
# Server API reference (v4)
|
|
2
|
+
|
|
3
|
+
Base URL: `/api` (e.g. `http://localhost:3000/api`)
|
|
4
|
+
|
|
5
|
+
Signing for agents is in [agents.md](agents.md). This file is the route list.
|
|
6
|
+
|
|
7
|
+
Two ways to write a lineup or a paid contest:
|
|
8
|
+
|
|
9
|
+
- `/api/lineups` and `/api/contests` record a transaction the wallet already sent.
|
|
10
|
+
- `POST /api/bot/actions` is where the server builds and submits the user operation (`lineupUpsert`, `join`, `leave`, `createContest`).
|
|
11
|
+
|
|
12
|
+
A lineup roster is `candidates` on every request and response. A write is an ordered array of `eventParticipantId` strings. A read is that roster with scores. `GET /api/sports/:sportId/events/:eventId/candidates` is the field pool, a different shape under the same word.
|
|
13
|
+
|
|
14
|
+
## Authentication
|
|
15
|
+
|
|
16
|
+
| Value | Meaning |
|
|
17
|
+
|-------|---------|
|
|
18
|
+
| `none` | No credential. A bearer or signature is optional where the description says so. |
|
|
19
|
+
| `either` | Privy bearer or an ERC-8128 signature. One is required. |
|
|
20
|
+
| `signature` | ERC-8128 only. |
|
|
21
|
+
| `privy` | Privy bearer only. |
|
|
22
|
+
| `staff` | Privy bearer and `userType` `ADMIN` or `SUPER_ADMIN`. |
|
|
23
|
+
|
|
24
|
+
Player routes accept either a Privy bearer token or an [ERC-8128](https://erc8128.org) HTTP message signature. The headers are `Signature-Input` and `Signature`, plus `Content-Digest` when the request has a body. Sending both credentials is `400`. The signer is an active delegate for the signed `smartWallet` query, or the wallet verified with ERC-1271 when that query is omitted. `user.address` is the wallet. `keyid` is `eip8128:<chainId>:0x<signer>` and its chain must equal `X-Cut-Chain-Id` when that header is present (`8453` or `84532`). The signature is Request-Bound and Non-Replayable: `created` and `expires` are at most one hour apart, and `(keyid, nonce)` is consumed until `expires`.
|
|
25
|
+
|
|
26
|
+
`AGENT` is a player type. It is not staff.
|
|
27
|
+
|
|
28
|
+
The browser sends:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
Authorization: Bearer <privy_access_token>
|
|
32
|
+
X-Cut-Chain-Id: <8453 or 84532; required on on-chain routes via requireWalletChain>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Bearer middleware verifies the Privy JWT and loads the Cut user from Postgres (`User` + primary `UserWallet`). It does not call Privy `users()._get` or write identity rows. Browser signup and wallet sync happen on `POST /auth/session` and `POST /auth/sync-wallets`. An agent account is created on `POST /auth/register`. A later Privy login on that wallet attaches `privyUserId` and leaves `userType` `AGENT`.
|
|
36
|
+
|
|
37
|
+
**Auth error codes**
|
|
38
|
+
|
|
39
|
+
| Code | HTTP | Meaning |
|
|
40
|
+
|------|------|---------|
|
|
41
|
+
| `NEEDS_PROVISIONING` | 401 | Valid JWT, no Cut user — client should `POST /auth/session` |
|
|
42
|
+
| `WALLET_NOT_PROVISIONED_FOR_CHAIN` | 409 | User exists, no primary wallet for `X-Cut-Chain-Id` |
|
|
43
|
+
| `WALLET_OWNED_BY_OTHER_ACCOUNT` | 409 | Privy-linked address belongs to another user |
|
|
44
|
+
| `EMAIL_ALREADY_BOUND` | 400 | Email already linked to another Cut user |
|
|
45
|
+
|
|
46
|
+
JSON bodies are capped at 128 KiB.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Route index
|
|
51
|
+
|
|
52
|
+
| Prefix | Router file |
|
|
53
|
+
|--------|-------------|
|
|
54
|
+
| `/health` | `api.ts` |
|
|
55
|
+
| `/auth` | `auth.ts` |
|
|
56
|
+
| `/sports` | `sports.ts` |
|
|
57
|
+
| `/lineups` | `lineups.ts` |
|
|
58
|
+
| `/contests` | `contest.ts` |
|
|
59
|
+
| `/userGroups` | `userGroup.ts` |
|
|
60
|
+
| `/admin` | `admin.ts` |
|
|
61
|
+
| `/cron` | `cron.ts` |
|
|
62
|
+
| `/unsubscribe` | `unsubscribe.ts` |
|
|
63
|
+
| `/stream` | `stream.ts` |
|
|
64
|
+
| `/bot` | `bot.ts` |
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Health
|
|
69
|
+
|
|
70
|
+
| Method | Path | Auth | Description |
|
|
71
|
+
|--------|------|------|-------------|
|
|
72
|
+
| GET | `/api/health` | none | `{ status, service, gitSha, timestamp }` |
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Auth (`/api/auth`)
|
|
77
|
+
|
|
78
|
+
| Method | Path | Auth | Description |
|
|
79
|
+
|--------|------|------|-------------|
|
|
80
|
+
| POST | `/register` | signature | Create an agent account. Wallet signer only. Body requires `email`; optional `name`, `referralCode`. New accounts are `userType` `AGENT`. A `smartWallet` query that is not the signer is `403`. Repeating register for the same wallet returns that account and does not change email or type. `201` when created, `200` when the wallet already has an account. Response: `userId`, `email`, `userType`, `name`, `referralCode`, `smartWallet`, `created`. |
|
|
81
|
+
| POST | `/session` | privy | Signup / sync from Privy. Optional `X-Cut-Referral-Code` is best-effort. Privy dashboard test accounts are stored as `userType` `TEST`. |
|
|
82
|
+
| POST | `/sync-wallets` | privy | Re-sync `UserWallet` rows from Privy linked accounts. |
|
|
83
|
+
| GET | `/me` | either | Profile, leagues, and `referralCode`. Mints a code if the user has none. |
|
|
84
|
+
| GET | `/referrals/summary` | either | Referral tree summary. |
|
|
85
|
+
| PUT | `/update` | either | Display name, 1–80 characters. |
|
|
86
|
+
| PUT | `/settings` | either | Merge `color`, `oddsFormat` (`american`, `decimal`, `english`), and `onboardingDismissed`. Does not change `marketingUnsubscribed`. |
|
|
87
|
+
| GET | `/contests` | either | This account's contest history. |
|
|
88
|
+
| GET | `/transactions` | either | Activity feed: entries, predictions, payouts. |
|
|
89
|
+
| POST | `/onchain-payments` | either | Record a confirmed value transfer. `X-Cut-Chain-Id` required. Body: `kind` (`ENTRY`, `WAGER`, `WITHDRAW`, `REFUND`, `SEND`, `PRIMARY`, `SECONDARY`), `tokenAddress`, `amountWei`, `from`, `to`, `transactionHash`, `logIndex`. `contestId` is required except for `SEND`. Optional `entryId`, `lineupId`. The server loads the receipt and stores the log amount. `ENTRY` and `WAGER` require an ERC-20 `Transfer` at `logIndex` from the account to the contest, in the contest payment token. `REFUND` and `WITHDRAW` require that transfer in the other direction. `SEND` requires a `Transfer` from the account in the platform payment token. `PRIMARY` and `SECONDARY` require `PrimaryPayoutClaimed` or `SecondaryPayoutClaimed` for this account, entry, and amount. |
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Sports (`/api/sports`)
|
|
94
|
+
|
|
95
|
+
Unsigned.
|
|
96
|
+
|
|
97
|
+
| Method | Path | Auth | Description |
|
|
98
|
+
|--------|------|------|-------------|
|
|
99
|
+
| GET | `/` | none | Enabled sports. |
|
|
100
|
+
| GET | `/:sportId/events/active` | none | Active event and status. `404` if none. |
|
|
101
|
+
| GET | `/:sportId/events/:eventId` | none | One event for that sport. `404` if it is not that sport's event. |
|
|
102
|
+
| GET | `/:sportId/events/:eventId/candidates` | none | Field pool: `{ candidates }`. |
|
|
103
|
+
|
|
104
|
+
Event responses are `{ sport, event, status }`. `event.metadata` is sport JSON (golf: name, dates, course, round status).
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Lineups (`/api/lineups`)
|
|
109
|
+
|
|
110
|
+
| Method | Path | Auth | Description |
|
|
111
|
+
|--------|------|------|-------------|
|
|
112
|
+
| GET | `/:eventId` | either | This account's lineups for the event. `{ lineups }`. |
|
|
113
|
+
| POST | `/:eventId` | either | Create a lineup. |
|
|
114
|
+
| POST | `/clone/:lineupId` | either | Copy a lineup into `contestId`. |
|
|
115
|
+
| PUT | `/:lineupId` | either | Update that lineup. |
|
|
116
|
+
|
|
117
|
+
**POST / PUT body:**
|
|
118
|
+
|
|
119
|
+
```json
|
|
120
|
+
{
|
|
121
|
+
"candidates": ["<eventParticipantId>"],
|
|
122
|
+
"name": "optional",
|
|
123
|
+
"contestId": "optional on create",
|
|
124
|
+
"prediction": { "type": "winningLineupTotal", "value": 142 }
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
- `candidates` is an ordered array of `eventParticipantId` values, at most 8.
|
|
129
|
+
- `POST` creates a new row. The same roster and prediction in the same contest is rejected when `contestId` is set.
|
|
130
|
+
- `PUT` updates candidates, name, and prediction.
|
|
131
|
+
- `prediction` is `{ "type": "winningLineupTotal", "value": <int> }` inside the sport's range. Omit it on create and the server stores a sport default.
|
|
132
|
+
- `name` is optional, max 80 characters.
|
|
133
|
+
- Create and update are rejected after the event is live or complete.
|
|
134
|
+
- Clone body is `{ "contestId", "name"? }`.
|
|
135
|
+
|
|
136
|
+
A lineup read includes `candidates` (id, slot, participant, `scoreData`, `total`) and `score`.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Contests (`/api/contests`)
|
|
141
|
+
|
|
142
|
+
| Method | Path | Auth | Description |
|
|
143
|
+
|--------|------|------|-------------|
|
|
144
|
+
| GET | `/directory` | none | Cross-event list. Query `scope`: `live`, `past`, or `all` (default). A bearer or signature is optional and includes that account's league contests. |
|
|
145
|
+
| GET | `/` | none | Contests for one event. A bearer or signature is optional. |
|
|
146
|
+
| GET | `/:id` | none | Lobby payload. `:id` is the contest id or the contract address. |
|
|
147
|
+
| GET | `/:id/lobby` | none | Same payload as `GET /:id`, with `Cache-Control: private, max-age=15`. |
|
|
148
|
+
| GET | `/:id/timeline` | none | Score timeline. Optional `?since=` ISO timestamp. |
|
|
149
|
+
| POST | `/` | either | Create a contest. Staff for a public contest, league admin for a league contest. |
|
|
150
|
+
| POST | `/:id/lineups` | either | Join with a lineup. `X-Cut-Chain-Id` when the contest has escrow. |
|
|
151
|
+
| DELETE | `/:id/lineups/:lineupId` | either | Leave. `:lineupId` is the contest-lineup id. |
|
|
152
|
+
| DELETE | `/:id` | either | Delete an open league contest. League admin. Paid contests that already have entries are rejected. |
|
|
153
|
+
| POST | `/:id/secondary-participants` | either | Index a winner-pool buy from a confirmed transaction. `X-Cut-Chain-Id` required. |
|
|
154
|
+
|
|
155
|
+
**GET `/` query:** `eventId` (required), optional `chainId`, optional `userGroupId` (member required).
|
|
156
|
+
|
|
157
|
+
League contests are `404` to non-members.
|
|
158
|
+
|
|
159
|
+
**POST `/`** is two creates. `settings.primaryDeposit` of `0` omits `address` and `transactionHash`. A paid contest requires both. The server loads the factory receipt once, requires a `ContestCreated` log for `address`, and requires that log's `host` to be the authenticated wallet (`403` otherwise). It overwrites `settings.operator` and `settings.paymentTokenAddress` from the clone. One row per chain and contract address; a second registration is `409`. `transactionId` is an alias of `transactionHash` on this route only. A paid contest the server must deploy is `createContest` on `POST /api/bot/actions`, not this route.
|
|
160
|
+
|
|
161
|
+
Other body fields: `eventId`, `name`, `endDate`, `chainId`, `settings`, optional `userGroupId`, `description`, `notifyLeagueMembers`. `notifyLeagueMembers` emails opted-in league members after the row is written. It is ignored without `userGroupId`.
|
|
162
|
+
|
|
163
|
+
**POST `/:id/lineups` body:** `lineupId`. An optional `entryId` is ignored. The server sets `entryId` from the contest address and lineup id. On-chain `entryOwner(entryId)` must be the authenticated wallet.
|
|
164
|
+
|
|
165
|
+
**POST `/:id/secondary-participants` body:** `entryId`, `transactionHash`, `chainId`, optional `amountWei`. The server requires a `SecondaryPositionAdded` log on this contest for the caller and `entryId`. Replays of the same `transactionHash` are idempotent.
|
|
166
|
+
|
|
167
|
+
A signed-in lobby may include `contestLineups[].referralStake` (`{ depth }`, 1–10) when that entry owner is in the viewer's invite tree and the contest has a referral-network fee. Unsigned payloads omit it. Open contests omit roster `candidates`.
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Leagues (`/api/userGroups`)
|
|
172
|
+
|
|
173
|
+
The product name is league. The path is `/api/userGroups`. Client pages are `/leagues`.
|
|
174
|
+
|
|
175
|
+
| Method | Path | Auth | Description |
|
|
176
|
+
|--------|------|------|-------------|
|
|
177
|
+
| GET | `/` | either | Leagues for the current account. |
|
|
178
|
+
| POST | `/` | either | Create a league. The creator is the league admin. |
|
|
179
|
+
| POST | `/join` | either | Join with an invite code. |
|
|
180
|
+
| GET | `/:id` | either | League detail and members. Member required. |
|
|
181
|
+
| PUT | `/:id` | either | Update name and description. League admin. |
|
|
182
|
+
| DELETE | `/:id` | either | Delete the league. League admin. |
|
|
183
|
+
| GET | `/:id/contests` | either | League contests across events. Member required. |
|
|
184
|
+
| GET | `/:id/members` | either | Member list. Member required. |
|
|
185
|
+
| DELETE | `/:id/members/:userId` | either | Remove a member. |
|
|
186
|
+
| POST | `/:id/invite` | either | Generate an invite code. League admin. |
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Admin (`/api/admin`)
|
|
191
|
+
|
|
192
|
+
`staff`. An agent signature is `403`.
|
|
193
|
+
|
|
194
|
+
| Method | Path | Auth | Description |
|
|
195
|
+
|--------|------|------|-------------|
|
|
196
|
+
| GET | `/dashboard` | staff | Ops dashboard. Query `eventId`. `tournamentId` is accepted as an alias on this route only. |
|
|
197
|
+
| POST | `/contests/lock-eligible` | staff | Batch lock contests. |
|
|
198
|
+
| POST | `/contests/:contestId/lock` | staff | Lock one active contest. |
|
|
199
|
+
| GET | `/users` | staff | User list and payment-token balances. Query `userType`: `USER` (default), `TEST`, `ADMIN`, `SUPER_ADMIN`, `PUBLIC`, `AGENT`. `X-Cut-Chain-Id` required. |
|
|
200
|
+
| GET | `/users/:id` | staff | User detail. |
|
|
201
|
+
| POST | `/test-email` | staff | Send a preview email. |
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Cron (`/api/cron`)
|
|
206
|
+
|
|
207
|
+
| Method | Path | Auth | Description |
|
|
208
|
+
|--------|------|------|-------------|
|
|
209
|
+
| GET | `/status` | staff | Scheduler enabled and active job names. |
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## Unsubscribe (`/api/unsubscribe`)
|
|
214
|
+
|
|
215
|
+
| Method | Path | Auth | Description |
|
|
216
|
+
|--------|------|------|-------------|
|
|
217
|
+
| GET | `/` | none | Marketing unsubscribe. The link carries its own signed token. |
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## Stream (`/api/stream`)
|
|
222
|
+
|
|
223
|
+
| Method | Path | Auth | Description |
|
|
224
|
+
|--------|------|------|-------------|
|
|
225
|
+
| GET | `/token` | either | Stream Feeds user token. `{ apiKey, token, userId, expiresInSeconds }`. `503` when Stream is disabled. |
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Bot (`/api/bot`)
|
|
230
|
+
|
|
231
|
+
| Method | Path | Auth | Description |
|
|
232
|
+
|--------|------|------|-------------|
|
|
233
|
+
| GET | `/delegate-address` | none | Public address of the server-held delegate, or `null` when that key is unset. |
|
|
234
|
+
| GET | `/contests` | signature | Contests this signer can enter, each with its field. |
|
|
235
|
+
| POST | `/actions` | signature | `lineupUpsert`, `join`, `leave`, or `createContest`. |
|
|
236
|
+
| GET | `/delegates` | either | Delegates for the account. |
|
|
237
|
+
| POST | `/delegates` | privy | Record an approved session key. |
|
|
238
|
+
| POST | `/delegates/revoke` | privy | Mark a delegate revoked. |
|
|
239
|
+
|
|
240
|
+
**GET `/contests` query:** `chainId` (`8453` or `84532`), `smartWallet`, optional `eventId`. Visibility matches `GET /api/contests`: public contests, plus league contests for that account.
|
|
241
|
+
|
|
242
|
+
**POST `/actions` lineup body:**
|
|
243
|
+
|
|
244
|
+
```json
|
|
245
|
+
{
|
|
246
|
+
"chainId": 8453,
|
|
247
|
+
"action": "lineupUpsert",
|
|
248
|
+
"smartWallet": "0x…",
|
|
249
|
+
"contestId": "contest id",
|
|
250
|
+
"lineupId": "",
|
|
251
|
+
"candidates": ["eventParticipantId"],
|
|
252
|
+
"prediction": { "type": "winningLineupTotal", "value": 142 }
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
`lineupId` `""` creates a lineup. A lineup id updates it. `join` and `leave` send the lineup id and omit `candidates`. `prediction` is optional on `lineupUpsert`.
|
|
257
|
+
|
|
258
|
+
A delegate signer must be an active `BotDelegate` whose permission is still installed on the wallet. The wallet signer can list contests and save a lineup with no delegate. Join and leave for that wallet submit only when a server-held delegate (`kind` `cut_bot`) is active.
|
|
259
|
+
|
|
260
|
+
A server-held delegate submits the user operation. A caller-held delegate's first join or leave returns `{ preparedUserOp, lineupId, userOpHash, userOp }`. The second request sends the same body plus `userOp` and `userOpSignature`, under a new nonce.
|
|
261
|
+
|
|
262
|
+
`createContest` deploys a paid contest. The body includes `name`, `eventId`, `endDate`, and `settings.primaryDeposit` greater than zero, with optional `description`, `userGroupId`, and `notifyLeagueMembers`. The caller must be a league admin or staff. An `AGENT` creating a public contest is rejected. The server builds the factory user operation, then records the contest with the same rules as `POST /api/contests`. A caller-held delegate uses the same `preparedUserOp` step. The response is `{ preparedUserOp, userOpHash, userOp }` or `{ ok, contestId, address }`.
|
|
263
|
+
|
|
264
|
+
**POST `/delegates` body:** `kind` (`cut_bot` or `external`), `delegateAddress`, `smartWallet`, `approval`, `permissionId` (4-byte hex). `smartWallet` must be the signed-in account's wallet.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playthecut/agent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Sign and send Play The Cut agent requests",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"files": [
|
|
19
19
|
"dist",
|
|
20
20
|
"docs",
|
|
21
|
+
"api.md",
|
|
21
22
|
"README.md"
|
|
22
23
|
],
|
|
23
24
|
"publishConfig": {
|
|
@@ -31,7 +32,7 @@
|
|
|
31
32
|
"dependencies": {
|
|
32
33
|
"@slicekit/erc8128": "0.4.1",
|
|
33
34
|
"viem": "^2.47.4",
|
|
34
|
-
"zod": "^
|
|
35
|
+
"zod": "^4.6.6"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"typescript": "^5.7.3",
|