@openreceive/http 0.4.10 → 0.4.12
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 +4 -2
- package/dist/{adapter-surface-DHngkTKQ.d.ts → adapter-surface-Cs4g29Ez.d.ts} +95 -54
- package/dist/adapter-surface.d.ts +1 -1
- package/dist/adapter-surface.js +1 -1
- package/dist/{chunk-TJY2HBVU.js → chunk-PGZAFYN6.js} +440 -88
- package/dist/index.d.ts +11 -8
- package/dist/index.js +1 -1
- package/package.json +3 -3
- package/skills/integrate-openreceive/SKILL.md +4 -3
- package/skills/integrate-openreceive/references/btcpay.md +67 -36
- package/skills/integrate-openreceive/references/django.md +291 -244
- package/skills/integrate-openreceive/references/fastapi.md +206 -155
- package/skills/integrate-openreceive/references/fastify.md +200 -147
- package/skills/integrate-openreceive/references/laravel.md +294 -234
- package/skills/integrate-openreceive/references/next.md +210 -162
- package/skills/integrate-openreceive/references/node.md +188 -138
- package/skills/integrate-openreceive/references/php.md +248 -193
- package/skills/integrate-openreceive/references/rails.md +262 -218
- package/skills/integrate-openreceive/references/woocommerce.md +68 -51
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenReceive, PaymentCheck } from '@openreceive/node';
|
|
2
2
|
export { Checkout, CreateCheckoutAmount, OpenReceive, PaymentCheck, SwapCheckout } from '@openreceive/node';
|
|
3
|
-
import { H as Host, R as ReconcilableAttempt, S as SqlAdapter } from './adapter-surface-
|
|
4
|
-
export { A as AttemptStatus, a as Authorize, b as AuthorizeAction, c as AuthorizeContext, d as AuthorizeResource, C as CheckoutCreatedHook, e as CheckoutCreatedInput, f as CreateHostDbOptions, g as CreateHostOptions, h as CreateHostRepositoryOptions, i as CreateHttpHandlerOptions, j as CreateStackOptions, k as HostCheckoutPrice, l as HostError, m as HttpError, n as HttpHandler, I as IpRateLimitConfig, N as NotificationListener, o as NotificationWorker, O as OPENRECEIVE_RECONCILE_BATCH_SIZE, P as PaymentInsert, p as PaymentRecord, q as
|
|
3
|
+
import { H as Host, R as ReconcilableAttempt, S as SqlAdapter } from './adapter-surface-Cs4g29Ez.js';
|
|
4
|
+
export { A as AttemptStatus, a as Authorize, b as AuthorizeAction, c as AuthorizeContext, d as AuthorizeResource, C as CheckoutCreatedHook, e as CheckoutCreatedInput, f as CreateHostDbOptions, g as CreateHostOptions, h as CreateHostRepositoryOptions, i as CreateHttpHandlerOptions, j as CreateStackOptions, k as HostCheckoutPrice, l as HostError, m as HttpError, n as HttpHandler, I as IpRateLimitConfig, N as NotificationListener, o as NotificationWorker, O as OPENRECEIVE_RECONCILE_BATCH_SIZE, P as PaymentInsert, p as PaymentRecord, q as PaymentRepairCandidate, r as PaymentRepository, s as PaymentSettlement, t as PaymentSettlementHook, u as RateLimit, v as ReconcileCursor, w as ReconcileGateClaim, x as ReconcileScheduler, y as ReconciliationTransition, z as ResolveCheckoutContext, B as ResolveCheckoutHook, D as ResolvedHostCheckout, E as ServiceErrorShape, F as SettlementContext, G as SettlementEvent, J as SettlementEventHook, K as SettlementRecord, L as SqlClient, M as SqlDatabase, Q as SqlPaymentRepository, T as SqlPaymentsOptions, U as SqlQuery, V as Stack, W as StackStorage, X as StackWallet, Y as createHost, Z as createHttpHandler, _ as createIpRateLimit, $ as createProxyRateLimitingConfig, a0 as createRequestId, a1 as createSqlPayments, a2 as createStack, a3 as errorResponse, a4 as hostError, a5 as isServiceErrorShape, a6 as isStackOptions, a7 as jsonResponse, a8 as mapHostRouteError, a9 as paymentsSchemaSql, aa as resolveClientIp, ab as startNotificationListener, ac as startNotificationWorker } from './adapter-surface-Cs4g29Ez.js';
|
|
5
5
|
export { OPENRECEIVE_ATTEMPT_EXPIRY_GRACE_SECONDS, OPENRECEIVE_PAYMENTS_SCHEMA_VERSION } from '@openreceive/core';
|
|
6
6
|
|
|
7
7
|
/** The pieces of a framework request the bridge needs, framework-agnostic. */
|
|
@@ -255,6 +255,8 @@ declare function reconcileHostPayments(input: {
|
|
|
255
255
|
* which is the request path.
|
|
256
256
|
*/
|
|
257
257
|
readonly attempts?: readonly ReconcilableAttempt[];
|
|
258
|
+
/** Results from the gate-owned bounded slice; no additional wallet walk. */
|
|
259
|
+
readonly checks?: readonly PaymentCheck[];
|
|
258
260
|
}): Promise<readonly PaymentCheck[]>;
|
|
259
261
|
/**
|
|
260
262
|
* Poll and reconcile only the pending attempts in the ledger. Every pass goes
|
|
@@ -341,18 +343,19 @@ type SqlDialect = SqlAdapter["dialect"];
|
|
|
341
343
|
/** The raw-query slice of a Knex instance or transaction. */
|
|
342
344
|
interface KnexExecutorLike {
|
|
343
345
|
raw(sql: string, bindings: readonly unknown[]): Promise<unknown>;
|
|
346
|
+
client?: {
|
|
347
|
+
acquireConnection(): Promise<unknown>;
|
|
348
|
+
releaseConnection(connection: unknown): Promise<unknown>;
|
|
349
|
+
};
|
|
344
350
|
}
|
|
345
351
|
/** Structural view of a Knex instance. */
|
|
346
352
|
interface KnexLike extends KnexExecutorLike {
|
|
347
353
|
transaction<T>(run: (trx: KnexExecutorLike) => Promise<T>): Promise<T>;
|
|
348
354
|
}
|
|
349
355
|
/**
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
* driver. The sqlite3 driver resolves the rows array itself; pg wraps them in
|
|
354
|
-
* `{ rows }` — reaching into `result[0]` would return the first ROW on
|
|
355
|
-
* sqlite, which breaks every repository read.
|
|
356
|
+
* PostgreSQL SQL goes directly to the native driver, on the owning executor's
|
|
357
|
+
* connection. A transaction executor returns its own connection and retains it
|
|
358
|
+
* until commit/rollback. SQLite keeps Knex's raw-query path.
|
|
356
359
|
*/
|
|
357
360
|
declare function knexDb(knex: KnexLike, dialect: SqlDialect): SqlAdapter;
|
|
358
361
|
/** The raw-query slice of a PrismaClient or interactive-transaction client. */
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openreceive/http",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.12",
|
|
4
4
|
"description": "Node.js HTTP routes and payment storage for Bitcoin Lightning checkout, with optional USDT, USDC, SOL and ETH swaps.",
|
|
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.4.
|
|
21
|
-
"@openreceive/node": "0.4.
|
|
20
|
+
"@openreceive/core": "0.4.12",
|
|
21
|
+
"@openreceive/node": "0.4.12"
|
|
22
22
|
},
|
|
23
23
|
"exports": {
|
|
24
24
|
".": {
|
|
@@ -34,9 +34,10 @@ code** (`NWC_URI`).
|
|
|
34
34
|
- BTCPay Server: [references/btcpay.md](references/btcpay.md) — a plugin,
|
|
35
35
|
configured in BTCPay's store UI or Greenfield API; no application code,
|
|
36
36
|
no npm packages, no gem. The rest of this file is about the library.
|
|
37
|
-
3. Follow its **Step 0** first:
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
3. Follow its **Step 0** first: before writing code or searching the machine,
|
|
38
|
+
ask the user for the receive-only NWC code (then the swap URI), one question
|
|
39
|
+
per message, and store each pasted code in the project's env file yourself.
|
|
40
|
+
Never print the value; never invent a placeholder.
|
|
40
41
|
|
|
41
42
|
Install, per adapter — Express: `npm install @openreceive/express @openreceive/react`;
|
|
42
43
|
Fastify: `npm install @openreceive/fastify @openreceive/react`; Next.js:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# OpenReceive agent directions (BTCPay Server)
|
|
2
2
|
|
|
3
|
-
These directions describe OpenReceive 0.4.
|
|
3
|
+
These directions describe OpenReceive 0.4.12.
|
|
4
4
|
|
|
5
5
|
Connect a BTCPay Server store to a receive-only NWC wallet with the OpenReceive
|
|
6
6
|
plugin, and optionally let payers pay BTCPay invoices with USDT, USDC, ETH or
|
|
@@ -35,10 +35,12 @@ refund path on the same checkout screen.
|
|
|
35
35
|
1. Confirm the BTCPay Server version is 2.4.4 or later (Server Settings →
|
|
36
36
|
About, or `GET /api/v1/server/info`). The plugin declares that minimum and
|
|
37
37
|
BTCPay refuses to load it below.
|
|
38
|
-
2. Check whether the plugin is installed (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
2. Check whether the plugin is installed (the Plugins menu — the plug icon in
|
|
39
|
+
the top-right corner — under Installed Plugins, or the store navigation
|
|
40
|
+
shows an "OpenReceive" entry). If not, install it from the BTCPay plugin
|
|
41
|
+
directory (the same Plugins menu → Plugin Directory, search "openreceive",
|
|
42
|
+
then Install and Restart now), as the quickstart says; do not invent an
|
|
43
|
+
installer command.
|
|
42
44
|
3. Check whether the store already has an OpenReceive connection:
|
|
43
45
|
`GET /api/v1/stores/{storeId}/openreceive/settings` returns
|
|
44
46
|
`lightningNodeIsOpenReceive`. If true, the wallet step is done — go to
|
|
@@ -119,6 +121,8 @@ enough; drop the `.md` for the same page a person would read.
|
|
|
119
121
|
Questions, or a problem with the plugin itself:
|
|
120
122
|
https://openreceive.org/contact
|
|
121
123
|
|
|
124
|
+
- https://openreceive.org/guides/payment-safety-upgrade.md — coordinated upgrades and reviewed repair of existing attempts
|
|
125
|
+
|
|
122
126
|
---
|
|
123
127
|
|
|
124
128
|
## The quickstart, in full
|
|
@@ -131,15 +135,15 @@ passes. The page it comes from is https://openreceive.org/guides/quickstart-btcp
|
|
|
131
135
|
Requires BTCPay Server ≥ 2.4.4.
|
|
132
136
|
|
|
133
137
|
The OpenReceive plugin makes a receive-only NWC wallet the Lightning node of a
|
|
134
|
-
BTCPay store. BTCPay
|
|
135
|
-
payments
|
|
136
|
-
BTCPay invoice with USDT, USDC, ETH or SOL through a Lightning Swap Connect
|
|
137
|
-
provider
|
|
138
|
+
BTCPay store. BTCPay creates every Lightning invoice in that wallet. It records
|
|
139
|
+
payments the same way it records any other payment. You can also let payers pay
|
|
140
|
+
a BTCPay invoice with USDT, USDC, ETH or SOL through a Lightning Swap Connect
|
|
141
|
+
provider. The swap pays into the same wallet. The store's internal node is
|
|
138
142
|
never used.
|
|
139
143
|
|
|
140
144
|
This is not the Node or Rails library. There are no hooks, no
|
|
141
|
-
`openreceive_payments` table and no OpenReceive HTTP routes
|
|
142
|
-
invoices, checkout, webhooks and Greenfield API
|
|
145
|
+
`openreceive_payments` table and no OpenReceive HTTP routes. BTCPay's own
|
|
146
|
+
invoices, checkout, webhooks and Greenfield API do that work.
|
|
143
147
|
|
|
144
148
|
### 1. Prerequisites
|
|
145
149
|
|
|
@@ -155,39 +159,66 @@ invoices, checkout, webhooks and Greenfield API are the host.
|
|
|
155
159
|
|
|
156
160
|
### 2. Install the plugin
|
|
157
161
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
162
|
+
Sign in as a **server administrator**. If someone else hosts your server, ask
|
|
163
|
+
them to install the plugin for you.
|
|
164
|
+
|
|
165
|
+
**1. Open the Plugins menu.** It is the plug icon in the top-right corner.
|
|
166
|
+
|
|
167
|
+
**2. Click Plugin Directory.**
|
|
168
|
+
|
|
169
|
+
**3. Search for `openreceive`** and click the **OpenReceive** result.
|
|
170
|
+
|
|
171
|
+
**4. Click Install in BTCPay Server.** Confirm when prompted, then click
|
|
172
|
+
**Restart now** and wait for BTCPay to come back.
|
|
173
|
+
|
|
174
|
+
At startup, BTCPay creates the plugin's two tables in its own Postgres
|
|
175
|
+
database: `openreceive_invoices` and `openreceive_swaps`, in the schema
|
|
176
|
+
`BTCPayServer.Plugins.OpenReceive`. Nothing else is created.
|
|
163
177
|
|
|
164
178
|
To build the plugin from source instead, follow
|
|
165
179
|
[the .NET workspace README](https://github.com/OpenReceive/openreceive/blob/master/packages/dotnet/README.md).
|
|
166
180
|
|
|
167
181
|
### 3. Connect the wallet
|
|
168
182
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
node.
|
|
183
|
+
1. Select your store and open **OpenReceive** in its sidebar, under Wallets.
|
|
184
|
+
2. Paste your receive-only NWC code. To see what the wallet supports first,
|
|
185
|
+
click **Test connection**.
|
|
186
|
+
3. Click **Save NWC Code**.
|
|
187
|
+
4. To turn swaps on, paste a Lightning Swap Connect code and click **Save swap
|
|
188
|
+
settings**.
|
|
176
189
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
190
|
+
The page then shows **Wallet connected**. If you set up a provider, it also
|
|
191
|
+
shows **Swaps on**. There is nothing else to configure. You never open BTCPay's
|
|
192
|
+
Lightning node screen, and the plugin never reads the internal node.
|
|
193
|
+
|
|
194
|
+
Screenshots for each of those steps, and for creating a first test invoice,
|
|
195
|
+
are in the plugin's
|
|
196
|
+
[README](https://github.com/OpenReceive/openreceive/blob/master/packages/dotnet/BTCPayServer.Plugins.OpenReceive/README.md).
|
|
197
|
+
|
|
198
|
+
The plugin refuses to save a code whose wallet advertises a spend method such
|
|
199
|
+
as `pay_invoice`. Create a receive-only code instead. If your wallet cannot
|
|
200
|
+
make one, there is an override, but using it is a deliberate choice and the
|
|
201
|
+
plugin logs it.
|
|
202
|
+
|
|
203
|
+
Turning swaps on raises the store's invoice expiration to 60 minutes if it is
|
|
204
|
+
shorter. A swap needs the invoice to stay open for at least 45 minutes.
|
|
182
205
|
|
|
183
206
|
### 4. Check it
|
|
184
207
|
|
|
185
|
-
**Run a health check** on the OpenReceive page runs every
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
208
|
+
Click **Run a health check** on the OpenReceive page. It runs every check
|
|
209
|
+
right there:
|
|
210
|
+
|
|
211
|
+
- the connection
|
|
212
|
+
- the wallet preflight
|
|
213
|
+
- payment notifications
|
|
214
|
+
- the last wallet scan
|
|
215
|
+
- the swap provider and its assets
|
|
216
|
+
- the invoice expiration
|
|
217
|
+
- swaps that need a human
|
|
218
|
+
|
|
219
|
+
Each failing check comes with a link to the fix.
|
|
189
220
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
`nostr+walletconnect://` string in BTCPay's Lightning node screen.
|
|
221
|
+
The [BTCPay plugin reference](https://openreceive.org/guides/btcpay-reference.md) lists every setting,
|
|
222
|
+
Greenfield route, swap state, log event and check. It also lists what the
|
|
223
|
+
plugin does not support by design: every send-side feature, top-up invoices,
|
|
224
|
+
and a bare `nostr+walletconnect://` string in BTCPay's Lightning node screen.
|