@fun-xyz/fiat-contract 0.36.0-uda.1 → 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-KZZ4JA33.mjs → chunk-7GDFZ5UR.mjs} +3 -4
- package/dist/index.js +14 -6
- package/dist/index.mjs +12 -3
- package/dist/providers/moonpay.d.ts +4 -1
- package/dist/routing.d.ts +6 -5
- 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()
|
|
@@ -1100,7 +1109,7 @@ var $routingTableProvider = obj({
|
|
|
1100
1109
|
visibility: import_zod.z.enum(["COMPLETE", "PARTIAL", "AUTH_GATED"]),
|
|
1101
1110
|
currentLimit: $decimalAmount.nullable(),
|
|
1102
1111
|
railAsset: $destination.optional(),
|
|
1103
|
-
deliveryMode: import_zod.z.enum(["DIRECT", "
|
|
1112
|
+
deliveryMode: import_zod.z.enum(["DIRECT", "CONVERTED"]).optional()
|
|
1104
1113
|
});
|
|
1105
1114
|
var $routingTableInterval = obj({
|
|
1106
1115
|
min: $decimalAmount,
|
|
@@ -1256,13 +1265,12 @@ var $stepResponse = import_zod.z.union([$providerBoundStepResponse, $blockedStep
|
|
|
1256
1265
|
var FiatStepResponseSchema = $stepResponse;
|
|
1257
1266
|
|
|
1258
1267
|
// package.json
|
|
1259
|
-
var version = "0.36.0-uda.
|
|
1268
|
+
var version = "0.36.0-uda.2";
|
|
1260
1269
|
|
|
1261
1270
|
// src/table.ts
|
|
1262
1271
|
var TABLE_VERSION = version;
|
|
1263
1272
|
var TERMINAL_ORDER_STATUSES = [
|
|
1264
1273
|
"SETTLED",
|
|
1265
|
-
"FINAL_ASSET_DELIVERED",
|
|
1266
1274
|
"EXPIRED",
|
|
1267
1275
|
"CANCELLED",
|
|
1268
1276
|
"FAILED",
|
|
@@ -1617,7 +1625,7 @@ var TRANSITION_TABLE = {
|
|
|
1617
1625
|
id: "poll",
|
|
1618
1626
|
mode: "AWAIT",
|
|
1619
1627
|
endpoint: "GET /fiat/orders/:id",
|
|
1620
|
-
when: "status is non-terminal",
|
|
1628
|
+
when: "status is non-terminal, or delivery.state is SWAPPING",
|
|
1621
1629
|
note: "Documented giveUpAfterMs 300000 \u2014 on give-up the wizard exits and the durable order takes over."
|
|
1622
1630
|
},
|
|
1623
1631
|
{
|
|
@@ -1648,7 +1656,7 @@ var TRANSITION_TABLE = {
|
|
|
1648
1656
|
"A terminal status may still carry a recovery transition: FAILED + retryable failureReason emits it (FE doc Screen 14); non-retryable emits [].",
|
|
1649
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.",
|
|
1650
1658
|
"CAPTURE_ORPHANED is non-terminal pending the backend rank map (added from review 2026-08-14).",
|
|
1651
|
-
"
|
|
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.",
|
|
1652
1660
|
"TODO(open-decision): contract OQ7 \u2014 under/over-payment is the biggest unenumerated branch."
|
|
1653
1661
|
]
|
|
1654
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()
|
|
@@ -951,7 +958,7 @@ var $routingTableProvider = obj({
|
|
|
951
958
|
visibility: z.enum(["COMPLETE", "PARTIAL", "AUTH_GATED"]),
|
|
952
959
|
currentLimit: $decimalAmount.nullable(),
|
|
953
960
|
railAsset: $destination.optional(),
|
|
954
|
-
deliveryMode: z.enum(["DIRECT", "
|
|
961
|
+
deliveryMode: z.enum(["DIRECT", "CONVERTED"]).optional()
|
|
955
962
|
});
|
|
956
963
|
var $routingTableInterval = obj({
|
|
957
964
|
min: $decimalAmount,
|
|
@@ -2395,6 +2402,8 @@ export {
|
|
|
2395
2402
|
FiatEndpointSchema,
|
|
2396
2403
|
FiatGeoSchema,
|
|
2397
2404
|
FiatNextRequestSchema,
|
|
2405
|
+
FiatOrderDeliverySchema,
|
|
2406
|
+
FiatOrderDeliveryStateSchema,
|
|
2398
2407
|
FiatProviderSchema,
|
|
2399
2408
|
FiatRoutingQuoteErrorBodySchema,
|
|
2400
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. */
|
|
@@ -95,11 +95,12 @@ export interface RoutingTableRailAsset {
|
|
|
95
95
|
tokenAddress: string;
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
|
-
* `DIRECT`: the provider pays `railAsset` to the user's wallet, so the purchase is done when
|
|
99
|
-
* settles. `
|
|
100
|
-
* `destination`, so the purchase is done
|
|
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`.
|
|
101
102
|
*/
|
|
102
|
-
export type RoutingDeliveryMode = '
|
|
103
|
+
export type RoutingDeliveryMode = FiatOrderDelivery['mode'];
|
|
103
104
|
/**
|
|
104
105
|
* A `QuoteLimitRange` with two decimals (`"20.00"`) and the providers that serve it. The next
|
|
105
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": {
|