@hypawave/sdk 0.2.0 → 0.2.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 +18 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @hypawave/sdk
|
|
2
2
|
|
|
3
|
-
**Lightning SDK for AI Agent Payments — non-custodial
|
|
3
|
+
**Bitcoin Lightning SDK for AI Agent Payments — non-custodial settlement with preimage-proof unlocks**
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@hypawave/sdk)
|
|
6
6
|
[](https://github.com/hypawave/sdk/blob/main/LICENSE)
|
|
@@ -10,13 +10,19 @@
|
|
|
10
10
|
|
|
11
11
|
> ⚠️ **Hypawave has no token and will never issue one.** Any "HYPA," "WAVE," airdrop, or token offer claiming to be from Hypawave is a scam. Hypawave is non-custodial Bitcoin Lightning settlement — buyers pay creators directly in sats. The protocol fee is the only economic primitive.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Hypawave is programmable settlement infrastructure for AI agents: a non-custodial Bitcoin Lightning protocol where verified payment unlocks API access, files, agent actions, and digital work.
|
|
14
|
+
|
|
15
|
+
This TypeScript SDK lets developers create creator-direct Lightning invoices, deliver payment payloads to payer agents, verify preimage proof, and trigger deterministic unlocks.
|
|
14
16
|
|
|
15
17
|
**Payment is the authorization — confirmed settlement unconditionally unlocks access.**
|
|
16
18
|
|
|
17
19
|
## Why Hypawave
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
Hypawave lets developers charge for digital work with one primitive: verified Bitcoin Lightning settlement unlocks access.
|
|
22
|
+
|
|
23
|
+
Use it when an API, file, webhook, inference job, automation, or agent action should only run after payment. The SDK creates creator-direct Lightning invoices, packages payment instructions for payer agents, verifies preimage proof after payment, and returns the preimage your app gates execution on.
|
|
24
|
+
|
|
25
|
+
The important difference from a normal invoice flow is that payment proof and authorization are the same event. Once the payer submits a valid preimage, Hypawave can release encrypted files, return gated data, or trigger execution without manual reconciliation, payer accounts, or custody.
|
|
20
26
|
|
|
21
27
|
This SDK covers **Path 2**: account-based agent flows. Accountless Paths 3a and 3b use raw HTTP via [llms.txt](https://hypawave.com/llms.txt) and the [OpenAPI spec](https://hypawave.com/.well-known/openapi.json). Requires programmable Lightning infrastructure (LND, CLN, Alby API, LNbits, NWC, etc.) that returns the preimage after payment.
|
|
22
28
|
|
|
@@ -47,19 +53,21 @@ npm install @hypawave/sdk
|
|
|
47
53
|
|
|
48
54
|
## Quick Start
|
|
49
55
|
|
|
56
|
+
This example shows the full settlement loop in one script for clarity. In production, the creator/developer usually creates the invoice, then sends either `payment_url` to a browser payer or `getPaymentPayload()` to a payer agent.
|
|
57
|
+
|
|
50
58
|
```typescript
|
|
51
59
|
import { Hypawave } from "@hypawave/sdk";
|
|
52
60
|
|
|
53
61
|
const pp = new Hypawave({ apiKey: "sk_live_..." });
|
|
54
62
|
|
|
55
|
-
// Create a payment request
|
|
63
|
+
// Create a payment request
|
|
56
64
|
const invoice = await pp.createInvoice({
|
|
57
65
|
client_email: "alice@example.com",
|
|
58
66
|
client_first_name: "Alice",
|
|
59
67
|
client_last_name: "Smith",
|
|
60
68
|
amount: 5.00,
|
|
61
69
|
due_date: "2026-12-31",
|
|
62
|
-
payment_destination: "creator@getalby.com",
|
|
70
|
+
payment_destination: "creator@getalby.com", // optional; defaults to the API key owner's Lightning Address
|
|
63
71
|
});
|
|
64
72
|
|
|
65
73
|
console.log(invoice.invoice_id); // Use for confirmation + key retrieval
|
|
@@ -169,6 +177,10 @@ const invoice = await pp.createInvoice({
|
|
|
169
177
|
});
|
|
170
178
|
```
|
|
171
179
|
|
|
180
|
+
`payment_destination` is optional — defaults to the API key owner's stored Lightning Address. Override per-call only for marketplace routing, multi-wallet owners, or pass-through flows.
|
|
181
|
+
|
|
182
|
+
**Delivery primitives.** The response returns two ways to deliver the invoice. `payment_url` is a browser-based payment page — send it to any payer that pays via a browser. `getPaymentPayload()` (built from `access_token` + `instructions_url`) is the agent-native equivalent — send it to a payer agent that pays programmatically. Both terminate at the same `confirmPayment` endpoint with the same preimage proof; the choice depends on the receiver's capabilities, not the invoice.
|
|
183
|
+
|
|
172
184
|
### `getBolt11(accessToken)`
|
|
173
185
|
|
|
174
186
|
Fetch the creator-issued Lightning bolt11 invoice for payment. The `access_token`
|
|
@@ -365,11 +377,10 @@ const settings = await pp.getSettings();
|
|
|
365
377
|
Additional methods available — see types for full signatures, or [openapi.json](https://hypawave.com/.well-known/openapi.json) for the complete API reference.
|
|
366
378
|
|
|
367
379
|
- `listInvoices(params?)` — list invoices with filters and pagination
|
|
368
|
-
- `getPayerReceipt(invoiceId,
|
|
380
|
+
- `getPayerReceipt(invoiceId, preimage)` — payer receipt fetch using the Lightning preimage as proof of payment (no API key needed)
|
|
369
381
|
- `getUploadUrl(params)` — signed URL for encrypted file upload (creator side)
|
|
370
382
|
- `storeFile(params)` — register an uploaded file against an invoice
|
|
371
383
|
- `storeFileKey(params)` — register a file's encryption key against an invoice
|
|
372
|
-
- `request(path, options)` — low-level escape hatch for direct API calls
|
|
373
384
|
|
|
374
385
|
## Error Handling
|
|
375
386
|
|
package/package.json
CHANGED