@openreceive/http 0.2.2 → 0.2.3

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.
@@ -7,7 +7,7 @@ import {
7
7
  isServiceErrorShape,
8
8
  mapHostRouteError,
9
9
  startNotificationWorker
10
- } from "./chunk-5S24YV7E.js";
10
+ } from "./chunk-SVRY37Z4.js";
11
11
  export {
12
12
  HostError,
13
13
  HttpError,
@@ -1632,7 +1632,14 @@ async function dispatch(runtime, request, requestId, native) {
1632
1632
  attempt: (minted) => ({ paymentHash: minted.paymentHash, checkout: minted })
1633
1633
  }
1634
1634
  );
1635
- return jsonResponse(201, { checkout: httpCheckout(checkout) }, requestId);
1635
+ return jsonResponse(
1636
+ 201,
1637
+ {
1638
+ checkout: httpCheckout(checkout),
1639
+ payment_methods: await warmPaymentMethods(runtime, checkout.amountMsats)
1640
+ },
1641
+ requestId
1642
+ );
1636
1643
  }
1637
1644
  if (route.kind === "payment.check") {
1638
1645
  const requestedPaymentHash2 = requiredPaymentHash(
@@ -1661,7 +1668,7 @@ async function dispatch(runtime, request, requestId, native) {
1661
1668
  200,
1662
1669
  {
1663
1670
  ...checkedBody,
1664
- payment_methods: await checkPaymentMethods(runtime, checkout.amountMsats)
1671
+ payment_methods: await warmPaymentMethods(runtime, checkout.amountMsats)
1665
1672
  },
1666
1673
  requestId
1667
1674
  );
@@ -1828,7 +1835,7 @@ async function persistCheckoutAttempt(runtime, input) {
1828
1835
  }
1829
1836
  var PAYMENT_METHODS_CACHE_SECONDS = 60;
1830
1837
  var PAYMENT_METHODS_CACHE_MAX_ENTRIES = 256;
1831
- async function checkPaymentMethods(runtime, amountMsats) {
1838
+ async function warmPaymentMethods(runtime, amountMsats) {
1832
1839
  const now = (runtime.clock ?? unixSeconds7)();
1833
1840
  const cached = runtime.paymentMethods.get(amountMsats);
1834
1841
  if (cached !== void 0 && now - cached.at < PAYMENT_METHODS_CACHE_SECONDS) {
package/dist/index.d.ts CHANGED
@@ -54,6 +54,7 @@ type WireCheckout = {
54
54
  /** Wire shape of the OpenAPI `CreateCheckoutResponse` schema (snake_case JSON body). */
55
55
  type WireCreateCheckoutResponse = {
56
56
  readonly checkout: WireCheckout;
57
+ readonly payment_methods: readonly WirePaymentMethod[];
57
58
  };
58
59
  /** Wire shape of the OpenAPI `PaymentCheckRequest` schema (snake_case JSON body). */
59
60
  type WirePaymentCheckRequest = {
package/dist/index.js CHANGED
@@ -34,7 +34,7 @@ import {
34
34
  startReconciler,
35
35
  typeOrmDb,
36
36
  webRequest
37
- } from "./chunk-5S24YV7E.js";
37
+ } from "./chunk-SVRY37Z4.js";
38
38
  export {
39
39
  HostError,
40
40
  HttpError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openreceive/http",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Framework-neutral (Web Request/Response) HTTP handler for OpenReceive checkout that builds on @openreceive/node and requires its Node runtime: request routing, host integration, and payment-attempt persistence.",
5
5
  "keywords": [
6
6
  "bitcoin",
@@ -17,8 +17,8 @@
17
17
  "main": "./dist/index.js",
18
18
  "types": "./dist/index.d.ts",
19
19
  "dependencies": {
20
- "@openreceive/core": "0.2.2",
21
- "@openreceive/node": "0.2.2"
20
+ "@openreceive/core": "0.2.3",
21
+ "@openreceive/node": "0.2.3"
22
22
  },
23
23
  "exports": {
24
24
  ".": {