@fun-xyz/fiat-contract 0.36.0-uda.0 → 0.36.0-uda.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.
- package/dist/{chunk-PWC3WN74.mjs → chunk-7GDFZ5UR.mjs} +3 -4
- package/dist/index.js +16 -6
- package/dist/index.mjs +14 -3
- package/dist/providers/moonpay.d.ts +4 -1
- package/dist/routing.d.ts +21 -1
- package/dist/schemas.d.ts +3 -1
- package/dist/table.d.ts +1 -1
- package/dist/table.js +3 -4
- package/dist/table.mjs +1 -1
- package/dist/types.d.ts +22 -8
- package/package.json +1 -1
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
// package.json
|
|
2
|
-
var version = "0.36.0-uda.
|
|
2
|
+
var version = "0.36.0-uda.2";
|
|
3
3
|
|
|
4
4
|
// src/table.ts
|
|
5
5
|
var TABLE_VERSION = version;
|
|
6
6
|
var TERMINAL_ORDER_STATUSES = [
|
|
7
7
|
"SETTLED",
|
|
8
|
-
"FINAL_ASSET_DELIVERED",
|
|
9
8
|
"EXPIRED",
|
|
10
9
|
"CANCELLED",
|
|
11
10
|
"FAILED",
|
|
@@ -360,7 +359,7 @@ var TRANSITION_TABLE = {
|
|
|
360
359
|
id: "poll",
|
|
361
360
|
mode: "AWAIT",
|
|
362
361
|
endpoint: "GET /fiat/orders/:id",
|
|
363
|
-
when: "status is non-terminal",
|
|
362
|
+
when: "status is non-terminal, or delivery.state is SWAPPING",
|
|
364
363
|
note: "Documented giveUpAfterMs 300000 \u2014 on give-up the wizard exits and the durable order takes over."
|
|
365
364
|
},
|
|
366
365
|
{
|
|
@@ -391,7 +390,7 @@ var TRANSITION_TABLE = {
|
|
|
391
390
|
"A terminal status may still carry a recovery transition: FAILED + retryable failureReason emits it (FE doc Screen 14); non-retryable emits [].",
|
|
392
391
|
"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.",
|
|
393
392
|
"CAPTURE_ORPHANED is non-terminal pending the backend rank map (added from review 2026-08-14).",
|
|
394
|
-
"
|
|
393
|
+
"SETTLED is terminal for the order. When delivery.mode is CONVERTED, the conversion into the destination may still run after SETTLED: the backend keeps offering the AWAIT poll while delivery.state is SWAPPING, and the client keeps polling until delivery.state is DELIVERED or FAILED.",
|
|
395
394
|
"TODO(open-decision): contract OQ7 \u2014 under/over-payment is the biggest unenumerated branch."
|
|
396
395
|
]
|
|
397
396
|
}
|
package/dist/index.js
CHANGED
|
@@ -45,6 +45,8 @@ __export(index_exports, {
|
|
|
45
45
|
FiatEndpointSchema: () => FiatEndpointSchema,
|
|
46
46
|
FiatGeoSchema: () => FiatGeoSchema,
|
|
47
47
|
FiatNextRequestSchema: () => FiatNextRequestSchema,
|
|
48
|
+
FiatOrderDeliverySchema: () => FiatOrderDeliverySchema,
|
|
49
|
+
FiatOrderDeliveryStateSchema: () => FiatOrderDeliveryStateSchema,
|
|
48
50
|
FiatProviderSchema: () => FiatProviderSchema,
|
|
49
51
|
FiatRoutingQuoteErrorBodySchema: () => FiatRoutingQuoteErrorBodySchema,
|
|
50
52
|
FiatRoutingQuoteRequestSchema: () => FiatRoutingQuoteRequestSchema,
|
|
@@ -539,7 +541,6 @@ var $orderStatus = import_zod.z.enum([
|
|
|
539
541
|
"ON_HOLD",
|
|
540
542
|
"CRYPTO_SENT",
|
|
541
543
|
"SETTLED",
|
|
542
|
-
"FINAL_ASSET_DELIVERED",
|
|
543
544
|
"EXPIRED",
|
|
544
545
|
"CANCELLED",
|
|
545
546
|
"FAILED",
|
|
@@ -625,6 +626,13 @@ var $statusHistoryEntry = obj({ status: $orderStatus });
|
|
|
625
626
|
var StatusHistoryEntrySchema = $statusHistoryEntry;
|
|
626
627
|
var $tx = obj({ chainId: import_zod.z.number(), hash: import_zod.z.string() });
|
|
627
628
|
var TxSchema = $tx;
|
|
629
|
+
var $orderDeliveryState = import_zod.z.enum(["SWAPPING", "DELIVERED", "FAILED"]);
|
|
630
|
+
var FiatOrderDeliveryStateSchema = $orderDeliveryState;
|
|
631
|
+
var $orderDelivery = import_zod.z.discriminatedUnion("mode", [
|
|
632
|
+
obj({ mode: import_zod.z.literal("DIRECT") }),
|
|
633
|
+
obj({ mode: import_zod.z.literal("CONVERTED"), state: $orderDeliveryState, finalTxHash: import_zod.z.string().min(1).nullable() })
|
|
634
|
+
]);
|
|
635
|
+
var FiatOrderDeliverySchema = $orderDelivery;
|
|
628
636
|
var $refund = obj({
|
|
629
637
|
currency: import_zod.z.enum(FIAT_CURRENCY_CODES),
|
|
630
638
|
amount: import_zod.z.string(),
|
|
@@ -1001,6 +1009,7 @@ var $orderCreatedState = obj({
|
|
|
1001
1009
|
status: $orderStatus,
|
|
1002
1010
|
statusHistory: import_zod.z.array($statusHistoryEntry).optional(),
|
|
1003
1011
|
tx: $tx.optional(),
|
|
1012
|
+
delivery: $orderDelivery.optional(),
|
|
1004
1013
|
refund: $refund.optional(),
|
|
1005
1014
|
failureReason: $failureReason.optional(),
|
|
1006
1015
|
error: $failureReason.optional()
|
|
@@ -1098,7 +1107,9 @@ var $routingTableProvider = obj({
|
|
|
1098
1107
|
provider: $routingProvider,
|
|
1099
1108
|
next: import_zod.z.enum(["READY", "AUTH", "DECLARATIVE_KYC", "DOCUMENTARY_KYC", "PENDING_REVIEW"]),
|
|
1100
1109
|
visibility: import_zod.z.enum(["COMPLETE", "PARTIAL", "AUTH_GATED"]),
|
|
1101
|
-
currentLimit: $decimalAmount.nullable()
|
|
1110
|
+
currentLimit: $decimalAmount.nullable(),
|
|
1111
|
+
railAsset: $destination.optional(),
|
|
1112
|
+
deliveryMode: import_zod.z.enum(["DIRECT", "CONVERTED"]).optional()
|
|
1102
1113
|
});
|
|
1103
1114
|
var $routingTableInterval = obj({
|
|
1104
1115
|
min: $decimalAmount,
|
|
@@ -1254,13 +1265,12 @@ var $stepResponse = import_zod.z.union([$providerBoundStepResponse, $blockedStep
|
|
|
1254
1265
|
var FiatStepResponseSchema = $stepResponse;
|
|
1255
1266
|
|
|
1256
1267
|
// package.json
|
|
1257
|
-
var version = "0.36.0-uda.
|
|
1268
|
+
var version = "0.36.0-uda.2";
|
|
1258
1269
|
|
|
1259
1270
|
// src/table.ts
|
|
1260
1271
|
var TABLE_VERSION = version;
|
|
1261
1272
|
var TERMINAL_ORDER_STATUSES = [
|
|
1262
1273
|
"SETTLED",
|
|
1263
|
-
"FINAL_ASSET_DELIVERED",
|
|
1264
1274
|
"EXPIRED",
|
|
1265
1275
|
"CANCELLED",
|
|
1266
1276
|
"FAILED",
|
|
@@ -1615,7 +1625,7 @@ var TRANSITION_TABLE = {
|
|
|
1615
1625
|
id: "poll",
|
|
1616
1626
|
mode: "AWAIT",
|
|
1617
1627
|
endpoint: "GET /fiat/orders/:id",
|
|
1618
|
-
when: "status is non-terminal",
|
|
1628
|
+
when: "status is non-terminal, or delivery.state is SWAPPING",
|
|
1619
1629
|
note: "Documented giveUpAfterMs 300000 \u2014 on give-up the wizard exits and the durable order takes over."
|
|
1620
1630
|
},
|
|
1621
1631
|
{
|
|
@@ -1646,7 +1656,7 @@ var TRANSITION_TABLE = {
|
|
|
1646
1656
|
"A terminal status may still carry a recovery transition: FAILED + retryable failureReason emits it (FE doc Screen 14); non-retryable emits [].",
|
|
1647
1657
|
"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.",
|
|
1648
1658
|
"CAPTURE_ORPHANED is non-terminal pending the backend rank map (added from review 2026-08-14).",
|
|
1649
|
-
"
|
|
1659
|
+
"SETTLED is terminal for the order. When delivery.mode is CONVERTED, the conversion into the destination may still run after SETTLED: the backend keeps offering the AWAIT poll while delivery.state is SWAPPING, and the client keeps polling until delivery.state is DELIVERED or FAILED.",
|
|
1650
1660
|
"TODO(open-decision): contract OQ7 \u2014 under/over-payment is the biggest unenumerated branch."
|
|
1651
1661
|
]
|
|
1652
1662
|
}
|
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-7GDFZ5UR.mjs";
|
|
16
16
|
import {
|
|
17
17
|
MOONPAY_ENDPOINTS
|
|
18
18
|
} from "./chunk-TIEGTTFY.mjs";
|
|
@@ -390,7 +390,6 @@ var $orderStatus = z.enum([
|
|
|
390
390
|
"ON_HOLD",
|
|
391
391
|
"CRYPTO_SENT",
|
|
392
392
|
"SETTLED",
|
|
393
|
-
"FINAL_ASSET_DELIVERED",
|
|
394
393
|
"EXPIRED",
|
|
395
394
|
"CANCELLED",
|
|
396
395
|
"FAILED",
|
|
@@ -476,6 +475,13 @@ var $statusHistoryEntry = obj({ status: $orderStatus });
|
|
|
476
475
|
var StatusHistoryEntrySchema = $statusHistoryEntry;
|
|
477
476
|
var $tx = obj({ chainId: z.number(), hash: z.string() });
|
|
478
477
|
var TxSchema = $tx;
|
|
478
|
+
var $orderDeliveryState = z.enum(["SWAPPING", "DELIVERED", "FAILED"]);
|
|
479
|
+
var FiatOrderDeliveryStateSchema = $orderDeliveryState;
|
|
480
|
+
var $orderDelivery = z.discriminatedUnion("mode", [
|
|
481
|
+
obj({ mode: z.literal("DIRECT") }),
|
|
482
|
+
obj({ mode: z.literal("CONVERTED"), state: $orderDeliveryState, finalTxHash: z.string().min(1).nullable() })
|
|
483
|
+
]);
|
|
484
|
+
var FiatOrderDeliverySchema = $orderDelivery;
|
|
479
485
|
var $refund = obj({
|
|
480
486
|
currency: z.enum(FIAT_CURRENCY_CODES),
|
|
481
487
|
amount: z.string(),
|
|
@@ -852,6 +858,7 @@ var $orderCreatedState = obj({
|
|
|
852
858
|
status: $orderStatus,
|
|
853
859
|
statusHistory: z.array($statusHistoryEntry).optional(),
|
|
854
860
|
tx: $tx.optional(),
|
|
861
|
+
delivery: $orderDelivery.optional(),
|
|
855
862
|
refund: $refund.optional(),
|
|
856
863
|
failureReason: $failureReason.optional(),
|
|
857
864
|
error: $failureReason.optional()
|
|
@@ -949,7 +956,9 @@ var $routingTableProvider = obj({
|
|
|
949
956
|
provider: $routingProvider,
|
|
950
957
|
next: z.enum(["READY", "AUTH", "DECLARATIVE_KYC", "DOCUMENTARY_KYC", "PENDING_REVIEW"]),
|
|
951
958
|
visibility: z.enum(["COMPLETE", "PARTIAL", "AUTH_GATED"]),
|
|
952
|
-
currentLimit: $decimalAmount.nullable()
|
|
959
|
+
currentLimit: $decimalAmount.nullable(),
|
|
960
|
+
railAsset: $destination.optional(),
|
|
961
|
+
deliveryMode: z.enum(["DIRECT", "CONVERTED"]).optional()
|
|
953
962
|
});
|
|
954
963
|
var $routingTableInterval = obj({
|
|
955
964
|
min: $decimalAmount,
|
|
@@ -2393,6 +2402,8 @@ export {
|
|
|
2393
2402
|
FiatEndpointSchema,
|
|
2394
2403
|
FiatGeoSchema,
|
|
2395
2404
|
FiatNextRequestSchema,
|
|
2405
|
+
FiatOrderDeliverySchema,
|
|
2406
|
+
FiatOrderDeliveryStateSchema,
|
|
2396
2407
|
FiatProviderSchema,
|
|
2397
2408
|
FiatRoutingQuoteErrorBodySchema,
|
|
2398
2409
|
FiatRoutingQuoteRequestSchema,
|
|
@@ -250,7 +250,10 @@ export type MoonPayStepRefusal = 'NOT_ELIGIBLE' | 'DOCUMENTS_REQUIRED' | 'FINAL_
|
|
|
250
250
|
*/
|
|
251
251
|
export type MoonPayOrderRefusal = 'CUSTOMER_MISMATCH' | 'WALLET_MISMATCH' | 'UNRECORDABLE';
|
|
252
252
|
export type MoonPayNextAction = MoonPayConsentNextAction | MoonPaySessionNextAction | MoonPayConnectNextAction | MoonPayKycNextAction | MoonPayPrepareCaptureNextAction | MoonPayCaptureNextAction | MoonPayWaitNextAction | MoonPayOrderNextAction;
|
|
253
|
-
/**
|
|
253
|
+
/**
|
|
254
|
+
* The order is terminal. `order` is its body, which the shared order screen renders. Nothing is left to
|
|
255
|
+
* send to `/fiat/next`; a `CONVERTED` `delivery` still `SWAPPING` keeps the body's `GET /fiat/orders/:id` poll.
|
|
256
|
+
*/
|
|
254
257
|
export type MoonPayDone = {
|
|
255
258
|
next: 'done';
|
|
256
259
|
order: FiatStepResponse;
|
package/dist/routing.d.ts
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* an extra key or a blank string fails them, so send only the declared fields.
|
|
22
22
|
*/
|
|
23
23
|
import type { CountryCode, FiatCurrencyCode, PaymentMethodCategory } from './codes';
|
|
24
|
-
import type { FiatAmount, FiatDestination, FiatProvider, QuoteLimitRange } from './types';
|
|
24
|
+
import type { FiatAmount, FiatDestination, FiatOrderDelivery, FiatProvider, QuoteLimitRange } from './types';
|
|
25
25
|
export declare const ROUTING_ENDPOINTS: {
|
|
26
26
|
readonly table: "POST /fiat/routing/table";
|
|
27
27
|
/** Temporary: `POST /fiat/next` replaces it for each provider that moves there. */
|
|
@@ -80,7 +80,27 @@ export interface RoutingTableProvider {
|
|
|
80
80
|
* table's currency. `null` when unknown. The interval edges are the most after every step on offer.
|
|
81
81
|
*/
|
|
82
82
|
currentLimit: string | null;
|
|
83
|
+
/**
|
|
84
|
+
* The asset this provider delivers on the order: the request's `cryptoCurrencyCode` on `chainId`,
|
|
85
|
+
* or, when the request names a `destination`, the asset the backend chose to buy for it. Quote this
|
|
86
|
+
* asset. Absent from a backend that predates it.
|
|
87
|
+
*/
|
|
88
|
+
railAsset?: RoutingTableRailAsset;
|
|
89
|
+
/** How the order reaches the user. Absent from a backend that predates it. */
|
|
90
|
+
deliveryMode?: RoutingDeliveryMode;
|
|
91
|
+
}
|
|
92
|
+
/** An asset by chain and token address, in `FiatDestination`'s format. */
|
|
93
|
+
export interface RoutingTableRailAsset {
|
|
94
|
+
chainId: string;
|
|
95
|
+
tokenAddress: string;
|
|
83
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* `DIRECT`: the provider pays `railAsset` to the user's wallet, so the purchase is done when the
|
|
99
|
+
* order settles. `CONVERTED`: the provider pays a deposit address that converts `railAsset` into the
|
|
100
|
+
* request's `destination`, so the purchase is done when the order's `delivery.state` is `DELIVERED`.
|
|
101
|
+
* The same values as the order's `delivery.mode`.
|
|
102
|
+
*/
|
|
103
|
+
export type RoutingDeliveryMode = FiatOrderDelivery['mode'];
|
|
84
104
|
/**
|
|
85
105
|
* A `QuoteLimitRange` with two decimals (`"20.00"`) and the providers that serve it. The next
|
|
86
106
|
* interval starts one cent above `max`. Adjacent intervals always rank differently.
|
package/dist/schemas.d.ts
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
*/
|
|
29
29
|
import { z } from 'zod';
|
|
30
30
|
import type { UsStateCode } from './codes';
|
|
31
|
-
import type { BlockedReason, CryptoAmount, FailureReason, FeeLine, FiatAmount, FiatEndpoint, FiatProvider, FiatStepResponse, FieldSpec, FlowState, FormDescriptor, FormField, FormFieldType, InstructionField, Instructions, Instrument, JsonValue, KYCProvider, KycReviewDuration, OrderRef, OrderStatus, OrderSummary, PollSpec, PreparedPayment, PaymentSurface, Quote, QuoteLimitRange, QuoteLimits, Recovery, Refund, ReportSpec, SelectOption, StatusHistoryEntry, Surface, PreferredIdentityDocument, KycFieldId, ClientExecutedDelivery, KycSdkResultReport, SurfaceKind, SurfaceProvider, TermsAcceptance, Transition, TransitionInputs, TransitionParams, Tx, FiatDestination, FiatGeo, FiatNextRequest } from './types';
|
|
31
|
+
import type { BlockedReason, CryptoAmount, FailureReason, FeeLine, FiatAmount, FiatEndpoint, FiatProvider, FiatStepResponse, FieldSpec, FlowState, FormDescriptor, FormField, FormFieldType, InstructionField, Instructions, Instrument, JsonValue, KYCProvider, KycReviewDuration, OrderRef, OrderStatus, OrderSummary, PollSpec, PreparedPayment, PaymentSurface, Quote, QuoteLimitRange, QuoteLimits, Recovery, Refund, ReportSpec, SelectOption, StatusHistoryEntry, Surface, PreferredIdentityDocument, KycFieldId, ClientExecutedDelivery, KycSdkResultReport, SurfaceKind, SurfaceProvider, TermsAcceptance, Transition, TransitionInputs, TransitionParams, Tx, FiatDestination, FiatGeo, FiatOrderDelivery, FiatOrderDeliveryState, FiatNextRequest } from './types';
|
|
32
32
|
import type { FiatTermsErrorBody, FiatTermsRequest, FiatTermsResponse, TermsDocument, TermsDocumentAcceptance } from './terms';
|
|
33
33
|
import type { FiatRoutingQuoteErrorBody, FiatRoutingQuoteRequest, FiatRoutingQuoteTerms, FiatRoutingTableErrorBody, FiatRoutingTableRequest, FiatRoutingTableResponse } from './routing';
|
|
34
34
|
export declare const JsonSchema: z.ZodType<JsonValue>;
|
|
@@ -54,6 +54,8 @@ export declare const OrderRefSchema: z.ZodType<OrderRef>;
|
|
|
54
54
|
export declare const OrderSummarySchema: z.ZodType<OrderSummary>;
|
|
55
55
|
export declare const StatusHistoryEntrySchema: z.ZodType<StatusHistoryEntry>;
|
|
56
56
|
export declare const TxSchema: z.ZodType<Tx>;
|
|
57
|
+
export declare const FiatOrderDeliveryStateSchema: z.ZodType<FiatOrderDeliveryState>;
|
|
58
|
+
export declare const FiatOrderDeliverySchema: z.ZodType<FiatOrderDelivery>;
|
|
57
59
|
export declare const RefundSchema: z.ZodType<Refund>;
|
|
58
60
|
export declare const SurfaceKindSchema: z.ZodType<SurfaceKind>;
|
|
59
61
|
export declare const PreferredIdentityDocumentSchema: z.ZodType<PreferredIdentityDocument>;
|
package/dist/table.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export type StateKey = 'QUOTE' | 'FUN_AUTH' | 'SESSION_AUTH' | 'KYC/CAPTURE' | '
|
|
|
39
39
|
* is over stops polling and the order silently strands, whereas one that keeps polling lets the
|
|
40
40
|
* reconciler resolve it. Revisit when the backend publishes its rank map.
|
|
41
41
|
*/
|
|
42
|
-
export declare const TERMINAL_ORDER_STATUSES: readonly ["SETTLED", "
|
|
42
|
+
export declare const TERMINAL_ORDER_STATUSES: readonly ["SETTLED", "EXPIRED", "CANCELLED", "FAILED", "REFUNDED"];
|
|
43
43
|
export type TerminalOrderStatus = (typeof TERMINAL_ORDER_STATUSES)[number];
|
|
44
44
|
/**
|
|
45
45
|
* Endpoint template as written in the docs. Named `:` segments match one emitted path segment.
|
package/dist/table.js
CHANGED
|
@@ -36,13 +36,12 @@ __export(table_exports, {
|
|
|
36
36
|
module.exports = __toCommonJS(table_exports);
|
|
37
37
|
|
|
38
38
|
// package.json
|
|
39
|
-
var version = "0.36.0-uda.
|
|
39
|
+
var version = "0.36.0-uda.2";
|
|
40
40
|
|
|
41
41
|
// src/table.ts
|
|
42
42
|
var TABLE_VERSION = version;
|
|
43
43
|
var TERMINAL_ORDER_STATUSES = [
|
|
44
44
|
"SETTLED",
|
|
45
|
-
"FINAL_ASSET_DELIVERED",
|
|
46
45
|
"EXPIRED",
|
|
47
46
|
"CANCELLED",
|
|
48
47
|
"FAILED",
|
|
@@ -397,7 +396,7 @@ var TRANSITION_TABLE = {
|
|
|
397
396
|
id: "poll",
|
|
398
397
|
mode: "AWAIT",
|
|
399
398
|
endpoint: "GET /fiat/orders/:id",
|
|
400
|
-
when: "status is non-terminal",
|
|
399
|
+
when: "status is non-terminal, or delivery.state is SWAPPING",
|
|
401
400
|
note: "Documented giveUpAfterMs 300000 \u2014 on give-up the wizard exits and the durable order takes over."
|
|
402
401
|
},
|
|
403
402
|
{
|
|
@@ -428,7 +427,7 @@ var TRANSITION_TABLE = {
|
|
|
428
427
|
"A terminal status may still carry a recovery transition: FAILED + retryable failureReason emits it (FE doc Screen 14); non-retryable emits [].",
|
|
429
428
|
"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.",
|
|
430
429
|
"CAPTURE_ORPHANED is non-terminal pending the backend rank map (added from review 2026-08-14).",
|
|
431
|
-
"
|
|
430
|
+
"SETTLED is terminal for the order. When delivery.mode is CONVERTED, the conversion into the destination may still run after SETTLED: the backend keeps offering the AWAIT poll while delivery.state is SWAPPING, and the client keeps polling until delivery.state is DELIVERED or FAILED.",
|
|
432
431
|
"TODO(open-decision): contract OQ7 \u2014 under/over-payment is the biggest unenumerated branch."
|
|
433
432
|
]
|
|
434
433
|
}
|
package/dist/table.mjs
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -76,15 +76,11 @@ 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.
|
|
80
|
-
* `
|
|
79
|
+
* The provider's crypto reached the deposit address. Terminal for the order. When the order's
|
|
80
|
+
* `delivery` is `CONVERTED`, the swap into the destination may still be running: read
|
|
81
|
+
* `delivery.state`.
|
|
81
82
|
*/
|
|
82
|
-
| 'SETTLED'
|
|
83
|
-
/**
|
|
84
|
-
* The destination asset reached the user's wallet. Only an order whose request carried a
|
|
85
|
-
* `destination` shows it; every other order ends at `SETTLED`, as before.
|
|
86
|
-
*/
|
|
87
|
-
| 'FINAL_ASSET_DELIVERED' | 'EXPIRED' | 'CANCELLED' | 'FAILED' | 'REFUNDED'
|
|
83
|
+
| 'SETTLED' | 'EXPIRED' | 'CANCELLED' | 'FAILED' | 'REFUNDED'
|
|
88
84
|
/**
|
|
89
85
|
* A capture that never became an order — the pull-rail orphan (contract Flow A's
|
|
90
86
|
* capture-then-order topology: the component yields a `requestId`, then `createOrder` runs).
|
|
@@ -683,6 +679,8 @@ export type FlowState =
|
|
|
683
679
|
status: OrderStatus;
|
|
684
680
|
statusHistory?: StatusHistoryEntry[];
|
|
685
681
|
tx?: Tx;
|
|
682
|
+
/** How the order reaches the user. Absent from a backend that predates it. */
|
|
683
|
+
delivery?: FiatOrderDelivery;
|
|
686
684
|
refund?: Refund;
|
|
687
685
|
failureReason?: FailureReason;
|
|
688
686
|
error?: FailureReason;
|
|
@@ -763,6 +761,22 @@ export interface FiatDestination {
|
|
|
763
761
|
/** An EVM `0x` address (40 hex digits) or a Solana base58 mint. */
|
|
764
762
|
tokenAddress: string;
|
|
765
763
|
}
|
|
764
|
+
/**
|
|
765
|
+
* How an order reaches the user. `DIRECT`: the provider pays the user's wallet, so the purchase is
|
|
766
|
+
* done at `SETTLED`. `CONVERTED`: the provider pays a deposit address that converts the provider's
|
|
767
|
+
* asset into the request's `destination`. The order still ends at `SETTLED`, and `state` reports the
|
|
768
|
+
* conversion: `SWAPPING` while it runs, `DELIVERED` once the destination asset reached the user's
|
|
769
|
+
* wallet, `FAILED` when it stopped without paying the user. `finalTxHash` is the transaction that paid
|
|
770
|
+
* the user, `null` until `DELIVERED`.
|
|
771
|
+
*/
|
|
772
|
+
export type FiatOrderDelivery = {
|
|
773
|
+
mode: 'DIRECT';
|
|
774
|
+
} | {
|
|
775
|
+
mode: 'CONVERTED';
|
|
776
|
+
state: FiatOrderDeliveryState;
|
|
777
|
+
finalTxHash: string | null;
|
|
778
|
+
};
|
|
779
|
+
export type FiatOrderDeliveryState = 'SWAPPING' | 'DELIVERED' | 'FAILED';
|
|
766
780
|
/** The geo endpoint's response, sent on every `/next` request. `alpha2` is ISO 3166-1 alpha-2. */
|
|
767
781
|
export type FiatGeo = {
|
|
768
782
|
alpha2: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fun-xyz/fiat-contract",
|
|
3
|
-
"version": "0.36.0-uda.
|
|
3
|
+
"version": "0.36.0-uda.2",
|
|
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": {
|