@elisym/commerce 0.1.0 → 0.3.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 +11 -0
- package/dist/buyer.d.ts +921 -0
- package/dist/buyer.js +1799 -0
- package/dist/buyer.js.map +1 -0
- package/dist/chunk-DYXVY6VD.js +1464 -0
- package/dist/chunk-DYXVY6VD.js.map +1 -0
- package/dist/index.d.ts +39 -542
- package/dist/index.js +1 -1442
- package/dist/index.js.map +1 -1
- package/dist/verify-offer-BZ_a9x3L.d.ts +558 -0
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -15,6 +15,7 @@ npm install @elisym/commerce @elisym/pay-core nostr-tools @solana/kit @solana-pr
|
|
|
15
15
|
| Store profile | 0 | store | `buildStoreProfileEvent`, `parseStoreProfile` |
|
|
16
16
|
| Product | 30402 (NIP-99, Gamma) | store | `buildProductEvent`, `parseProduct`, `priceInSubunits` |
|
|
17
17
|
| Orders, receipts | 16 / 17 in a gift wrap | buyer / store | `buildOrderMessage`, `wrapOrderMessage`, `unwrapOrderMessage` |
|
|
18
|
+
| Payment reference | - | - | `deriveOrderPaymentReference` |
|
|
18
19
|
| Offer verification | - | - | `verifyOffer`, `evaluateOffer`, `isOfferPayout` |
|
|
19
20
|
|
|
20
21
|
## The one rule
|
|
@@ -33,6 +34,16 @@ if (!isOfferPayout(result.offer, caip19, challenge.payTo)) throw new Error('Not
|
|
|
33
34
|
|
|
34
35
|
On a server, pass `verifyOffer` a `fetch` that refuses private addresses: the merchant's domain comes from the store's own profile.
|
|
35
36
|
|
|
37
|
+
## The buyer side: `@elisym/commerce/buyer`
|
|
38
|
+
|
|
39
|
+
The checkout widget and the elisym MCP buy through the same core. It covers:
|
|
40
|
+
|
|
41
|
+
- loading and verifying the offer (`loadOffer` for a page, `loadOfferForAgent` for an agent);
|
|
42
|
+
- placing the order and paying on Solana (`placeOrder`, `payWithSolana`);
|
|
43
|
+
- following the store's answer (`watchSolanaPayment`, `listenForStatus`).
|
|
44
|
+
|
|
45
|
+
Order records live behind an `OrderBackend`, a read-judge-write transaction for one product. Every money rule is judged in the core, never in a backend: one order is never paid twice, and nothing is paid before the store's inbox acknowledged the order. The backends are IndexedDB in the checkout, a locked and fsynced file in the MCP, and `MemoryOrderBackend` for tests.
|
|
46
|
+
|
|
36
47
|
## License
|
|
37
48
|
|
|
38
49
|
MIT
|