@openreceive/node 0.3.0 → 0.3.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.
@@ -583,13 +583,6 @@ function normalizeFixedFloatStatus(status, emergency, refundTxId) {
583
583
  attention_reason: "provider_reported_emergency"
584
584
  };
585
585
  }
586
- if (emergencyStatuses.includes("MORE") || emergencyStatuses.includes("OVER") || emergencyStatuses.includes("OVERPAID")) {
587
- return {
588
- state: "attention",
589
- attention: true,
590
- attention_reason: "provider_reported_emergency"
591
- };
592
- }
593
586
  return {
594
587
  state: "refund_required",
595
588
  ...refundReason === void 0 ? {} : { refund_reason: refundReason }
@@ -600,9 +593,12 @@ function normalizeFixedFloatStatus(status, emergency, refundTxId) {
600
593
  }
601
594
  function refundReasonFromEmergencyStatuses(statuses) {
602
595
  const less = statuses.includes("LESS");
596
+ const more = statuses.includes("MORE") || statuses.includes("OVER") || statuses.includes("OVERPAID");
603
597
  const expired = statuses.includes("EXPIRED");
604
598
  if (less && expired) return "underpaid_and_late";
599
+ if (more && expired) return "overpaid_and_late";
605
600
  if (less) return "underpaid";
601
+ if (more) return "overpaid";
606
602
  if (expired) return "late_deposit";
607
603
  return void 0;
608
604
  }
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  readLscConnectionsFromEnvironment,
3
3
  redactSecrets
4
- } from "./chunk-6HALOJYF.js";
4
+ } from "./chunk-SDCOJGCF.js";
5
5
 
6
6
  // src/cli.ts
7
7
  import { formatInvalidNwcMessage, NwcUriParseError, parseNwcUri } from "@openreceive/core";
package/dist/index.d.ts CHANGED
@@ -180,10 +180,12 @@ type SwapAvailabilityReason = "provider_unconfigured" | "amount_too_small" | "am
180
180
  type SwapAttentionReason = "provider_completed_without_wallet_settlement" | "provider_order_creation_stale" | "provider_order_creation_failed" | "provider_order_creation_needs_reconcile" | "provider_reported_emergency" | "provider_status_unrecognized" | "provider_order_expires_after_shadow_invoice";
181
181
  /**
182
182
  * Why a swap attempt entered the refund path (`refund_required` → `refunded`).
183
- * Mapped from FixedFloat `emergency.status` (LESS / EXPIRED). Overpay (MORE/OVER)
184
- * goes to `attention`, not here.
183
+ * Mapped from FixedFloat `emergency.status` (LESS / MORE / EXPIRED). An overpay
184
+ * refunds the WHOLE deposit like every other emergency: the payout is a
185
+ * fixed-amount bolt11, so there is nothing to exchange the surplus into and
186
+ * `choice=EXCHANGE` is not a path this client takes.
185
187
  */
186
- type SwapRefundReason = "underpaid" | "late_deposit" | "underpaid_and_late";
188
+ type SwapRefundReason = "underpaid" | "overpaid" | "late_deposit" | "underpaid_and_late" | "overpaid_and_late";
187
189
  interface SwapQuote {
188
190
  readonly pay_amount?: string;
189
191
  readonly minimum_pay_amount?: string;
@@ -239,7 +241,7 @@ interface SwapOrder {
239
241
  readonly attention_reason?: SwapAttentionReason;
240
242
  /**
241
243
  * Why a refund is needed, when the attempt is on the refund path. Mapped from
242
- * FixedFloat `emergency.status` (LESS / EXPIRED).
244
+ * FixedFloat `emergency.status` (LESS / MORE / EXPIRED).
243
245
  */
244
246
  readonly refund_reason?: SwapRefundReason;
245
247
  /**
@@ -759,7 +761,7 @@ interface CreateConsoleLoggerOptions {
759
761
  }
760
762
  type AppConsoleLogger = (event: string, message: string, fields?: Record<string, unknown>, level?: LogLevel) => void;
761
763
  interface CreateAppConsoleLoggerOptions {
762
- /** Prefix before the event, e.g. `hello-fruit:node-express:server`. */
764
+ /** Prefix before the event, e.g. `buttons:node-express:server`. */
763
765
  readonly prefix: string;
764
766
  /**
765
767
  * Minimum level to emit. Default: `LOG_LEVEL` from the environment, or `info`.
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  sanitizeEvent,
13
13
  summarizeSwapProviderApiRequest,
14
14
  summarizeSwapProviderApiResponse
15
- } from "./chunk-6HALOJYF.js";
15
+ } from "./chunk-SDCOJGCF.js";
16
16
 
17
17
  // src/index.ts
18
18
  import { OpenReceiveError as OpenReceiveError4 } from "@openreceive/core";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openreceive/node",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "The OpenReceive Node service: receive-only NWC wallet client, checkout and swap service, pricing, and the openreceive CLI.",
5
5
  "keywords": [
6
6
  "bitcoin",
@@ -17,7 +17,7 @@
17
17
  "types": "./dist/index.d.ts",
18
18
  "dependencies": {
19
19
  "@getalby/sdk": "^8.0.3",
20
- "@openreceive/core": "0.3.0"
20
+ "@openreceive/core": "0.3.2"
21
21
  },
22
22
  "bin": {
23
23
  "openreceive": "./bin/openreceive.mjs"