@oasisprotocol/privana-sdk 0.5.4 → 0.5.6
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 +28 -19
- package/dist/{chunk-QQG4RPYZ.js → chunk-DLGIPF4N.js} +919 -367
- package/dist/chunk-DLGIPF4N.js.map +1 -0
- package/dist/{chunk-FGWMLLEC.cjs → chunk-TNR7AA52.cjs} +918 -366
- package/dist/chunk-TNR7AA52.cjs.map +1 -0
- package/dist/index.cjs +288 -255
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +7 -6
- package/dist/index.d.ts +7 -6
- package/dist/index.js +47 -14
- package/dist/index.js.map +1 -1
- package/dist/on-ramp.cjs +3 -3
- package/dist/on-ramp.d.cts +81 -52
- package/dist/on-ramp.d.ts +81 -52
- package/dist/on-ramp.js +1 -1
- package/dist/{pending-lock-DSEqUHOw.d.cts → pending-lock-BIMYw4gd.d.cts} +25 -20
- package/dist/{pending-lock-DSEqUHOw.d.ts → pending-lock-BIMYw4gd.d.ts} +25 -20
- package/package.json +1 -1
- package/dist/chunk-FGWMLLEC.cjs.map +0 -1
- package/dist/chunk-QQG4RPYZ.js.map +0 -1
package/README.md
CHANGED
|
@@ -224,7 +224,7 @@ Notes:
|
|
|
224
224
|
| `useBatchBalances` | Get multiple token balances |
|
|
225
225
|
| `useDeposit` | Deposit tokens |
|
|
226
226
|
| `useDepositVerification` | Run checkDeposit + status polling against an existing on-chain transfer (used by `useDeposit` and `useFiatOnRamp`) |
|
|
227
|
-
| `useFiatOnRamp` |
|
|
227
|
+
| `useFiatOnRamp` | MoonPay on-ramp with provider-neutral recovery, verification, credit, and locking (from `/on-ramp` sub-export) |
|
|
228
228
|
| `useWithdraw` | Withdraw tokens |
|
|
229
229
|
| `useLockFunds` | Lock funds for a recipient |
|
|
230
230
|
| `useUnlockFunds` | Unlock expired locks |
|
|
@@ -240,8 +240,13 @@ Notes:
|
|
|
240
240
|
## Fiat On-Ramp
|
|
241
241
|
|
|
242
242
|
The fiat on-ramp lets users buy tokens with a card and have them credited to
|
|
243
|
-
their Privana balance in one flow.
|
|
244
|
-
|
|
243
|
+
their Privana balance in one flow. An internal provider-neutral core owns
|
|
244
|
+
recovery, receipt verification, `/deposits/check`, credit, and optional
|
|
245
|
+
post-credit locking. MoonPay launch and widget behavior live in a thin adapter.
|
|
246
|
+
|
|
247
|
+
**The provider delivers the purchased token directly to the server-derived
|
|
248
|
+
Privana deposit address. Provider orders, amounts, events, and webhooks are
|
|
249
|
+
correlation hints only; the matching on-chain transfer remains authoritative.**
|
|
245
250
|
|
|
246
251
|
Exported from a separate entry point so consumers who don't use the on-ramp
|
|
247
252
|
don't pay the bundle cost of `@moonpay/moonpay-react`:
|
|
@@ -292,15 +297,18 @@ The form:
|
|
|
292
297
|
- sets `externalCustomerId = address.toLowerCase()` so the backend can bind the
|
|
293
298
|
MoonPay transaction to the SIWE-authenticated user,
|
|
294
299
|
- creates a backend on-ramp intent (`POST /onramp/intent`) and passes its id to
|
|
295
|
-
MoonPay as `externalTransactionId`
|
|
300
|
+
MoonPay as `externalTransactionId` for exact authenticated recovery,
|
|
301
|
+
- persists at most ten unresolved signed intents under the authenticated user
|
|
302
|
+
and sends them as repeated `externalTransactionId` values on pending reads,
|
|
296
303
|
- gates the "Buy" button on the configured token's minimum deposit (input-time
|
|
297
304
|
check) and double-checks the delivered amount before triggering verification,
|
|
298
305
|
- on MoonPay's `transaction_created`, fire-and-forget calls
|
|
299
306
|
`POST /onramp/{id}` with the MoonPay transaction id so the backend can
|
|
300
|
-
reconcile both ids
|
|
301
|
-
-
|
|
302
|
-
the
|
|
303
|
-
|
|
307
|
+
reconcile both ids during provider reads,
|
|
308
|
+
- treats MoonPay events as wake-up hints, polls the authenticated pending read
|
|
309
|
+
for the provider transaction and on-chain hash, derives the delivered amount
|
|
310
|
+
from matching receipt logs, then triggers Privana verification
|
|
311
|
+
(`checkDeposit` + status polling).
|
|
304
312
|
|
|
305
313
|
### `useFiatOnRamp` for custom UI
|
|
306
314
|
|
|
@@ -331,29 +339,30 @@ const {
|
|
|
331
339
|
|
|
332
340
|
### Pending / recovery
|
|
333
341
|
|
|
334
|
-
If the user closes
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
verification
|
|
342
|
+
If the user closes or reloads between launch and verification, the SDK reloads
|
|
343
|
+
its bounded signed-intent set and combines exact provider lookups with the
|
|
344
|
+
authenticated derived-wallet lookup. A corrupt local intent is isolated and
|
|
345
|
+
removed without blocking valid recovery. Render `pending` with a "Finish
|
|
346
|
+
verification" CTA that calls `finishPendingVerification(record)` — no wallet
|
|
347
|
+
signature is required for deposit verification.
|
|
339
348
|
|
|
340
349
|
### Required backend endpoints
|
|
341
350
|
|
|
342
351
|
The `useFiatOnRamp` hook + form call:
|
|
343
352
|
|
|
344
353
|
- `POST /v1/accounting/onramp/sign-url` — HMAC-signs the MoonPay widget URL
|
|
345
|
-
- `POST /v1/accounting/onramp/intent` —
|
|
346
|
-
- `POST /v1/accounting/onramp/{transaction_id}` —
|
|
347
|
-
- `GET /v1/accounting/onramp/pending` — completed
|
|
354
|
+
- `POST /v1/accounting/onramp/intent` — mints a signed provider/user/wallet/token/chain/asset intent
|
|
355
|
+
- `POST /v1/accounting/onramp/{transaction_id}` — validates and echoes MoonPay compatibility metadata without becoming order state
|
|
356
|
+
- `GET /v1/accounting/onramp/pending` — bounded provider reads for completed, strictly admitted transactions awaiting verification
|
|
348
357
|
|
|
349
358
|
And the existing deposit verification endpoints:
|
|
350
359
|
|
|
351
360
|
- `POST /v1/accounting/deposits/check`
|
|
352
361
|
- `GET /v1/accounting/deposits/status/{id}`
|
|
353
362
|
|
|
354
|
-
MoonPay
|
|
355
|
-
|
|
356
|
-
|
|
363
|
+
The MoonPay webhook (`POST /v1/accounting/onramp/moonpay/webhook`) is an optional
|
|
364
|
+
verified observability signal. It does not populate order state and is not
|
|
365
|
+
required for recovery or credit.
|
|
357
366
|
|
|
358
367
|
## License
|
|
359
368
|
|