prizerail 0.5.0 → 0.5.2

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 CHANGED
@@ -11,7 +11,7 @@ The Prizerail SDK for JavaScript and TypeScript. Send entries, read results and
11
11
  npm install prizerail
12
12
  ```
13
13
 
14
- The API is early (v0.x), so names can change between minor versions. 0.5.0 sends a `pr_sandbox_` key to https://sandbox.prizerail.com unless you pass `siteUrl` (0.4.0 did the same for the old `pr_test_` keys). 0.3.0 adds `entries.increment()`, 0.3.1 checks every event before sending any and lists only the drawings that took entries, and 0.3.2 and 0.3.3 check avatar URLs, names and the older `weight` up front too. 0.2.0 says `entries` where 0.1.0 said `weight`: an entrant is `{ entrantId, entries }`, and totals are `entrantCount` and `totalEntries`. The old names still work, marked deprecated. Each change is in the [changelog](https://docs.prizerail.com/changelog).
14
+ The API is early (v0.x), so names can change between minor versions. 0.5.2 changes no code: it is the first release from the public repo, and links to it from npm. 0.5.1 adds the `skipped` drawing status. 0.5.0 sends a `pr_sandbox_` key to https://sandbox.prizerail.com unless you pass `siteUrl` (0.4.0 did the same for the old `pr_test_` keys). 0.3.0 adds `entries.increment()`, 0.3.1 checks every event before sending any and lists only the drawings that took entries, and 0.3.2 and 0.3.3 check avatar URLs, names and the older `weight` up front too. 0.2.0 says `entries` where 0.1.0 said `weight`: an entrant is `{ entrantId, entries }`, and totals are `entrantCount` and `totalEntries`. The old names still work, marked deprecated. Each change is in the [changelog](https://docs.prizerail.com/changelog).
15
15
 
16
16
  ## Send entries
17
17
 
@@ -149,3 +149,36 @@ new Prizerail({
149
149
  ```
150
150
 
151
151
  Keep the API key on your server. It can send entries for every campaign under your account.
152
+
153
+ ## Development
154
+
155
+ ```sh
156
+ pnpm install
157
+ pnpm lint
158
+ pnpm type-check
159
+ pnpm test
160
+ pnpm build
161
+ ```
162
+
163
+ Issues and pull requests are welcome. For a security problem, email team@coordinationlabs.com instead of opening an issue.
164
+
165
+ `src/verify-draw.mjs` is the public verify script that prizerail.com serves at `/verify/verify-draw.mjs`. Keep the two the same: a change to how draws are checked goes in both, and prizerail.com's tests fail if its copy differs from the one in the published package.
166
+
167
+ ### Releasing
168
+
169
+ 1. Bump `version` in `package.json` and `VERSION` in `src/client.ts`, and add a line to the change list above.
170
+ 2. Merge to `main`.
171
+ 3. From an up-to-date `main`, run the checks and publish. `npm publish` builds `dist` first.
172
+
173
+ ```sh
174
+ pnpm install --frozen-lockfile
175
+ pnpm lint && pnpm type-check && pnpm test
176
+ npm publish
177
+ ```
178
+
179
+ 4. Tag the commit you published, so each npm version maps to its source:
180
+
181
+ ```sh
182
+ git tag v0.5.2
183
+ git push origin v0.5.2
184
+ ```
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 = "0.5.0";
4
+ export declare const VERSION = "0.5.2";
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 = "0.5.0";
4
+ export const VERSION = "0.5.2";
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
@@ -1,7 +1,9 @@
1
1
  /** Shapes the Prizerail partner API returns, as documented at docs.prizerail.com. */
2
2
  export type CampaignStatus = "draft" | "active" | "paused" | "ended";
3
3
  export type Cadence = "hourly" | "daily" | "weekly" | "monthly";
4
- export type DrawingStatus = "open" | "locked" | "entropy_requested" | "settled" | "paid";
4
+ export type DrawingStatus = "open" | "locked" | "entropy_requested" | "settled" | "paid"
5
+ /** No entries by the cutoff, so closed without a draw. */
6
+ | "skipped";
5
7
  export type DrawingKind = "regular" | "guarantee";
6
8
  export type PayoutKind = "lump_sum" | "large_prize" | "guarantee";
7
9
  export type PayoutStatus = "pending" | "submitted" | "confirmed" | "failed" | "held_manual";
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Types for verify-draw.mjs, the public verify script, which this package
3
- * ships unchanged (a test checks it matches public/verify/verify-draw.mjs).
3
+ * ships unchanged. prizerail.com serves the same file at /verify/verify-draw.mjs,
4
+ * and its tests check that copy matches the one in the published package.
4
5
  */
5
6
  export type Check = { ok: boolean | null; label: string; detail?: string };
6
7
  /** [index, keccak256(entrantId), weight] */
package/package.json CHANGED
@@ -1,9 +1,16 @@
1
1
  {
2
2
  "name": "prizerail",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "The Prizerail SDK: send entries, read draws and verify them.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://docs.prizerail.com",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/coordinationlabs/prizerail-js-sdk.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/coordinationlabs/prizerail-js-sdk/issues"
13
+ },
7
14
  "type": "module",
8
15
  "exports": {
9
16
  ".": {
@@ -27,6 +34,10 @@
27
34
  "sideEffects": false,
28
35
  "scripts": {
29
36
  "build": "node scripts/build.mjs",
37
+ "lint": "biome check .",
38
+ "lint:fix": "biome check --write .",
39
+ "type-check": "tsc --noEmit -p tsconfig.check.json",
40
+ "test": "vitest run",
30
41
  "prepublishOnly": "node scripts/build.mjs"
31
42
  },
32
43
  "keywords": [
@@ -35,5 +46,12 @@
35
46
  "prize draw",
36
47
  "pyth",
37
48
  "verifiable"
38
- ]
49
+ ],
50
+ "packageManager": "pnpm@10.18.3",
51
+ "devDependencies": {
52
+ "@biomejs/biome": "2.5.6",
53
+ "@types/node": "24.13.3",
54
+ "typescript": "6.0.3",
55
+ "vitest": "4.1.11"
56
+ }
39
57
  }