@piprail/sdk 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.
Files changed (3) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +21 -0
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,23 @@ All notable changes to `@piprail/sdk` are documented here. The format
4
4
  follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the
5
5
  versions follow [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [1.1.1] — 2026-06-03
8
+
9
+ Docs + examples only — **no code change**; the API and every chain behave exactly as 1.1.0.
10
+
11
+ ### Docs
12
+ - **"In the browser — no build, no npm" guide** in the README. `@piprail/sdk` is browser-clean
13
+ and runs from any npm-mirroring CDN (`esm.sh` / `jsDelivr`), so a plain HTML page can take or
14
+ make payments with no bundler — the CDN resolves `viem` and any lazily-imported chain lib.
15
+ Verified end-to-end (gate + client, Node + browser, plus a real on-chain payment made **from a
16
+ browser**). Includes the injected-wallet pattern and a loud "never ship a raw key in client-side
17
+ HTML" warning.
18
+
19
+ ### Examples
20
+ - **New `examples/browser/`** — a single self-contained HTML file that loads the SDK from a CDN and
21
+ runs a live in-browser x402 demo (build a real `402` challenge, quote it), no build step. A hosted,
22
+ interactive version of the same demo is live at https://piprail.com/demo.
23
+
7
24
  ## [1.1.0] — 2026-06-03
8
25
 
9
26
  Found by the live-test campaign: **native NEAR + native TRX are now payment assets** (native
package/README.md CHANGED
@@ -445,6 +445,27 @@ export async function handler(req: Request): Promise<Response> {
445
445
 
446
446
  Reuse one gate per route — its in-memory replay guard stops a proof being spent twice. Running multiple instances? Pass your own `isUsed` / `markUsed` (e.g. Redis `SET NX`).
447
447
 
448
+ ## In the browser — no build, no npm
449
+
450
+ The SDK is browser-clean (no Node-only globals in the protocol layer), so a plain HTML page can take **or** make payments straight from a CDN — every npm-mirroring CDN serves it automatically:
451
+
452
+ ```html
453
+ <script type="module">
454
+ import { PipRailClient } from 'https://esm.sh/@piprail/sdk' // or jsDelivr: .../npm/@piprail/sdk@1/+esm
455
+ // In a browser, sign with the visitor's wallet — never a raw key (page source is public):
456
+ import { createWalletClient, custom } from 'https://esm.sh/viem'
457
+ const walletClient = createWalletClient({ transport: custom(window.ethereum) })
458
+
459
+ const client = new PipRailClient({ chain: 'base', wallet: { walletClient } })
460
+ const res = await client.fetch('https://api.example.com/paid') // 402 → wallet signs → 200
461
+ </script>
462
+ ```
463
+
464
+ - **Which chains run in the browser.** EVM (viem) works out of the box; **Solana, Sui, and NEAR** load their libs from the CDN too (an [import map](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap) pins each to a browser-ESM build — see [`examples/browser/`](../examples/browser)). A few chains' libraries (**TON, Tron, XRPL, Stellar**) don't ship a clean browser ESM build yet, so use those **server-side** — the identical one line, on Node/Bun/Deno/Workers. The lazy import means a pure-EVM page never downloads any of them.
465
+ - **The merchant gate runs anywhere.** `createPaymentGate` needs only a `payTo` address — no key — so building challenges and verifying proofs works in the browser too (the typical *deployment* is still a server, since a browser can't receive inbound HTTP to gate).
466
+ - **Both halves verified on Node and in a real browser**, against the published package. Runnable showcase: [`examples/browser/`](../examples/browser) — a single HTML file with a live, in-browser 402 demo; or try it hosted at [piprail.com/demo](https://piprail.com/demo).
467
+ - **Keys:** raw `{ privateKey }` wallets belong only in a **server's** environment. In a browser, use an injected `walletClient` as above.
468
+
448
469
  ## Architecture (under the hood)
449
470
 
450
471
  Two layers, one contract. Worth knowing if you're extending the SDK or auditing it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@piprail/sdk",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Accept x402 crypto payments across 24 chains — every major EVM chain plus Solana, TON, Tron, NEAR, Sui, Stellar & XRPL — in a couple of lines. No backend, no database, no fee; payments settle straight to your wallet.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",