@fun-xyz/fiat-contract 0.34.0 → 0.36.0-uda.1
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-5ZGSYLC3.mjs → chunk-KZZ4JA33.mjs} +3 -1
- package/dist/index.js +22 -6
- package/dist/index.mjs +20 -6
- package/dist/providers/moonpay.d.ts +6 -2
- package/dist/routing.d.ts +24 -1
- package/dist/schemas.d.ts +2 -1
- package/dist/table.d.ts +1 -1
- package/dist/table.js +3 -1
- package/dist/table.mjs +1 -1
- package/dist/types.d.ts +27 -3
- package/package.json +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
// package.json
|
|
2
|
-
var version = "0.
|
|
2
|
+
var version = "0.36.0-uda.1";
|
|
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",
|
|
8
9
|
"EXPIRED",
|
|
9
10
|
"CANCELLED",
|
|
10
11
|
"FAILED",
|
|
@@ -390,6 +391,7 @@ var TRANSITION_TABLE = {
|
|
|
390
391
|
"A terminal status may still carry a recovery transition: FAILED + retryable failureReason emits it (FE doc Screen 14); non-retryable emits [].",
|
|
391
392
|
"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.",
|
|
392
393
|
"CAPTURE_ORPHANED is non-terminal pending the backend rank map (added from review 2026-08-14).",
|
|
394
|
+
"FINAL_ASSET_DELIVERED ends only an order whose request carried a destination. SETTLED stays in terminalStatuses for every other order, so a client that sent a destination keeps polling past SETTLED.",
|
|
393
395
|
"TODO(open-decision): contract OQ7 \u2014 under/over-payment is the biggest unenumerated branch."
|
|
394
396
|
]
|
|
395
397
|
}
|
package/dist/index.js
CHANGED
|
@@ -41,6 +41,7 @@ __export(index_exports, {
|
|
|
41
41
|
FeeLineSchema: () => FeeLineSchema,
|
|
42
42
|
FiatAmountSchema: () => FiatAmountSchema,
|
|
43
43
|
FiatCurrencyCode: () => FiatCurrencyCode,
|
|
44
|
+
FiatDestinationSchema: () => FiatDestinationSchema,
|
|
44
45
|
FiatEndpointSchema: () => FiatEndpointSchema,
|
|
45
46
|
FiatGeoSchema: () => FiatGeoSchema,
|
|
46
47
|
FiatNextRequestSchema: () => FiatNextRequestSchema,
|
|
@@ -538,6 +539,7 @@ var $orderStatus = import_zod.z.enum([
|
|
|
538
539
|
"ON_HOLD",
|
|
539
540
|
"CRYPTO_SENT",
|
|
540
541
|
"SETTLED",
|
|
542
|
+
"FINAL_ASSET_DELIVERED",
|
|
541
543
|
"EXPIRED",
|
|
542
544
|
"CANCELLED",
|
|
543
545
|
"FAILED",
|
|
@@ -1054,6 +1056,14 @@ var $termsErrorBody = obj({
|
|
|
1054
1056
|
recovery: import_zod.z.enum(["RETRY", "REQUOTE", "NONE"])
|
|
1055
1057
|
});
|
|
1056
1058
|
var FiatTermsErrorBodySchema = $termsErrorBody;
|
|
1059
|
+
var $destination = obj({
|
|
1060
|
+
chainId: import_zod.z.string().regex(/^[1-9]\d*$/, "must be a decimal chain id"),
|
|
1061
|
+
tokenAddress: import_zod.z.union([
|
|
1062
|
+
import_zod.z.string().regex(/^0x[0-9a-fA-F]{40}$/, "must be an EVM address"),
|
|
1063
|
+
import_zod.z.string().regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/, "must be a Solana base58 address")
|
|
1064
|
+
])
|
|
1065
|
+
});
|
|
1066
|
+
var FiatDestinationSchema = $destination;
|
|
1057
1067
|
var $decimalAmount = import_zod.z.string().regex(/^(?:0|[1-9]\d*)(?:\.\d+)?$/, "must be a decimal string");
|
|
1058
1068
|
var compareDecimals = (left, right) => {
|
|
1059
1069
|
const [leftWhole = "", leftFraction = ""] = left.split(".");
|
|
@@ -1080,14 +1090,17 @@ var $routingTableRequest = obj({
|
|
|
1080
1090
|
region: $optionalGeoField,
|
|
1081
1091
|
// Duplicates are allowed; the response lists each method once.
|
|
1082
1092
|
methods: import_zod.z.array(import_zod.z.enum(PAYMENT_METHOD_CATEGORIES)).min(1),
|
|
1083
|
-
providers: $routingTableProviderInputs.optional()
|
|
1093
|
+
providers: $routingTableProviderInputs.optional(),
|
|
1094
|
+
destination: $destination.optional()
|
|
1084
1095
|
}).refine((request) => hasUsRegion(request.country, request.region), { message: US_REGION_REQUIRED, path: ["region"] });
|
|
1085
1096
|
var FiatRoutingTableRequestSchema = $routingTableRequest;
|
|
1086
1097
|
var $routingTableProvider = obj({
|
|
1087
1098
|
provider: $routingProvider,
|
|
1088
1099
|
next: import_zod.z.enum(["READY", "AUTH", "DECLARATIVE_KYC", "DOCUMENTARY_KYC", "PENDING_REVIEW"]),
|
|
1089
1100
|
visibility: import_zod.z.enum(["COMPLETE", "PARTIAL", "AUTH_GATED"]),
|
|
1090
|
-
currentLimit: $decimalAmount.nullable()
|
|
1101
|
+
currentLimit: $decimalAmount.nullable(),
|
|
1102
|
+
railAsset: $destination.optional(),
|
|
1103
|
+
deliveryMode: import_zod.z.enum(["DIRECT", "UDA"]).optional()
|
|
1091
1104
|
});
|
|
1092
1105
|
var $routingTableInterval = obj({
|
|
1093
1106
|
min: $decimalAmount,
|
|
@@ -1125,7 +1138,8 @@ var $routingQuoteTermsShape = {
|
|
|
1125
1138
|
{ message: US_REGION_REQUIRED, path: ["region"] }
|
|
1126
1139
|
),
|
|
1127
1140
|
prepareSessionAuth: import_zod.z.boolean().optional(),
|
|
1128
|
-
routingOverrides: obj({ providers: import_zod.z.array($routingProvider) }).optional()
|
|
1141
|
+
routingOverrides: obj({ providers: import_zod.z.array($routingProvider) }).optional(),
|
|
1142
|
+
destination: $destination.optional()
|
|
1129
1143
|
};
|
|
1130
1144
|
var $routingQuoteTerms = obj($routingQuoteTermsShape);
|
|
1131
1145
|
var FiatRoutingQuoteTermsSchema = $routingQuoteTerms;
|
|
@@ -1181,7 +1195,7 @@ var $routingQuoteErrorBody = import_zod.z.union([$routingNoRouteErrorBody, $rout
|
|
|
1181
1195
|
var FiatRoutingQuoteErrorBodySchema = $routingQuoteErrorBody;
|
|
1182
1196
|
var $fiatGeo = obj({ alpha2: import_zod.z.string().regex(/^[A-Z]{2}$/), region: $nonBlank.optional(), ip: $nonBlank.optional() });
|
|
1183
1197
|
var FiatGeoSchema = $fiatGeo;
|
|
1184
|
-
var $nextRequest = import_zod.z.object({ provider: $provider, action: $nonBlank, geo: $fiatGeo }).catchall(import_zod.z.unknown());
|
|
1198
|
+
var $nextRequest = import_zod.z.object({ provider: $provider, action: $nonBlank, geo: $fiatGeo, destination: $destination.optional() }).catchall(import_zod.z.unknown());
|
|
1185
1199
|
var FiatNextRequestSchema = $nextRequest;
|
|
1186
1200
|
var $providerBoundStepResponse = obj({
|
|
1187
1201
|
state: $providerBoundFlowState,
|
|
@@ -1242,12 +1256,13 @@ var $stepResponse = import_zod.z.union([$providerBoundStepResponse, $blockedStep
|
|
|
1242
1256
|
var FiatStepResponseSchema = $stepResponse;
|
|
1243
1257
|
|
|
1244
1258
|
// package.json
|
|
1245
|
-
var version = "0.
|
|
1259
|
+
var version = "0.36.0-uda.1";
|
|
1246
1260
|
|
|
1247
1261
|
// src/table.ts
|
|
1248
1262
|
var TABLE_VERSION = version;
|
|
1249
1263
|
var TERMINAL_ORDER_STATUSES = [
|
|
1250
1264
|
"SETTLED",
|
|
1265
|
+
"FINAL_ASSET_DELIVERED",
|
|
1251
1266
|
"EXPIRED",
|
|
1252
1267
|
"CANCELLED",
|
|
1253
1268
|
"FAILED",
|
|
@@ -1633,6 +1648,7 @@ var TRANSITION_TABLE = {
|
|
|
1633
1648
|
"A terminal status may still carry a recovery transition: FAILED + retryable failureReason emits it (FE doc Screen 14); non-retryable emits [].",
|
|
1634
1649
|
"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.",
|
|
1635
1650
|
"CAPTURE_ORPHANED is non-terminal pending the backend rank map (added from review 2026-08-14).",
|
|
1651
|
+
"FINAL_ASSET_DELIVERED ends only an order whose request carried a destination. SETTLED stays in terminalStatuses for every other order, so a client that sent a destination keeps polling past SETTLED.",
|
|
1636
1652
|
"TODO(open-decision): contract OQ7 \u2014 under/over-payment is the biggest unenumerated branch."
|
|
1637
1653
|
]
|
|
1638
1654
|
}
|
|
@@ -2898,7 +2914,7 @@ var $checkout = obj2({
|
|
|
2898
2914
|
var MoonPayCheckoutSchema = $checkout;
|
|
2899
2915
|
var $credentials = obj2({ customerId: $nonEmpty, accessToken: $nonEmpty });
|
|
2900
2916
|
var MoonPaySdkCredentialsSchema = $credentials;
|
|
2901
|
-
var $context = { checkout: $checkout, credentials: $credentials.optional() };
|
|
2917
|
+
var $context = { checkout: $checkout, credentials: $credentials.optional(), destination: FiatDestinationSchema.optional() };
|
|
2902
2918
|
var $requestContext = obj2($context);
|
|
2903
2919
|
var MoonPayRequestContextSchema = $requestContext;
|
|
2904
2920
|
var $quoteInput = obj2({
|
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-KZZ4JA33.mjs";
|
|
16
16
|
import {
|
|
17
17
|
MOONPAY_ENDPOINTS
|
|
18
18
|
} from "./chunk-TIEGTTFY.mjs";
|
|
@@ -390,6 +390,7 @@ var $orderStatus = z.enum([
|
|
|
390
390
|
"ON_HOLD",
|
|
391
391
|
"CRYPTO_SENT",
|
|
392
392
|
"SETTLED",
|
|
393
|
+
"FINAL_ASSET_DELIVERED",
|
|
393
394
|
"EXPIRED",
|
|
394
395
|
"CANCELLED",
|
|
395
396
|
"FAILED",
|
|
@@ -906,6 +907,14 @@ var $termsErrorBody = obj({
|
|
|
906
907
|
recovery: z.enum(["RETRY", "REQUOTE", "NONE"])
|
|
907
908
|
});
|
|
908
909
|
var FiatTermsErrorBodySchema = $termsErrorBody;
|
|
910
|
+
var $destination = obj({
|
|
911
|
+
chainId: z.string().regex(/^[1-9]\d*$/, "must be a decimal chain id"),
|
|
912
|
+
tokenAddress: z.union([
|
|
913
|
+
z.string().regex(/^0x[0-9a-fA-F]{40}$/, "must be an EVM address"),
|
|
914
|
+
z.string().regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/, "must be a Solana base58 address")
|
|
915
|
+
])
|
|
916
|
+
});
|
|
917
|
+
var FiatDestinationSchema = $destination;
|
|
909
918
|
var $decimalAmount = z.string().regex(/^(?:0|[1-9]\d*)(?:\.\d+)?$/, "must be a decimal string");
|
|
910
919
|
var compareDecimals = (left, right) => {
|
|
911
920
|
const [leftWhole = "", leftFraction = ""] = left.split(".");
|
|
@@ -932,14 +941,17 @@ var $routingTableRequest = obj({
|
|
|
932
941
|
region: $optionalGeoField,
|
|
933
942
|
// Duplicates are allowed; the response lists each method once.
|
|
934
943
|
methods: z.array(z.enum(PAYMENT_METHOD_CATEGORIES)).min(1),
|
|
935
|
-
providers: $routingTableProviderInputs.optional()
|
|
944
|
+
providers: $routingTableProviderInputs.optional(),
|
|
945
|
+
destination: $destination.optional()
|
|
936
946
|
}).refine((request) => hasUsRegion(request.country, request.region), { message: US_REGION_REQUIRED, path: ["region"] });
|
|
937
947
|
var FiatRoutingTableRequestSchema = $routingTableRequest;
|
|
938
948
|
var $routingTableProvider = obj({
|
|
939
949
|
provider: $routingProvider,
|
|
940
950
|
next: z.enum(["READY", "AUTH", "DECLARATIVE_KYC", "DOCUMENTARY_KYC", "PENDING_REVIEW"]),
|
|
941
951
|
visibility: z.enum(["COMPLETE", "PARTIAL", "AUTH_GATED"]),
|
|
942
|
-
currentLimit: $decimalAmount.nullable()
|
|
952
|
+
currentLimit: $decimalAmount.nullable(),
|
|
953
|
+
railAsset: $destination.optional(),
|
|
954
|
+
deliveryMode: z.enum(["DIRECT", "UDA"]).optional()
|
|
943
955
|
});
|
|
944
956
|
var $routingTableInterval = obj({
|
|
945
957
|
min: $decimalAmount,
|
|
@@ -977,7 +989,8 @@ var $routingQuoteTermsShape = {
|
|
|
977
989
|
{ message: US_REGION_REQUIRED, path: ["region"] }
|
|
978
990
|
),
|
|
979
991
|
prepareSessionAuth: z.boolean().optional(),
|
|
980
|
-
routingOverrides: obj({ providers: z.array($routingProvider) }).optional()
|
|
992
|
+
routingOverrides: obj({ providers: z.array($routingProvider) }).optional(),
|
|
993
|
+
destination: $destination.optional()
|
|
981
994
|
};
|
|
982
995
|
var $routingQuoteTerms = obj($routingQuoteTermsShape);
|
|
983
996
|
var FiatRoutingQuoteTermsSchema = $routingQuoteTerms;
|
|
@@ -1033,7 +1046,7 @@ var $routingQuoteErrorBody = z.union([$routingNoRouteErrorBody, $routingAmountEr
|
|
|
1033
1046
|
var FiatRoutingQuoteErrorBodySchema = $routingQuoteErrorBody;
|
|
1034
1047
|
var $fiatGeo = obj({ alpha2: z.string().regex(/^[A-Z]{2}$/), region: $nonBlank.optional(), ip: $nonBlank.optional() });
|
|
1035
1048
|
var FiatGeoSchema = $fiatGeo;
|
|
1036
|
-
var $nextRequest = z.object({ provider: $provider, action: $nonBlank, geo: $fiatGeo }).catchall(z.unknown());
|
|
1049
|
+
var $nextRequest = z.object({ provider: $provider, action: $nonBlank, geo: $fiatGeo, destination: $destination.optional() }).catchall(z.unknown());
|
|
1037
1050
|
var FiatNextRequestSchema = $nextRequest;
|
|
1038
1051
|
var $providerBoundStepResponse = obj({
|
|
1039
1052
|
state: $providerBoundFlowState,
|
|
@@ -2172,7 +2185,7 @@ var $checkout = obj2({
|
|
|
2172
2185
|
var MoonPayCheckoutSchema = $checkout;
|
|
2173
2186
|
var $credentials = obj2({ customerId: $nonEmpty, accessToken: $nonEmpty });
|
|
2174
2187
|
var MoonPaySdkCredentialsSchema = $credentials;
|
|
2175
|
-
var $context = { checkout: $checkout, credentials: $credentials.optional() };
|
|
2188
|
+
var $context = { checkout: $checkout, credentials: $credentials.optional(), destination: FiatDestinationSchema.optional() };
|
|
2176
2189
|
var $requestContext = obj2($context);
|
|
2177
2190
|
var MoonPayRequestContextSchema = $requestContext;
|
|
2178
2191
|
var $quoteInput = obj2({
|
|
@@ -2378,6 +2391,7 @@ export {
|
|
|
2378
2391
|
FeeLineSchema,
|
|
2379
2392
|
FiatAmountSchema,
|
|
2380
2393
|
FiatCurrencyCode,
|
|
2394
|
+
FiatDestinationSchema,
|
|
2381
2395
|
FiatEndpointSchema,
|
|
2382
2396
|
FiatGeoSchema,
|
|
2383
2397
|
FiatNextRequestSchema,
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
*/
|
|
22
22
|
import type { FiatCurrencyCode } from '../codes';
|
|
23
23
|
import type { FiatTermsRequest, TermsDocument } from '../terms';
|
|
24
|
-
import type { FiatAmount, FiatGeo, FiatStepResponse, FormField, KYCProvider, KycFieldId, KycSdkResultReport } from '../types';
|
|
24
|
+
import type { FiatAmount, FiatDestination, FiatGeo, FiatStepResponse, FormField, KYCProvider, KycFieldId, KycSdkResultReport } from '../types';
|
|
25
25
|
export declare const MOONPAY_ENDPOINTS: {
|
|
26
26
|
readonly next: "POST /fiat/next";
|
|
27
27
|
};
|
|
@@ -41,10 +41,14 @@ export interface MoonPaySdkCredentials {
|
|
|
41
41
|
customerId: string;
|
|
42
42
|
accessToken: string;
|
|
43
43
|
}
|
|
44
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* On every request, not part of the result. `credentials` is present after `connect`.
|
|
46
|
+
* `destination` is the asset the user receives at the end; `checkout.destination` stays the quote's.
|
|
47
|
+
*/
|
|
45
48
|
export type MoonPayRequestContext = {
|
|
46
49
|
checkout: MoonPayCheckout;
|
|
47
50
|
credentials?: MoonPaySdkCredentials;
|
|
51
|
+
destination?: FiatDestination;
|
|
48
52
|
};
|
|
49
53
|
/**
|
|
50
54
|
* The parameters for the device `client.getQuote`, not a quote. The backend builds them because the
|
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, FiatProvider, QuoteLimitRange } from './types';
|
|
24
|
+
import type { FiatAmount, FiatDestination, 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. */
|
|
@@ -55,6 +55,8 @@ export interface FiatRoutingTableRequest {
|
|
|
55
55
|
methods: PaymentMethodCategory[];
|
|
56
56
|
/** Optional provider-specific inputs. */
|
|
57
57
|
providers?: FiatRoutingTableProviderInputs;
|
|
58
|
+
/** The asset the user receives, when it differs from `cryptoCurrencyCode` on `chainId`. */
|
|
59
|
+
destination?: FiatDestination;
|
|
58
60
|
}
|
|
59
61
|
/** What a provider needs from this buyer before it can take the payment. */
|
|
60
62
|
export type RoutingNextStep = 'READY' | 'AUTH' | 'DECLARATIVE_KYC' | 'DOCUMENTARY_KYC' | 'PENDING_REVIEW';
|
|
@@ -78,7 +80,26 @@ export interface RoutingTableProvider {
|
|
|
78
80
|
* table's currency. `null` when unknown. The interval edges are the most after every step on offer.
|
|
79
81
|
*/
|
|
80
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;
|
|
81
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* `DIRECT`: the provider pays `railAsset` to the user's wallet, so the purchase is done when it
|
|
99
|
+
* settles. `UDA`: the provider pays a deposit address that swaps `railAsset` into the request's
|
|
100
|
+
* `destination`, so the purchase is done only at `FINAL_ASSET_DELIVERED`.
|
|
101
|
+
*/
|
|
102
|
+
export type RoutingDeliveryMode = 'DIRECT' | 'UDA';
|
|
82
103
|
/**
|
|
83
104
|
* A `QuoteLimitRange` with two decimals (`"20.00"`) and the providers that serve it. The next
|
|
84
105
|
* interval starts one cent above `max`. Adjacent intervals always rank differently.
|
|
@@ -127,6 +148,8 @@ export interface FiatRoutingQuoteTerms {
|
|
|
127
148
|
routingOverrides?: {
|
|
128
149
|
providers: RoutingProvider[];
|
|
129
150
|
};
|
|
151
|
+
/** The asset the user receives, when it differs from `cryptoCurrencyCode` on `chainId`. */
|
|
152
|
+
destination?: FiatDestination;
|
|
130
153
|
}
|
|
131
154
|
/**
|
|
132
155
|
* `POST /fiat/routing/quote`: the terms plus which providers to price, in one of two forms.
|
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, 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, 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>;
|
|
@@ -113,6 +113,7 @@ export declare const TermsDocumentAcceptanceSchema: z.ZodType<TermsDocumentAccep
|
|
|
113
113
|
export declare const FiatTermsRequestSchema: z.ZodType<FiatTermsRequest>;
|
|
114
114
|
export declare const FiatTermsResponseSchema: z.ZodType<FiatTermsResponse>;
|
|
115
115
|
export declare const FiatTermsErrorBodySchema: z.ZodType<FiatTermsErrorBody>;
|
|
116
|
+
export declare const FiatDestinationSchema: z.ZodType<FiatDestination>;
|
|
116
117
|
export declare const FiatRoutingTableRequestSchema: z.ZodType<FiatRoutingTableRequest>;
|
|
117
118
|
export declare const FiatRoutingTableResponseSchema: z.ZodType<FiatRoutingTableResponse>;
|
|
118
119
|
export declare const FiatRoutingQuoteTermsSchema: z.ZodType<FiatRoutingQuoteTerms>;
|
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", "EXPIRED", "CANCELLED", "FAILED", "REFUNDED"];
|
|
42
|
+
export declare const TERMINAL_ORDER_STATUSES: readonly ["SETTLED", "FINAL_ASSET_DELIVERED", "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,12 +36,13 @@ __export(table_exports, {
|
|
|
36
36
|
module.exports = __toCommonJS(table_exports);
|
|
37
37
|
|
|
38
38
|
// package.json
|
|
39
|
-
var version = "0.
|
|
39
|
+
var version = "0.36.0-uda.1";
|
|
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",
|
|
45
46
|
"EXPIRED",
|
|
46
47
|
"CANCELLED",
|
|
47
48
|
"FAILED",
|
|
@@ -427,6 +428,7 @@ var TRANSITION_TABLE = {
|
|
|
427
428
|
"A terminal status may still carry a recovery transition: FAILED + retryable failureReason emits it (FE doc Screen 14); non-retryable emits [].",
|
|
428
429
|
"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.",
|
|
429
430
|
"CAPTURE_ORPHANED is non-terminal pending the backend rank map (added from review 2026-08-14).",
|
|
431
|
+
"FINAL_ASSET_DELIVERED ends only an order whose request carried a destination. SETTLED stays in terminalStatuses for every other order, so a client that sent a destination keeps polling past SETTLED.",
|
|
430
432
|
"TODO(open-decision): contract OQ7 \u2014 under/over-payment is the biggest unenumerated branch."
|
|
431
433
|
]
|
|
432
434
|
}
|
package/dist/table.mjs
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -74,7 +74,17 @@ export type FiatProvider = 'TRANSAK' | 'SWAPPED' | 'BANXA' | 'MOONPAY' | 'STRIPE
|
|
|
74
74
|
* client's job (Jeremy, same thread) — the FE may collapse several of these into one visual state,
|
|
75
75
|
* but the contract does not pre-collapse them.
|
|
76
76
|
*/
|
|
77
|
-
export type OrderStatus = 'CREATING' | 'AWAITING_PAYMENT' | 'PAYMENT_VERIFYING' | 'PROCESSING' | 'PENDING_DELIVERY' | 'ON_HOLD' | 'CRYPTO_SENT'
|
|
77
|
+
export type OrderStatus = 'CREATING' | 'AWAITING_PAYMENT' | 'PAYMENT_VERIFYING' | 'PROCESSING' | 'PENDING_DELIVERY' | 'ON_HOLD' | 'CRYPTO_SENT'
|
|
78
|
+
/**
|
|
79
|
+
* The provider's crypto reached the deposit address. Final for an order whose request carried no
|
|
80
|
+
* `destination`. With a `destination`, the swap into it is still running.
|
|
81
|
+
*/
|
|
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'
|
|
78
88
|
/**
|
|
79
89
|
* A capture that never became an order — the pull-rail orphan (contract Flow A's
|
|
80
90
|
* capture-then-order topology: the component yields a `requestId`, then `createOrder` runs).
|
|
@@ -741,6 +751,18 @@ export type FiatStepResponse = (FiatStepResponseBase & {
|
|
|
741
751
|
provider: FiatProvider;
|
|
742
752
|
};
|
|
743
753
|
});
|
|
754
|
+
/**
|
|
755
|
+
* The asset the user receives at the end of the purchase. Optional on every request that can lead
|
|
756
|
+
* the backend to pick a deposit address. When it differs from the asset the provider delivers, the
|
|
757
|
+
* backend pays a deposit address that swaps into it. The recipient always comes from the verified
|
|
758
|
+
* partner assertion, never from this field.
|
|
759
|
+
*/
|
|
760
|
+
export interface FiatDestination {
|
|
761
|
+
/** Decimal, as the routing requests send it: `"8453"`, Solana `"1151111081099710"`. */
|
|
762
|
+
chainId: string;
|
|
763
|
+
/** An EVM `0x` address (40 hex digits) or a Solana base58 mint. */
|
|
764
|
+
tokenAddress: string;
|
|
765
|
+
}
|
|
744
766
|
/** The geo endpoint's response, sent on every `/next` request. `alpha2` is ISO 3166-1 alpha-2. */
|
|
745
767
|
export type FiatGeo = {
|
|
746
768
|
alpha2: string;
|
|
@@ -748,12 +770,14 @@ export type FiatGeo = {
|
|
|
748
770
|
ip?: string;
|
|
749
771
|
};
|
|
750
772
|
/**
|
|
751
|
-
* The body of every `POST /fiat/next`: `provider`, `geo`,
|
|
752
|
-
* names its `action`. Each provider defines its actions and their
|
|
773
|
+
* The body of every `POST /fiat/next`: `provider`, `geo`, the optional `destination`, and the
|
|
774
|
+
* provider's own request, which names its `action`. Each provider defines its actions and their
|
|
775
|
+
* fields (`./moonpay`).
|
|
753
776
|
*/
|
|
754
777
|
export type FiatNextRequest = {
|
|
755
778
|
provider: FiatProvider;
|
|
756
779
|
action: string;
|
|
757
780
|
geo: FiatGeo;
|
|
781
|
+
destination?: FiatDestination;
|
|
758
782
|
} & Record<string, unknown>;
|
|
759
783
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fun-xyz/fiat-contract",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.0-uda.1",
|
|
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": {
|