prizerail 1.1.0 → 1.1.1
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/dist/client.d.ts +1 -1
- package/dist/client.js +1 -1
- package/dist/types.d.ts +2 -2
- package/package.json +1 -1
- package/plugins/prizerail/.claude-plugin/plugin.json +1 -1
- package/plugins/prizerail/skills/prizerail-check/SKILL.md +1 -1
- package/plugins/prizerail/skills/prizerail-integrate/SKILL.md +14 -4
package/dist/client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Http } from "./http.js";
|
|
2
2
|
import type { Campaign, Drawing, DrawingRef, DrawingStatus, DrawingsPage, Entrant, EntrantEvent, EntriesPage, Guarantee, SendEntriesResponse, SentEntrant } from "./types.js";
|
|
3
3
|
import { type DrawProof, type VerifyResult } from "./verify.js";
|
|
4
|
-
export declare const VERSION = "1.1.
|
|
4
|
+
export declare const VERSION = "1.1.1";
|
|
5
5
|
/** The API takes up to this many entries per request. */
|
|
6
6
|
export declare const ENTRIES_PER_REQUEST = 1000;
|
|
7
7
|
export type PrizerailOptions = {
|
package/dist/client.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PrizerailCutoffError, PrizerailDrawingChangedError, PrizerailError, } from "./errors.js";
|
|
2
2
|
import { Http } from "./http.js";
|
|
3
3
|
import { verifyDraw } from "./verify.js";
|
|
4
|
-
export const VERSION = "1.1.
|
|
4
|
+
export const VERSION = "1.1.1";
|
|
5
5
|
const badPage = (detail) => new PrizerailError(0, "invalid_response", `Paging stopped: ${detail}.`);
|
|
6
6
|
/** The API takes up to this many entries per request. */
|
|
7
7
|
export const ENTRIES_PER_REQUEST = 1000;
|
package/dist/types.d.ts
CHANGED
|
@@ -120,8 +120,8 @@ export type Entrant = string | {
|
|
|
120
120
|
entrantId: string;
|
|
121
121
|
/**
|
|
122
122
|
* Their number of entries, a whole number from 1. Leave it out and it's
|
|
123
|
-
* 1. Entries are chances: 5 entries is five times as likely to
|
|
124
|
-
*
|
|
123
|
+
* 1. Entries are chances: 5 entries is five times as likely to be picked
|
|
124
|
+
* as 1.
|
|
125
125
|
*/
|
|
126
126
|
entries?: number;
|
|
127
127
|
/** Up to 40 characters. */
|
package/package.json
CHANGED
|
@@ -23,7 +23,7 @@ It needs `PRIZERAIL_API_KEY` in the environment. The key picks the site: a `pr_s
|
|
|
23
23
|
| **Open drawing** | A drawing is taking entries, with its cutoff shown | None open while paused, or between a cutoff and the next drawing being made. Entries sent now would get `409 no_open_drawing`. |
|
|
24
24
|
| **Entrant ids** | The first 5,000 ids in the open drawing look opaque | It fails on ids that look like an email, a username (a word with separators or in camelCase, even with a year on the end), a name with spaces, any all-digit id, or any id shorter than 16 characters. A few username-shaped ids in a large sample are a note, not a failure, since a random id now and then reads like a word. It notes any UUID: fine if it was made for Prizerail and stored, not if it's the app's own users table id. Entrant ids are published, hashed, with every draw, so they must be an HMAC of the user id with a secret key, or a random id the app stores. See [Entrant ids](https://docs.prizerail.com/getting-started/concepts#make-entrant-ids-with-an-hmac). |
|
|
25
25
|
| **Entries** | Entries are whole numbers from 1 to 4,294,967,295, and the spread looks deliberate | It notes when every entrant has exactly 1 entry, which is fine if entries aren't used, and a problem if the app meant to send totals and left `entries` out, since an entrant sent without it is set back to 1. It also notes a total that is far above the others. |
|
|
26
|
-
| **Draw** (`--draw`, sandbox only) | The open drawing is drawn now, settles, and its proof passes the verify script | Outside the sandbox the API answers `403 sandbox_only`. With no entries the command stops with "Nothing to draw from" before asking (the API's own answer to a bare run is `409 no_entries`). If the API answers 202 with the draw still `entropy_requested`, the command polls it for up to 3 minutes and says so if it hasn't settled. A settled draw can carry an `i` "flagged for staff" note, such as "Campaign has no payout address" in a sandbox campaign with no wallet: the draw and its proof still pass, it just stays `settled` rather than `paid`. |
|
|
26
|
+
| **Draw** (`--draw`, sandbox only) | The open drawing is drawn now, settles, and its proof passes the verify script | Outside the sandbox the API answers `403 sandbox_only`. With no entries the command stops with "Nothing to draw from" before asking (the API's own answer to a bare run is `409 no_entries`). If the API answers 202 with the draw still `entropy_requested`, the command polls it for up to 3 minutes and says so if it hasn't settled. A `✗` saying the drawing "needs attention" before it settles is on Prizerail's side, usually the random value pending past 30 minutes, and nothing in the integration causes it: wait, and tell us if it stays. A settled draw can carry an `i` "flagged for staff" note, such as "Campaign has no payout address" in a sandbox campaign with no wallet: the draw and its proof still pass, it just stays `settled` rather than `paid`. |
|
|
27
27
|
|
|
28
28
|
It prints `✓` for a passing check, `✗` for a failing one, and `i` for a note, and exits 0 only if nothing failed. Report each `✗` and `i` line as printed, with the fix from the table above.
|
|
29
29
|
|
|
@@ -5,7 +5,7 @@ description: Add Prizerail to an app so its users enter the partner's prize draw
|
|
|
5
5
|
|
|
6
6
|
# Integrate Prizerail
|
|
7
7
|
|
|
8
|
-
Prizerail runs prize draws for partner apps. The partner's backend sends each eligible user as an **entrant** with their number of **entries** (chances: 5 entries is five times as likely to
|
|
8
|
+
Prizerail runs prize draws for partner apps. The partner's backend sends each eligible user as an **entrant** with their number of **entries** (chances: 5 entries is five times as likely to be picked as 1), and at each **cutoff** Prizerail locks the list, draws the winners from it with a public random value, and sends the prizes to the partner's wallet to pay out. The partner never picks winners and never handles the randomness. This skill builds the sending side.
|
|
9
9
|
|
|
10
10
|
Read the docs when a detail isn't here: [Send entries](https://docs.prizerail.com/api/send-entries), [Concepts](https://docs.prizerail.com/getting-started/concepts), [Winners and eligibility](https://docs.prizerail.com/campaigns/winners), or everything at [llms-full.txt](https://docs.prizerail.com/llms-full.txt). Whole runnable projects are in [prizerail-examples](https://github.com/coordinationlabs/prizerail-examples): a Next.js app that adds entries as users earn them, a Node worker that sends the day's entries, and the same send in Python.
|
|
11
11
|
|
|
@@ -96,7 +96,13 @@ A campaign's official rules can narrow these. Read them from the partner, and po
|
|
|
96
96
|
Set mode, from a job that runs before each cutoff:
|
|
97
97
|
|
|
98
98
|
```ts
|
|
99
|
-
import {
|
|
99
|
+
import {
|
|
100
|
+
Prizerail,
|
|
101
|
+
PrizerailCutoffError,
|
|
102
|
+
PrizerailDrawingChangedError,
|
|
103
|
+
hashEntrant,
|
|
104
|
+
type Entrant,
|
|
105
|
+
} from "prizerail"
|
|
100
106
|
|
|
101
107
|
const campaign = new Prizerail({ apiKey: process.env.PRIZERAIL_API_KEY }).campaign(
|
|
102
108
|
process.env.PRIZERAIL_CAMPAIGN!
|
|
@@ -114,8 +120,12 @@ export async function sendTodaysEntries() {
|
|
|
114
120
|
const res = await campaign.entries.send(entrants)
|
|
115
121
|
return { drawingId: res.drawing.id, sent: res.sent, entrantCount: res.entrantCount }
|
|
116
122
|
} catch (error) {
|
|
117
|
-
if (
|
|
118
|
-
|
|
123
|
+
if (
|
|
124
|
+
error instanceof PrizerailCutoffError ||
|
|
125
|
+
error instanceof PrizerailDrawingChangedError
|
|
126
|
+
) {
|
|
127
|
+
// Both carry progress: error.progress.sent entrants were confirmed in
|
|
128
|
+
// error.progress.drawing. Check the rest with entries.list().
|
|
119
129
|
throw new Error(`${error.progress.sent} sent to ${error.progress.drawing.id}: ${error.detail}`)
|
|
120
130
|
}
|
|
121
131
|
throw error
|