@profullstack/coinpay 0.11.1 → 0.12.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/src/x402.js CHANGED
@@ -2,8 +2,12 @@
2
2
  * x402 Payment Protocol Support
3
3
  *
4
4
  * CoinPayPortal as the first multi-chain, multi-asset x402 facilitator.
5
- * Supports native crypto (BTC, ETH, SOL, POL, BCH), USDC stablecoins,
5
+ * Supports native crypto (BTC, ETH, SOL, POL), USDC stablecoins,
6
6
  * Lightning (BOLT12), and Stripe fiat — all via HTTP 402.
7
+ *
8
+ * Note: Bitcoin Cash is intentionally not listed. The x402 settle path has no
9
+ * verified BCH lookup wired up (see /api/x402/settle), so advertising BCH in
10
+ * `accepts` would offer a rail no payment can complete on.
7
11
  *
8
12
  * @module x402
9
13
  */
@@ -25,13 +29,8 @@ export const PAYMENT_METHODS = {
25
29
  decimals: 8,
26
30
  label: 'Bitcoin',
27
31
  },
28
- bch: {
29
- network: 'bitcoin-cash',
30
- asset: 'BCH',
31
- scheme: 'exact',
32
- decimals: 8,
33
- label: 'Bitcoin Cash',
34
- },
32
+ // BCH intentionally omitted: the x402 settle route refuses bitcoin-cash
33
+ // ("no verified lookup wired up"), so it must not appear in `accepts`.
35
34
  eth: {
36
35
  network: 'ethereum',
37
36
  asset: 'ETH',
@@ -98,7 +97,11 @@ export const PAYMENT_METHODS = {
98
97
  network: 'lightning',
99
98
  asset: 'BTC',
100
99
  scheme: 'bolt12',
101
- decimals: 0, // sats
100
+ // Millisats: 10^11 per BTC. The verifier checks `expected.amount` in
101
+ // millisats (see /api/x402/verify), so the quoted amount must be in the
102
+ // same unit — quoting in sats rounded sub-sat USD values to "0" and made
103
+ // the amount check vacuous.
104
+ decimals: 11,
102
105
  label: 'Lightning (BOLT12)',
103
106
  },
104
107
 
@@ -326,7 +329,6 @@ function _networkToMethodKey(network) {
326
329
  polygon: 'pol',
327
330
  solana: 'sol',
328
331
  bitcoin: 'btc',
329
- 'bitcoin-cash': 'bch',
330
332
  lightning: 'lightning',
331
333
  stripe: 'stripe',
332
334
  };