@fun-xyz/fiat-contract 0.34.0 → 0.36.0-uda.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-5ZGSYLC3.mjs → chunk-PWC3WN74.mjs} +3 -1
- package/dist/index.js +19 -5
- package/dist/index.mjs +17 -5
- package/dist/providers/moonpay.d.ts +6 -2
- package/dist/routing.d.ts +5 -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.0";
|
|
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,7 +1090,8 @@ 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({
|
|
@@ -1125,7 +1136,8 @@ var $routingQuoteTermsShape = {
|
|
|
1125
1136
|
{ message: US_REGION_REQUIRED, path: ["region"] }
|
|
1126
1137
|
),
|
|
1127
1138
|
prepareSessionAuth: import_zod.z.boolean().optional(),
|
|
1128
|
-
routingOverrides: obj({ providers: import_zod.z.array($routingProvider) }).optional()
|
|
1139
|
+
routingOverrides: obj({ providers: import_zod.z.array($routingProvider) }).optional(),
|
|
1140
|
+
destination: $destination.optional()
|
|
1129
1141
|
};
|
|
1130
1142
|
var $routingQuoteTerms = obj($routingQuoteTermsShape);
|
|
1131
1143
|
var FiatRoutingQuoteTermsSchema = $routingQuoteTerms;
|
|
@@ -1181,7 +1193,7 @@ var $routingQuoteErrorBody = import_zod.z.union([$routingNoRouteErrorBody, $rout
|
|
|
1181
1193
|
var FiatRoutingQuoteErrorBodySchema = $routingQuoteErrorBody;
|
|
1182
1194
|
var $fiatGeo = obj({ alpha2: import_zod.z.string().regex(/^[A-Z]{2}$/), region: $nonBlank.optional(), ip: $nonBlank.optional() });
|
|
1183
1195
|
var FiatGeoSchema = $fiatGeo;
|
|
1184
|
-
var $nextRequest = import_zod.z.object({ provider: $provider, action: $nonBlank, geo: $fiatGeo }).catchall(import_zod.z.unknown());
|
|
1196
|
+
var $nextRequest = import_zod.z.object({ provider: $provider, action: $nonBlank, geo: $fiatGeo, destination: $destination.optional() }).catchall(import_zod.z.unknown());
|
|
1185
1197
|
var FiatNextRequestSchema = $nextRequest;
|
|
1186
1198
|
var $providerBoundStepResponse = obj({
|
|
1187
1199
|
state: $providerBoundFlowState,
|
|
@@ -1242,12 +1254,13 @@ var $stepResponse = import_zod.z.union([$providerBoundStepResponse, $blockedStep
|
|
|
1242
1254
|
var FiatStepResponseSchema = $stepResponse;
|
|
1243
1255
|
|
|
1244
1256
|
// package.json
|
|
1245
|
-
var version = "0.
|
|
1257
|
+
var version = "0.36.0-uda.0";
|
|
1246
1258
|
|
|
1247
1259
|
// src/table.ts
|
|
1248
1260
|
var TABLE_VERSION = version;
|
|
1249
1261
|
var TERMINAL_ORDER_STATUSES = [
|
|
1250
1262
|
"SETTLED",
|
|
1263
|
+
"FINAL_ASSET_DELIVERED",
|
|
1251
1264
|
"EXPIRED",
|
|
1252
1265
|
"CANCELLED",
|
|
1253
1266
|
"FAILED",
|
|
@@ -1633,6 +1646,7 @@ var TRANSITION_TABLE = {
|
|
|
1633
1646
|
"A terminal status may still carry a recovery transition: FAILED + retryable failureReason emits it (FE doc Screen 14); non-retryable emits [].",
|
|
1634
1647
|
"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
1648
|
"CAPTURE_ORPHANED is non-terminal pending the backend rank map (added from review 2026-08-14).",
|
|
1649
|
+
"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
1650
|
"TODO(open-decision): contract OQ7 \u2014 under/over-payment is the biggest unenumerated branch."
|
|
1637
1651
|
]
|
|
1638
1652
|
}
|
|
@@ -2898,7 +2912,7 @@ var $checkout = obj2({
|
|
|
2898
2912
|
var MoonPayCheckoutSchema = $checkout;
|
|
2899
2913
|
var $credentials = obj2({ customerId: $nonEmpty, accessToken: $nonEmpty });
|
|
2900
2914
|
var MoonPaySdkCredentialsSchema = $credentials;
|
|
2901
|
-
var $context = { checkout: $checkout, credentials: $credentials.optional() };
|
|
2915
|
+
var $context = { checkout: $checkout, credentials: $credentials.optional(), destination: FiatDestinationSchema.optional() };
|
|
2902
2916
|
var $requestContext = obj2($context);
|
|
2903
2917
|
var MoonPayRequestContextSchema = $requestContext;
|
|
2904
2918
|
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-PWC3WN74.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,7 +941,8 @@ 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({
|
|
@@ -977,7 +987,8 @@ var $routingQuoteTermsShape = {
|
|
|
977
987
|
{ message: US_REGION_REQUIRED, path: ["region"] }
|
|
978
988
|
),
|
|
979
989
|
prepareSessionAuth: z.boolean().optional(),
|
|
980
|
-
routingOverrides: obj({ providers: z.array($routingProvider) }).optional()
|
|
990
|
+
routingOverrides: obj({ providers: z.array($routingProvider) }).optional(),
|
|
991
|
+
destination: $destination.optional()
|
|
981
992
|
};
|
|
982
993
|
var $routingQuoteTerms = obj($routingQuoteTermsShape);
|
|
983
994
|
var FiatRoutingQuoteTermsSchema = $routingQuoteTerms;
|
|
@@ -1033,7 +1044,7 @@ var $routingQuoteErrorBody = z.union([$routingNoRouteErrorBody, $routingAmountEr
|
|
|
1033
1044
|
var FiatRoutingQuoteErrorBodySchema = $routingQuoteErrorBody;
|
|
1034
1045
|
var $fiatGeo = obj({ alpha2: z.string().regex(/^[A-Z]{2}$/), region: $nonBlank.optional(), ip: $nonBlank.optional() });
|
|
1035
1046
|
var FiatGeoSchema = $fiatGeo;
|
|
1036
|
-
var $nextRequest = z.object({ provider: $provider, action: $nonBlank, geo: $fiatGeo }).catchall(z.unknown());
|
|
1047
|
+
var $nextRequest = z.object({ provider: $provider, action: $nonBlank, geo: $fiatGeo, destination: $destination.optional() }).catchall(z.unknown());
|
|
1037
1048
|
var FiatNextRequestSchema = $nextRequest;
|
|
1038
1049
|
var $providerBoundStepResponse = obj({
|
|
1039
1050
|
state: $providerBoundFlowState,
|
|
@@ -2172,7 +2183,7 @@ var $checkout = obj2({
|
|
|
2172
2183
|
var MoonPayCheckoutSchema = $checkout;
|
|
2173
2184
|
var $credentials = obj2({ customerId: $nonEmpty, accessToken: $nonEmpty });
|
|
2174
2185
|
var MoonPaySdkCredentialsSchema = $credentials;
|
|
2175
|
-
var $context = { checkout: $checkout, credentials: $credentials.optional() };
|
|
2186
|
+
var $context = { checkout: $checkout, credentials: $credentials.optional(), destination: FiatDestinationSchema.optional() };
|
|
2176
2187
|
var $requestContext = obj2($context);
|
|
2177
2188
|
var MoonPayRequestContextSchema = $requestContext;
|
|
2178
2189
|
var $quoteInput = obj2({
|
|
@@ -2378,6 +2389,7 @@ export {
|
|
|
2378
2389
|
FeeLineSchema,
|
|
2379
2390
|
FiatAmountSchema,
|
|
2380
2391
|
FiatCurrencyCode,
|
|
2392
|
+
FiatDestinationSchema,
|
|
2381
2393
|
FiatEndpointSchema,
|
|
2382
2394
|
FiatGeoSchema,
|
|
2383
2395
|
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';
|
|
@@ -127,6 +129,8 @@ export interface FiatRoutingQuoteTerms {
|
|
|
127
129
|
routingOverrides?: {
|
|
128
130
|
providers: RoutingProvider[];
|
|
129
131
|
};
|
|
132
|
+
/** The asset the user receives, when it differs from `cryptoCurrencyCode` on `chainId`. */
|
|
133
|
+
destination?: FiatDestination;
|
|
130
134
|
}
|
|
131
135
|
/**
|
|
132
136
|
* `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.0";
|
|
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.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": {
|