@fun-xyz/fiat-contract 0.36.0 → 0.37.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/dist/{chunk-IUWLHJ37.mjs → chunk-PPYEYBTH.mjs} +7 -7
- package/dist/index.js +11 -11
- package/dist/index.mjs +5 -5
- package/dist/table.d.ts +1 -1
- package/dist/table.js +7 -7
- package/dist/table.mjs +1 -1
- package/dist/types.d.ts +7 -6
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// package.json
|
|
2
|
-
var version = "0.
|
|
2
|
+
var version = "0.37.0";
|
|
3
3
|
|
|
4
4
|
// src/table.ts
|
|
5
5
|
var TABLE_VERSION = version;
|
|
@@ -365,9 +365,9 @@ var TRANSITION_TABLE = {
|
|
|
365
365
|
{
|
|
366
366
|
id: "delivery",
|
|
367
367
|
mode: "AWAIT",
|
|
368
|
-
endpoint: "GET /fiat/
|
|
369
|
-
when: "status is SETTLED and the order is
|
|
370
|
-
note: "The backend decides; the client never infers a
|
|
368
|
+
endpoint: "GET /fiat/delivery/:deliveryId",
|
|
369
|
+
when: "status is SETTLED and the order is a leg of a delivery with more legs after it: the provider paid a deposit address that converts into the destinationAsset",
|
|
370
|
+
note: "The backend decides; the client never infers that a delivery has more legs. It follows this transition when offered, and otherwise treats SETTLED as done."
|
|
371
371
|
},
|
|
372
372
|
{
|
|
373
373
|
id: "retry_payment",
|
|
@@ -397,7 +397,7 @@ var TRANSITION_TABLE = {
|
|
|
397
397
|
"A terminal status may still carry a recovery transition: FAILED + retryable failureReason emits it (FE doc Screen 14); non-retryable emits [].",
|
|
398
398
|
"ON_HOLD is a non-terminal status (resolves to PROCESSING or REFUNDED) \u2014 and is NOT the same thing as the KYC ON_HOLD reason; see the note on that field.",
|
|
399
399
|
"CAPTURE_ORPHANED is non-terminal pending the backend rank map (added from review 2026-08-14).",
|
|
400
|
-
"SETTLED is terminal for the order and ends a direct purchase.
|
|
400
|
+
"SETTLED is terminal for the order and ends a direct purchase. When its delivery has more legs, it carries the delivery transition, and the purchase continues in DELIVERY (GET /fiat/delivery/:deliveryId). The order body itself never describes the conversion.",
|
|
401
401
|
"TODO(open-decision): contract OQ7 \u2014 under/over-payment is the biggest unenumerated branch."
|
|
402
402
|
]
|
|
403
403
|
},
|
|
@@ -411,7 +411,7 @@ var TRANSITION_TABLE = {
|
|
|
411
411
|
{
|
|
412
412
|
id: "poll",
|
|
413
413
|
mode: "AWAIT",
|
|
414
|
-
endpoint: "GET /fiat/
|
|
414
|
+
endpoint: "GET /fiat/delivery/:deliveryId",
|
|
415
415
|
note: "Giving up the poll does not fail the purchase: the backend still finishes the delivery or raises it to support."
|
|
416
416
|
}
|
|
417
417
|
],
|
|
@@ -462,7 +462,7 @@ var DOCUMENTED_ENDPOINTS = [
|
|
|
462
462
|
"POST /fiat/instruments",
|
|
463
463
|
"POST /fiat/orders",
|
|
464
464
|
"GET /fiat/orders/:id",
|
|
465
|
-
"GET /fiat/
|
|
465
|
+
"GET /fiat/delivery/:deliveryId",
|
|
466
466
|
"GET /fiat/orders/:id/instructions",
|
|
467
467
|
"POST /fiat/orders/:id/confirm-payment",
|
|
468
468
|
"POST /fiat/orders/:id/reference",
|
package/dist/index.js
CHANGED
|
@@ -1291,7 +1291,7 @@ var $stepResponse = import_zod.z.union([$providerBoundStepResponse, $blockedStep
|
|
|
1291
1291
|
var FiatStepResponseSchema = $stepResponse;
|
|
1292
1292
|
|
|
1293
1293
|
// package.json
|
|
1294
|
-
var version = "0.
|
|
1294
|
+
var version = "0.37.0";
|
|
1295
1295
|
|
|
1296
1296
|
// src/table.ts
|
|
1297
1297
|
var TABLE_VERSION = version;
|
|
@@ -1657,9 +1657,9 @@ var TRANSITION_TABLE = {
|
|
|
1657
1657
|
{
|
|
1658
1658
|
id: "delivery",
|
|
1659
1659
|
mode: "AWAIT",
|
|
1660
|
-
endpoint: "GET /fiat/
|
|
1661
|
-
when: "status is SETTLED and the order is
|
|
1662
|
-
note: "The backend decides; the client never infers a
|
|
1660
|
+
endpoint: "GET /fiat/delivery/:deliveryId",
|
|
1661
|
+
when: "status is SETTLED and the order is a leg of a delivery with more legs after it: the provider paid a deposit address that converts into the destinationAsset",
|
|
1662
|
+
note: "The backend decides; the client never infers that a delivery has more legs. It follows this transition when offered, and otherwise treats SETTLED as done."
|
|
1663
1663
|
},
|
|
1664
1664
|
{
|
|
1665
1665
|
id: "retry_payment",
|
|
@@ -1689,7 +1689,7 @@ var TRANSITION_TABLE = {
|
|
|
1689
1689
|
"A terminal status may still carry a recovery transition: FAILED + retryable failureReason emits it (FE doc Screen 14); non-retryable emits [].",
|
|
1690
1690
|
"ON_HOLD is a non-terminal status (resolves to PROCESSING or REFUNDED) \u2014 and is NOT the same thing as the KYC ON_HOLD reason; see the note on that field.",
|
|
1691
1691
|
"CAPTURE_ORPHANED is non-terminal pending the backend rank map (added from review 2026-08-14).",
|
|
1692
|
-
"SETTLED is terminal for the order and ends a direct purchase.
|
|
1692
|
+
"SETTLED is terminal for the order and ends a direct purchase. When its delivery has more legs, it carries the delivery transition, and the purchase continues in DELIVERY (GET /fiat/delivery/:deliveryId). The order body itself never describes the conversion.",
|
|
1693
1693
|
"TODO(open-decision): contract OQ7 \u2014 under/over-payment is the biggest unenumerated branch."
|
|
1694
1694
|
]
|
|
1695
1695
|
},
|
|
@@ -1703,7 +1703,7 @@ var TRANSITION_TABLE = {
|
|
|
1703
1703
|
{
|
|
1704
1704
|
id: "poll",
|
|
1705
1705
|
mode: "AWAIT",
|
|
1706
|
-
endpoint: "GET /fiat/
|
|
1706
|
+
endpoint: "GET /fiat/delivery/:deliveryId",
|
|
1707
1707
|
note: "Giving up the poll does not fail the purchase: the backend still finishes the delivery or raises it to support."
|
|
1708
1708
|
}
|
|
1709
1709
|
],
|
|
@@ -1754,7 +1754,7 @@ var DOCUMENTED_ENDPOINTS = [
|
|
|
1754
1754
|
"POST /fiat/instruments",
|
|
1755
1755
|
"POST /fiat/orders",
|
|
1756
1756
|
"GET /fiat/orders/:id",
|
|
1757
|
-
"GET /fiat/
|
|
1757
|
+
"GET /fiat/delivery/:deliveryId",
|
|
1758
1758
|
"GET /fiat/orders/:id/instructions",
|
|
1759
1759
|
"POST /fiat/orders/:id/confirm-payment",
|
|
1760
1760
|
"POST /fiat/orders/:id/reference",
|
|
@@ -1860,7 +1860,7 @@ var FIXTURE_DATA = {
|
|
|
1860
1860
|
"id": "poll",
|
|
1861
1861
|
"mode": "AWAIT",
|
|
1862
1862
|
"poll": {
|
|
1863
|
-
"endpoint": "GET /fiat/
|
|
1863
|
+
"endpoint": "GET /fiat/delivery/dlv_31c",
|
|
1864
1864
|
"intervalMs": 3e3,
|
|
1865
1865
|
"backoffFactor": 1.5,
|
|
1866
1866
|
"maxIntervalMs": 1e4,
|
|
@@ -2451,7 +2451,7 @@ var FIXTURE_DATA = {
|
|
|
2451
2451
|
"id": "delivery",
|
|
2452
2452
|
"mode": "AWAIT",
|
|
2453
2453
|
"poll": {
|
|
2454
|
-
"endpoint": "GET /fiat/
|
|
2454
|
+
"endpoint": "GET /fiat/delivery/dlv_31c",
|
|
2455
2455
|
"intervalMs": 3e3,
|
|
2456
2456
|
"backoffFactor": 1.5,
|
|
2457
2457
|
"maxIntervalMs": 1e4,
|
|
@@ -2771,11 +2771,11 @@ var FIXTURES = [
|
|
|
2771
2771
|
id: "screen-13b-order-settled-converted",
|
|
2772
2772
|
file: "screen-13b-order-settled-converted.json",
|
|
2773
2773
|
source: "CONTRACT_DOC",
|
|
2774
|
-
docRef: "Package README \xA7Delivery \xB7
|
|
2774
|
+
docRef: "Package README \xA7Delivery \xB7 an order at SETTLED whose delivery has more legs",
|
|
2775
2775
|
screen: 13,
|
|
2776
2776
|
stateKey: "ORDER/CREATED",
|
|
2777
2777
|
notes: [
|
|
2778
|
-
"The order body is the fiat leg only, as for a direct order. The backend offers the delivery transition because this order
|
|
2778
|
+
"The order body is the fiat leg only, as for a direct order. The backend offers the delivery transition because the delivery this order belongs to has a crypto conversion leg after it; the client follows it instead of showing success."
|
|
2779
2779
|
]
|
|
2780
2780
|
},
|
|
2781
2781
|
{
|
package/dist/index.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
tableEntry,
|
|
13
13
|
unofferedEndpoints,
|
|
14
14
|
unreachableStates
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-PPYEYBTH.mjs";
|
|
16
16
|
import {
|
|
17
17
|
MOONPAY_ENDPOINTS
|
|
18
18
|
} from "./chunk-TIEGTTFY.mjs";
|
|
@@ -1153,7 +1153,7 @@ var FIXTURE_DATA = {
|
|
|
1153
1153
|
"id": "poll",
|
|
1154
1154
|
"mode": "AWAIT",
|
|
1155
1155
|
"poll": {
|
|
1156
|
-
"endpoint": "GET /fiat/
|
|
1156
|
+
"endpoint": "GET /fiat/delivery/dlv_31c",
|
|
1157
1157
|
"intervalMs": 3e3,
|
|
1158
1158
|
"backoffFactor": 1.5,
|
|
1159
1159
|
"maxIntervalMs": 1e4,
|
|
@@ -1744,7 +1744,7 @@ var FIXTURE_DATA = {
|
|
|
1744
1744
|
"id": "delivery",
|
|
1745
1745
|
"mode": "AWAIT",
|
|
1746
1746
|
"poll": {
|
|
1747
|
-
"endpoint": "GET /fiat/
|
|
1747
|
+
"endpoint": "GET /fiat/delivery/dlv_31c",
|
|
1748
1748
|
"intervalMs": 3e3,
|
|
1749
1749
|
"backoffFactor": 1.5,
|
|
1750
1750
|
"maxIntervalMs": 1e4,
|
|
@@ -2064,11 +2064,11 @@ var FIXTURES = [
|
|
|
2064
2064
|
id: "screen-13b-order-settled-converted",
|
|
2065
2065
|
file: "screen-13b-order-settled-converted.json",
|
|
2066
2066
|
source: "CONTRACT_DOC",
|
|
2067
|
-
docRef: "Package README \xA7Delivery \xB7
|
|
2067
|
+
docRef: "Package README \xA7Delivery \xB7 an order at SETTLED whose delivery has more legs",
|
|
2068
2068
|
screen: 13,
|
|
2069
2069
|
stateKey: "ORDER/CREATED",
|
|
2070
2070
|
notes: [
|
|
2071
|
-
"The order body is the fiat leg only, as for a direct order. The backend offers the delivery transition because this order
|
|
2071
|
+
"The order body is the fiat leg only, as for a direct order. The backend offers the delivery transition because the delivery this order belongs to has a crypto conversion leg after it; the client follows it instead of showing success."
|
|
2072
2072
|
]
|
|
2073
2073
|
},
|
|
2074
2074
|
{
|
package/dist/table.d.ts
CHANGED
|
@@ -94,7 +94,7 @@ export declare const STATE_KEYS: StateKey[];
|
|
|
94
94
|
* named by the table (QUOTE's capture-first entry) while the doc's endpoint table still lists no
|
|
95
95
|
* session-minting call for that rail.
|
|
96
96
|
*/
|
|
97
|
-
export declare const DOCUMENTED_ENDPOINTS: readonly ["GET /fiat/payment-methods", "POST /fiat/quote", "POST /fiat/auth", "POST /fiat/payment-session", "POST /fiat/session", "POST /fiat/session/verify", "GET /fiat/quotes/:quoteRef", "POST /fiat/kyc/form", "POST /fiat/kyc/capture", "POST /fiat/kyc/sdk-token", "POST /fiat/kyc/document", "POST /fiat/instruments", "POST /fiat/orders", "GET /fiat/orders/:id", "GET /fiat/
|
|
97
|
+
export declare const DOCUMENTED_ENDPOINTS: readonly ["GET /fiat/payment-methods", "POST /fiat/quote", "POST /fiat/auth", "POST /fiat/payment-session", "POST /fiat/session", "POST /fiat/session/verify", "GET /fiat/quotes/:quoteRef", "POST /fiat/kyc/form", "POST /fiat/kyc/capture", "POST /fiat/kyc/sdk-token", "POST /fiat/kyc/document", "POST /fiat/instruments", "POST /fiat/orders", "GET /fiat/orders/:id", "GET /fiat/delivery/:deliveryId", "GET /fiat/orders/:id/instructions", "POST /fiat/orders/:id/confirm-payment", "POST /fiat/orders/:id/reference", "POST /fiat/orders/:id/cancel", "POST /fiat/orders/:id/surface-result"];
|
|
98
98
|
/**
|
|
99
99
|
* Documented endpoints no flow state offers, and why. Declared so an endpoint nothing can reach is
|
|
100
100
|
* visible instead of silent — the table test asserts the unoffered set equals exactly these.
|
package/dist/table.js
CHANGED
|
@@ -36,7 +36,7 @@ __export(table_exports, {
|
|
|
36
36
|
module.exports = __toCommonJS(table_exports);
|
|
37
37
|
|
|
38
38
|
// package.json
|
|
39
|
-
var version = "0.
|
|
39
|
+
var version = "0.37.0";
|
|
40
40
|
|
|
41
41
|
// src/table.ts
|
|
42
42
|
var TABLE_VERSION = version;
|
|
@@ -402,9 +402,9 @@ var TRANSITION_TABLE = {
|
|
|
402
402
|
{
|
|
403
403
|
id: "delivery",
|
|
404
404
|
mode: "AWAIT",
|
|
405
|
-
endpoint: "GET /fiat/
|
|
406
|
-
when: "status is SETTLED and the order is
|
|
407
|
-
note: "The backend decides; the client never infers a
|
|
405
|
+
endpoint: "GET /fiat/delivery/:deliveryId",
|
|
406
|
+
when: "status is SETTLED and the order is a leg of a delivery with more legs after it: the provider paid a deposit address that converts into the destinationAsset",
|
|
407
|
+
note: "The backend decides; the client never infers that a delivery has more legs. It follows this transition when offered, and otherwise treats SETTLED as done."
|
|
408
408
|
},
|
|
409
409
|
{
|
|
410
410
|
id: "retry_payment",
|
|
@@ -434,7 +434,7 @@ var TRANSITION_TABLE = {
|
|
|
434
434
|
"A terminal status may still carry a recovery transition: FAILED + retryable failureReason emits it (FE doc Screen 14); non-retryable emits [].",
|
|
435
435
|
"ON_HOLD is a non-terminal status (resolves to PROCESSING or REFUNDED) \u2014 and is NOT the same thing as the KYC ON_HOLD reason; see the note on that field.",
|
|
436
436
|
"CAPTURE_ORPHANED is non-terminal pending the backend rank map (added from review 2026-08-14).",
|
|
437
|
-
"SETTLED is terminal for the order and ends a direct purchase.
|
|
437
|
+
"SETTLED is terminal for the order and ends a direct purchase. When its delivery has more legs, it carries the delivery transition, and the purchase continues in DELIVERY (GET /fiat/delivery/:deliveryId). The order body itself never describes the conversion.",
|
|
438
438
|
"TODO(open-decision): contract OQ7 \u2014 under/over-payment is the biggest unenumerated branch."
|
|
439
439
|
]
|
|
440
440
|
},
|
|
@@ -448,7 +448,7 @@ var TRANSITION_TABLE = {
|
|
|
448
448
|
{
|
|
449
449
|
id: "poll",
|
|
450
450
|
mode: "AWAIT",
|
|
451
|
-
endpoint: "GET /fiat/
|
|
451
|
+
endpoint: "GET /fiat/delivery/:deliveryId",
|
|
452
452
|
note: "Giving up the poll does not fail the purchase: the backend still finishes the delivery or raises it to support."
|
|
453
453
|
}
|
|
454
454
|
],
|
|
@@ -499,7 +499,7 @@ var DOCUMENTED_ENDPOINTS = [
|
|
|
499
499
|
"POST /fiat/instruments",
|
|
500
500
|
"POST /fiat/orders",
|
|
501
501
|
"GET /fiat/orders/:id",
|
|
502
|
-
"GET /fiat/
|
|
502
|
+
"GET /fiat/delivery/:deliveryId",
|
|
503
503
|
"GET /fiat/orders/:id/instructions",
|
|
504
504
|
"POST /fiat/orders/:id/confirm-payment",
|
|
505
505
|
"POST /fiat/orders/:id/reference",
|
package/dist/table.mjs
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -56,7 +56,7 @@ export type HttpVerb = 'GET' | 'POST';
|
|
|
56
56
|
* cannot express "no slash", so `GET /fiat/orders/${string}` also admits sub-paths. Precision at
|
|
57
57
|
* that level is the table's job (`allowedTransitions` + `endpointMatches`), not the type's.
|
|
58
58
|
*/
|
|
59
|
-
export type FiatEndpoint = 'GET /fiat/payment-methods' | 'POST /fiat/quote' | 'POST /fiat/auth' | 'POST /fiat/payment-session' | 'POST /fiat/session' | 'POST /fiat/session/verify' | `GET /fiat/quotes/${string}` | 'POST /fiat/kyc/form' | 'POST /fiat/kyc/capture' | 'POST /fiat/kyc/sdk-token' | 'POST /fiat/kyc/document' | 'POST /fiat/instruments' | 'POST /fiat/orders' | `GET /fiat/orders/${string}` | `GET /fiat/
|
|
59
|
+
export type FiatEndpoint = 'GET /fiat/payment-methods' | 'POST /fiat/quote' | 'POST /fiat/auth' | 'POST /fiat/payment-session' | 'POST /fiat/session' | 'POST /fiat/session/verify' | `GET /fiat/quotes/${string}` | 'POST /fiat/kyc/form' | 'POST /fiat/kyc/capture' | 'POST /fiat/kyc/sdk-token' | 'POST /fiat/kyc/document' | 'POST /fiat/instruments' | 'POST /fiat/orders' | `GET /fiat/orders/${string}` | `GET /fiat/delivery/${string}` | `GET /fiat/orders/${string}/instructions` | `POST /fiat/orders/${string}/confirm-payment` | `POST /fiat/orders/${string}/reference` | `POST /fiat/orders/${string}/cancel` | `POST /fiat/orders/${string}/surface-result`;
|
|
60
60
|
/**
|
|
61
61
|
* Routing metadata, not sequencing policy. Reserved values may be emitted only after their adapter
|
|
62
62
|
* and conformance fixture land.
|
|
@@ -76,9 +76,9 @@ export type FiatProvider = 'TRANSAK' | 'SWAPPED' | 'BANXA' | 'MOONPAY' | 'STRIPE
|
|
|
76
76
|
*/
|
|
77
77
|
export type OrderStatus = 'CREATING' | 'AWAITING_PAYMENT' | 'PAYMENT_VERIFYING' | 'PROCESSING' | 'PENDING_DELIVERY' | 'ON_HOLD' | 'CRYPTO_SENT'
|
|
78
78
|
/**
|
|
79
|
-
* The provider's crypto reached the deposit address. Terminal for the order.
|
|
80
|
-
*
|
|
81
|
-
* transition here, and the purchase continues in `DELIVERY`.
|
|
79
|
+
* The provider's crypto reached the deposit address. Terminal for the order. When the order is one leg
|
|
80
|
+
* of a delivery with more legs after it (a crypto conversion into the `destinationAsset`), it offers
|
|
81
|
+
* the `delivery` transition here, and the purchase continues in `DELIVERY`.
|
|
82
82
|
*/
|
|
83
83
|
| 'SETTLED' | 'EXPIRED' | 'CANCELLED' | 'FAILED' | 'REFUNDED'
|
|
84
84
|
/**
|
|
@@ -684,8 +684,9 @@ export type FlowState =
|
|
|
684
684
|
error?: FailureReason;
|
|
685
685
|
}
|
|
686
686
|
/**
|
|
687
|
-
*
|
|
688
|
-
*
|
|
687
|
+
* A delivery: the purchase as a whole, of which the order is the fiat provider's leg. Read from
|
|
688
|
+
* `GET /fiat/delivery/:deliveryId`, which an `ORDER{CREATED, SETTLED}` offers through its `delivery`
|
|
689
|
+
* transition only when the delivery has legs after the order.
|
|
689
690
|
* `PENDING` polls itself. `SUCCEEDED` carries the transaction that paid the user. `FAILED` means the
|
|
690
691
|
* buyer has paid and the asset did not arrive: support recovers the funds, so the client never offers
|
|
691
692
|
* another payment from it.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fun-xyz/fiat-contract",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"description": "Published conformance contract for Fun's headless fiat onramp: FlowState/Transition types, zod schemas, the transition table as data, recorded fixtures, assertion helpers.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|