@fun-xyz/fiat-contract 0.27.0 → 0.28.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/README.md CHANGED
@@ -19,7 +19,7 @@ Four things, zero runtime logic beyond validation:
19
19
  | --- | --- | --- | --- |
20
20
  | `@fun-xyz/fiat-contract/types` | **0.1 KB** (types erase) | every type; no runtime values | production, both repos |
21
21
  | `@fun-xyz/fiat-contract/table` | **13.8 KB**, zero deps | `TRANSITION_TABLE`, `stateKey`, `tableEntry`, `isTerminal`, `walkTable`, `TABLE_VERSION`, `TERMINAL_ORDER_STATUSES`, `DOCUMENTED_ENDPOINTS`, `UNOFFERED_ENDPOINTS`, `UNREACHABLE_STATES`, `unofferedEndpoints`, `unreachableStates` | **production frontend** + backend |
22
- | `@fun-xyz/fiat-contract/moonpay` | zero deps | the MoonPay flow on `POST /fiat/next`: action requests, prompts, responses, fault types, and `MOONPAY_ENDPOINTS` | **production frontend** (MoonPay adapter) + backend |
22
+ | `@fun-xyz/fiat-contract/moonpay` | zero deps | the MoonPay flow on `POST /fiat/next`: action requests, next actions, responses, fault types, and `MOONPAY_ENDPOINTS` | **production frontend** (MoonPay adapter) + backend |
23
23
  | `@fun-xyz/fiat-contract/terms` | zero deps | the platform terms route: `TermsDocument`, `FiatTermsRequest`, `FiatTermsResponse`, fault types, and `FIAT_TERMS_ENDPOINT` | **production frontend** + backend |
24
24
  | `@fun-xyz/fiat-contract/routing` | zero deps | the routing table and routing quote: `FiatRoutingTableQuery`, `FiatRoutingTableResponse`, `FiatRoutingQuoteRequest`, both routes' error bodies, and `ROUTING_ENDPOINTS` | **production frontend** + backend |
25
25
  | `@fun-xyz/fiat-contract` | 47.6 KB, needs zod | the above + 77 zod schemas + assertions + 18 fixtures | tests, and backend dev/test guards |
@@ -121,7 +121,8 @@ text. `PROVIDER_CHECKOUT_DOCUMENTS` maps each provider to its current `CHECKOUT`
121
121
  stays valid: the backend refuses only an unknown version, a wrong digest, or an `acceptedAt` older
122
122
  than 5 minutes. A repeat of a version the login already holds writes nothing and returns the ids.
123
123
 
124
- **Routing table (`./routing`).** `ROUTING_ENDPOINTS.table` (`GET /fiat/routing/table`) answers,
124
+ **Routing table (`./routing`).** `ROUTING_ENDPOINTS.table` (`POST /fiat/routing/table`) takes a
125
+ `FiatRoutingTableRequest` body and answers,
125
126
  for each requested method, every amount interval and its providers best first, each with `next`
126
127
  (`READY`, `AUTH`, `DECLARATIVE_KYC`, `DOCUMENTARY_KYC`, `PENDING_REVIEW`) and `visibility`. The
127
128
  client shows min, max, provider and the Continue label for an amount with no call. A method with no
@@ -133,6 +134,14 @@ cause is unknown. Refetch the table at `expiresAt`, on `refreshLimits: true`, an
133
134
  a `REQUOTE`. The schemas hold the table's invariants: each method once, sorted, non-overlapping
134
135
  intervals, at least one provider each and none twice, and a reason only on an empty method.
135
136
 
137
+ `ROUTING_ENDPOINTS.table` (`POST /fiat/routing/table`) accepts `FiatRoutingTableRequest`:
138
+ `cryptoCurrencyCode`, `chainId`, `country`, optional `region` (required for US), `methods` (array),
139
+ optional `fiatCurrencyCode` (default `USD`), and optional `providers`.
140
+ See [`FiatRoutingTableMoonPayInputs`](src/routing.ts) for MoonPay credential handling.
141
+ Blank tokens, malformed inputs and unknown keys return 400: omit unavailable credentials and
142
+ deploy backend support before sending new provider keys.
143
+ `GET /fiat/routing/table` is deprecated but still works without provider inputs.
144
+
136
145
  `ROUTING_ENDPOINTS.quote` (`POST /fiat/routing/quote`) takes the `POST /fiat/quote` body
137
146
  (`FiatRoutingQuoteTerms`), plus one of two forms:
138
147
 
@@ -178,21 +187,21 @@ response), and the provider's own request, which names its `action`. The orchest
178
187
  `MoonPayNextRequest`, and every MoonPay request also carries the context `checkout` and, after
179
188
  `connect`, `credentials` (`customerId`, `accessToken`).
180
189
 
181
- Each `MoonPayAction` has one name. A response's prompt names it in `next` and carries what the
190
+ Each `MoonPayAction` has one name. A response names the next action in `next` and carries what the
182
191
  client needs; the client's request names it in `action` and carries the result:
183
192
 
184
- | Action | Prompt carries | Request carries | A repeat |
193
+ | Action | Next action carries | Request carries | A repeat |
185
194
  | --- | --- | --- | --- |
186
- | `observe` | no prompt: the answer is the current prompt | nothing | writes nothing |
195
+ | `observe` | no next action of its own: the answer is the current next action | nothing | writes nothing |
187
196
  | `consent` | `documents` (at least one, unique ids) | `acceptances`, the `POST /fiat/terms` items | writes nothing new |
188
197
  | `connect` | `sessionToken`, `quoteInput`, `resetConnection?` (`true` when the device's MoonPay connection is another buyer's) | `customerId`, `accessToken` | rebinds the same customer |
189
198
  | `kyc` | `fields`, `fieldErrors?` (each naming a field in `fields`, with `code?` `PHONE_IN_USE` on `PHONE_NUMBER` or `TAX_ID_IN_USE` on `TAX_IDENTIFIER` when another MoonPay customer holds the value) | `credentials`, `values` keyed by `KycFieldId` (no form id) | drops values MoonPay no longer asks for |
190
199
  | `wait` | `retryAfterMs` (at most 60 s) | no request: the client sends `observe` after the delay | |
191
200
  | `order` | `orderId`, `quoteInput` | `orderId`, `quotedAmount`, `transactionId?` | returns the recorded order |
192
201
 
193
- Every response is the next prompt, `done`, or `refused` (`MoonPayRefused`), and
202
+ Every response is the next action, `done`, or `refused` (`MoonPayRefused`), and
194
203
  `MoonPayResponseFor` maps each request action to its union. `observe`, `consent`, `connect` and `kyc`
195
- answer a `MoonPayStepResponse`: any `MoonPayPrompt`, or `refused` with `reason` (`NOT_ELIGIBLE`,
204
+ answer a `MoonPayStepResponse`: any `MoonPayNextAction`, or `refused` with `reason` (`NOT_ELIGIBLE`,
196
205
  `DOCUMENTS_REQUIRED`, `FINAL_REJECTION`, `CUSTOMER_MISMATCH`) and `recovery: REQUOTE | NONE`.
197
206
 
198
207
  `order` runs after every charge attempt, a failed one too, and answers a `MoonPayOrderResponse`:
@@ -212,7 +221,7 @@ plus `reason` and `recovery`. The reasons are `SESSION_BUDGET_SPENT`, `RATE_LIMI
212
221
  `PROVIDER_UNAVAILABLE` (MoonPay is down), `KYC_PROVIDER_UNAVAILABLE` (Sumsub is down),
213
222
  `SERVICE_UNAVAILABLE` (one of Fun's own stores is down) and `INVALID_REQUEST`. The recoveries are
214
223
  `RETRY` (send the same request again), `REQUOTE`, or `NONE`. A field error is a `kyc`
215
- prompt, not a fault. The zod schemas (`MoonPay*Schema`, `FiatGeoSchema`, `FiatNextRequestSchema`,
224
+ next action, not a fault. The zod schemas (`MoonPay*Schema`, `FiatGeoSchema`, `FiatNextRequestSchema`,
216
225
  `TermsDocumentSchema`, `FiatTerms*Schema`) are exported from the root only.
217
226
 
218
227
  ## KYC SDK hints, results, and client delivery
@@ -1,6 +1,6 @@
1
1
  // src/routing.ts
2
2
  var ROUTING_ENDPOINTS = {
3
- table: "GET /fiat/routing/table",
3
+ table: "POST /fiat/routing/table",
4
4
  /** Temporary: `POST /fiat/next` replaces it for each provider that moves there. */
5
5
  quote: "POST /fiat/routing/quote"
6
6
  };
@@ -8,4 +8,4 @@ var ROUTING_ENDPOINTS = {
8
8
  export {
9
9
  ROUTING_ENDPOINTS
10
10
  };
11
- //# sourceMappingURL=chunk-7ZIZANFX.mjs.map
11
+ //# sourceMappingURL=chunk-3SZPKXVL.mjs.map
@@ -6,4 +6,4 @@ var MOONPAY_ENDPOINTS = {
6
6
  export {
7
7
  MOONPAY_ENDPOINTS
8
8
  };
9
- //# sourceMappingURL=chunk-W5HOOK34.mjs.map
9
+ //# sourceMappingURL=chunk-F4NRKWF5.mjs.map
@@ -41,4 +41,4 @@ export {
41
41
  FUN_KYC_CONSENT_DOCUMENTS,
42
42
  PUBLISHED_TERMS_DOCUMENTS
43
43
  };
44
- //# sourceMappingURL=chunk-CRNKRIKR.mjs.map
44
+ //# sourceMappingURL=chunk-XKI5XTUO.mjs.map
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "0.27.0";
2
+ var version = "0.28.0";
3
3
 
4
4
  // src/table.ts
5
5
  var TABLE_VERSION = version;
@@ -514,4 +514,4 @@ export {
514
514
  tableEntry,
515
515
  isTerminal
516
516
  };
517
- //# sourceMappingURL=chunk-K573F2ON.mjs.map
517
+ //# sourceMappingURL=chunk-YNVLBTT7.mjs.map
package/dist/index.js CHANGED
@@ -50,6 +50,7 @@ __export(index_exports, {
50
50
  FiatRoutingQuoteTermsSchema: () => FiatRoutingQuoteTermsSchema,
51
51
  FiatRoutingTableErrorBodySchema: () => FiatRoutingTableErrorBodySchema,
52
52
  FiatRoutingTableQuerySchema: () => FiatRoutingTableQuerySchema,
53
+ FiatRoutingTableRequestSchema: () => FiatRoutingTableRequestSchema,
53
54
  FiatRoutingTableResponseSchema: () => FiatRoutingTableResponseSchema,
54
55
  FiatStepResponseSchema: () => FiatStepResponseSchema,
55
56
  FiatTermsErrorBodySchema: () => FiatTermsErrorBodySchema,
@@ -75,28 +76,28 @@ __export(index_exports, {
75
76
  KycSdkResultReportSchema: () => KycSdkResultReportSchema,
76
77
  MOONPAY_ENDPOINTS: () => MOONPAY_ENDPOINTS,
77
78
  MoonPayCheckoutSchema: () => MoonPayCheckoutSchema,
78
- MoonPayConnectPromptSchema: () => MoonPayConnectPromptSchema,
79
+ MoonPayConnectNextActionSchema: () => MoonPayConnectNextActionSchema,
79
80
  MoonPayConnectRequestSchema: () => MoonPayConnectRequestSchema,
80
- MoonPayConsentPromptSchema: () => MoonPayConsentPromptSchema,
81
+ MoonPayConsentNextActionSchema: () => MoonPayConsentNextActionSchema,
81
82
  MoonPayConsentRequestSchema: () => MoonPayConsentRequestSchema,
82
83
  MoonPayDoneSchema: () => MoonPayDoneSchema,
83
84
  MoonPayErrorBodySchema: () => MoonPayErrorBodySchema,
84
85
  MoonPayFaultSchema: () => MoonPayFaultSchema,
85
- MoonPayKycPromptSchema: () => MoonPayKycPromptSchema,
86
+ MoonPayKycNextActionSchema: () => MoonPayKycNextActionSchema,
86
87
  MoonPayKycRequestSchema: () => MoonPayKycRequestSchema,
88
+ MoonPayNextActionSchema: () => MoonPayNextActionSchema,
87
89
  MoonPayNextRequestSchema: () => MoonPayNextRequestSchema,
88
90
  MoonPayObserveRequestSchema: () => MoonPayObserveRequestSchema,
89
- MoonPayOrderPromptSchema: () => MoonPayOrderPromptSchema,
91
+ MoonPayOrderNextActionSchema: () => MoonPayOrderNextActionSchema,
90
92
  MoonPayOrderRequestSchema: () => MoonPayOrderRequestSchema,
91
93
  MoonPayOrderResponseSchema: () => MoonPayOrderResponseSchema,
92
- MoonPayPromptSchema: () => MoonPayPromptSchema,
93
94
  MoonPayQuoteInputSchema: () => MoonPayQuoteInputSchema,
94
95
  MoonPayRequestContextSchema: () => MoonPayRequestContextSchema,
95
96
  MoonPayRequestSchema: () => MoonPayRequestSchema,
96
97
  MoonPayResponseSchemaFor: () => MoonPayResponseSchemaFor,
97
98
  MoonPaySdkCredentialsSchema: () => MoonPaySdkCredentialsSchema,
98
99
  MoonPayStepResponseSchema: () => MoonPayStepResponseSchema,
99
- MoonPayWaitPromptSchema: () => MoonPayWaitPromptSchema,
100
+ MoonPayWaitNextActionSchema: () => MoonPayWaitNextActionSchema,
100
101
  OrderAwaitingConfirmationStateSchema: () => OrderAwaitingConfirmationStateSchema,
101
102
  OrderCreatedStateSchema: () => OrderCreatedStateSchema,
102
103
  OrderRefSchema: () => OrderRefSchema,
@@ -1059,6 +1060,20 @@ var $routingTableQuery = obj({
1059
1060
  )
1060
1061
  }).refine((query) => hasUsRegion(query.country, query.region), { message: US_REGION_REQUIRED, path: ["region"] });
1061
1062
  var FiatRoutingTableQuerySchema = $routingTableQuery;
1063
+ var $routingTableProviderInputs = obj({
1064
+ MOONPAY: obj({ accessToken: $nonBlank.optional() }).optional()
1065
+ });
1066
+ var $routingTableRequest = obj({
1067
+ fiatCurrencyCode: import_zod.z.enum(FIAT_CURRENCY_CODES).optional(),
1068
+ cryptoCurrencyCode: $nonBlank,
1069
+ chainId: $nonBlank,
1070
+ country: $countryCode,
1071
+ region: $optionalGeoField,
1072
+ // Duplicates are allowed; the response lists each method once.
1073
+ methods: import_zod.z.array(import_zod.z.enum(PAYMENT_METHOD_CATEGORIES)).min(1),
1074
+ providers: $routingTableProviderInputs.optional()
1075
+ }).refine((request) => hasUsRegion(request.country, request.region), { message: US_REGION_REQUIRED, path: ["region"] });
1076
+ var FiatRoutingTableRequestSchema = $routingTableRequest;
1062
1077
  var $routingTableProvider = obj({
1063
1078
  provider: $routingProvider,
1064
1079
  next: import_zod.z.enum(["READY", "AUTH", "DECLARATIVE_KYC", "DOCUMENTARY_KYC", "PENDING_REVIEW"]),
@@ -1217,7 +1232,7 @@ var $stepResponse = import_zod.z.union([$providerBoundStepResponse, $blockedStep
1217
1232
  var FiatStepResponseSchema = $stepResponse;
1218
1233
 
1219
1234
  // package.json
1220
- var version = "0.27.0";
1235
+ var version = "0.28.0";
1221
1236
 
1222
1237
  // src/table.ts
1223
1238
  var TABLE_VERSION = version;
@@ -2822,7 +2837,7 @@ var PUBLISHED_TERMS_DOCUMENTS = [MOONPAY_TERMS, ...Object.values(FUN_KYC_CONSENT
2822
2837
 
2823
2838
  // src/routing.ts
2824
2839
  var ROUTING_ENDPOINTS = {
2825
- table: "GET /fiat/routing/table",
2840
+ table: "POST /fiat/routing/table",
2826
2841
  /** Temporary: `POST /fiat/next` replaces it for each provider that moves there. */
2827
2842
  quote: "POST /fiat/routing/quote"
2828
2843
  };
@@ -2893,44 +2908,44 @@ var MoonPayNextRequestSchema = $nextRequest2;
2893
2908
  var FIELD_OF_CODE = { PHONE_IN_USE: "PHONE_NUMBER", TAX_ID_IN_USE: "TAX_IDENTIFIER" };
2894
2909
  var $fieldError = obj2({ fieldId: $nonEmpty, message: $nonEmpty, code: import_zod2.z.enum(["PHONE_IN_USE", "TAX_ID_IN_USE"]).optional() });
2895
2910
  var $consentShape = obj2({ next: import_zod2.z.literal("consent"), documents: import_zod2.z.array(TermsDocumentSchema).min(1) });
2896
- var $connectPrompt = obj2({
2911
+ var $connectNextAction = obj2({
2897
2912
  next: import_zod2.z.literal("connect"),
2898
2913
  sessionToken: $nonEmpty,
2899
2914
  quoteInput: $quoteInput,
2900
2915
  resetConnection: import_zod2.z.literal(true).optional()
2901
2916
  });
2902
2917
  var $kycShape = obj2({ next: import_zod2.z.literal("kyc"), fields: import_zod2.z.array(FormFieldSchema).min(1), fieldErrors: import_zod2.z.array($fieldError).min(1).optional() });
2903
- var $waitPrompt = obj2({ next: import_zod2.z.literal("wait"), retryAfterMs: import_zod2.z.number().int().positive().max(6e4) });
2904
- var $orderPrompt = obj2({ next: import_zod2.z.literal("order"), orderId: $nonEmpty, quoteInput: $quoteInput });
2905
- var checkConsent = (prompt, context) => {
2906
- if (!hasUniqueIds2(prompt.documents.map((document) => document.id))) {
2918
+ var $waitNextAction = obj2({ next: import_zod2.z.literal("wait"), retryAfterMs: import_zod2.z.number().int().positive().max(6e4) });
2919
+ var $orderNextAction = obj2({ next: import_zod2.z.literal("order"), orderId: $nonEmpty, quoteInput: $quoteInput });
2920
+ var checkConsent = (nextAction, context) => {
2921
+ if (!hasUniqueIds2(nextAction.documents.map((document) => document.id))) {
2907
2922
  context.addIssue({ code: "custom", path: ["documents"], message: "document ids must be unique" });
2908
2923
  }
2909
2924
  };
2910
- var checkKyc = (prompt, context) => {
2911
- const fieldIds = prompt.fields.map((field) => field.id);
2925
+ var checkKyc = (nextAction, context) => {
2926
+ const fieldIds = nextAction.fields.map((field) => field.id);
2912
2927
  if (!hasUniqueIds2(fieldIds)) {
2913
2928
  context.addIssue({ code: "custom", path: ["fields"], message: "field ids must be unique" });
2914
2929
  }
2915
- if (prompt.fieldErrors?.some((error) => !fieldIds.includes(error.fieldId))) {
2916
- context.addIssue({ code: "custom", path: ["fieldErrors"], message: "a field error must name a field in this prompt" });
2930
+ if (nextAction.fieldErrors?.some((error) => !fieldIds.includes(error.fieldId))) {
2931
+ context.addIssue({ code: "custom", path: ["fieldErrors"], message: "a field error must name a field in this next action" });
2917
2932
  }
2918
- if (prompt.fieldErrors?.some((error) => error.code && FIELD_OF_CODE[error.code] !== error.fieldId)) {
2933
+ if (nextAction.fieldErrors?.some((error) => error.code && FIELD_OF_CODE[error.code] !== error.fieldId)) {
2919
2934
  context.addIssue({ code: "custom", path: ["fieldErrors"], message: "a field error code must match its field" });
2920
2935
  }
2921
2936
  };
2922
- var MoonPayConsentPromptSchema = $consentShape.superRefine(checkConsent);
2923
- var MoonPayConnectPromptSchema = $connectPrompt;
2924
- var MoonPayKycPromptSchema = $kycShape.superRefine(checkKyc);
2925
- var MoonPayWaitPromptSchema = $waitPrompt;
2926
- var MoonPayOrderPromptSchema = $orderPrompt;
2927
- var checkPrompt = (response, context) => {
2937
+ var MoonPayConsentNextActionSchema = $consentShape.superRefine(checkConsent);
2938
+ var MoonPayConnectNextActionSchema = $connectNextAction;
2939
+ var MoonPayKycNextActionSchema = $kycShape.superRefine(checkKyc);
2940
+ var MoonPayWaitNextActionSchema = $waitNextAction;
2941
+ var MoonPayOrderNextActionSchema = $orderNextAction;
2942
+ var checkNextAction = (response, context) => {
2928
2943
  if (response.next === "consent") checkConsent(response, context);
2929
2944
  if (response.next === "kyc") checkKyc(response, context);
2930
2945
  };
2931
- var $promptOptions = [$consentShape, $connectPrompt, $kycShape, $waitPrompt, $orderPrompt];
2932
- var $prompt = import_zod2.z.discriminatedUnion("next", [...$promptOptions]).superRefine(checkPrompt);
2933
- var MoonPayPromptSchema = $prompt;
2946
+ var $nextActionOptions = [$consentShape, $connectNextAction, $kycShape, $waitNextAction, $orderNextAction];
2947
+ var $nextAction = import_zod2.z.discriminatedUnion("next", [...$nextActionOptions]).superRefine(checkNextAction);
2948
+ var MoonPayNextActionSchema = $nextAction;
2934
2949
  var $done = obj2({ next: import_zod2.z.literal("done"), order: FiatStepResponseSchema });
2935
2950
  var MoonPayDoneSchema = $done;
2936
2951
  var $stepRefused = obj2({
@@ -2943,9 +2958,9 @@ var $orderRefused = obj2({
2943
2958
  reason: import_zod2.z.enum(["CUSTOMER_MISMATCH", "WALLET_MISMATCH", "UNRECORDABLE"]),
2944
2959
  recovery: import_zod2.z.literal("NONE")
2945
2960
  });
2946
- var $stepResponse2 = import_zod2.z.discriminatedUnion("next", [...$promptOptions, $stepRefused]).superRefine(checkPrompt);
2961
+ var $stepResponse2 = import_zod2.z.discriminatedUnion("next", [...$nextActionOptions, $stepRefused]).superRefine(checkNextAction);
2947
2962
  var MoonPayStepResponseSchema = $stepResponse2;
2948
- var $orderResponse = import_zod2.z.discriminatedUnion("next", [$done, $orderPrompt, $orderRefused]);
2963
+ var $orderResponse = import_zod2.z.discriminatedUnion("next", [$done, $orderNextAction, $orderRefused]);
2949
2964
  var MoonPayOrderResponseSchema = $orderResponse;
2950
2965
  var MoonPayResponseSchemaFor = {
2951
2966
  observe: MoonPayStepResponseSchema,
package/dist/index.mjs CHANGED
@@ -12,19 +12,19 @@ import {
12
12
  tableEntry,
13
13
  unofferedEndpoints,
14
14
  unreachableStates
15
- } from "./chunk-K573F2ON.mjs";
15
+ } from "./chunk-YNVLBTT7.mjs";
16
16
  import {
17
17
  MOONPAY_ENDPOINTS
18
- } from "./chunk-W5HOOK34.mjs";
18
+ } from "./chunk-F4NRKWF5.mjs";
19
19
  import {
20
20
  FIAT_TERMS_ENDPOINT,
21
21
  FUN_KYC_CONSENT_DOCUMENTS,
22
22
  PROVIDER_CHECKOUT_DOCUMENTS,
23
23
  PUBLISHED_TERMS_DOCUMENTS
24
- } from "./chunk-CRNKRIKR.mjs";
24
+ } from "./chunk-XKI5XTUO.mjs";
25
25
  import {
26
26
  ROUTING_ENDPOINTS
27
- } from "./chunk-7ZIZANFX.mjs";
27
+ } from "./chunk-3SZPKXVL.mjs";
28
28
 
29
29
  // src/codes.ts
30
30
  var US_STATE_CODES = [
@@ -923,6 +923,20 @@ var $routingTableQuery = obj({
923
923
  )
924
924
  }).refine((query) => hasUsRegion(query.country, query.region), { message: US_REGION_REQUIRED, path: ["region"] });
925
925
  var FiatRoutingTableQuerySchema = $routingTableQuery;
926
+ var $routingTableProviderInputs = obj({
927
+ MOONPAY: obj({ accessToken: $nonBlank.optional() }).optional()
928
+ });
929
+ var $routingTableRequest = obj({
930
+ fiatCurrencyCode: z.enum(FIAT_CURRENCY_CODES).optional(),
931
+ cryptoCurrencyCode: $nonBlank,
932
+ chainId: $nonBlank,
933
+ country: $countryCode,
934
+ region: $optionalGeoField,
935
+ // Duplicates are allowed; the response lists each method once.
936
+ methods: z.array(z.enum(PAYMENT_METHOD_CATEGORIES)).min(1),
937
+ providers: $routingTableProviderInputs.optional()
938
+ }).refine((request) => hasUsRegion(request.country, request.region), { message: US_REGION_REQUIRED, path: ["region"] });
939
+ var FiatRoutingTableRequestSchema = $routingTableRequest;
926
940
  var $routingTableProvider = obj({
927
941
  provider: $routingProvider,
928
942
  next: z.enum(["READY", "AUTH", "DECLARATIVE_KYC", "DOCUMENTARY_KYC", "PENDING_REVIEW"]),
@@ -2206,44 +2220,44 @@ var MoonPayNextRequestSchema = $nextRequest2;
2206
2220
  var FIELD_OF_CODE = { PHONE_IN_USE: "PHONE_NUMBER", TAX_ID_IN_USE: "TAX_IDENTIFIER" };
2207
2221
  var $fieldError = obj2({ fieldId: $nonEmpty, message: $nonEmpty, code: z2.enum(["PHONE_IN_USE", "TAX_ID_IN_USE"]).optional() });
2208
2222
  var $consentShape = obj2({ next: z2.literal("consent"), documents: z2.array(TermsDocumentSchema).min(1) });
2209
- var $connectPrompt = obj2({
2223
+ var $connectNextAction = obj2({
2210
2224
  next: z2.literal("connect"),
2211
2225
  sessionToken: $nonEmpty,
2212
2226
  quoteInput: $quoteInput,
2213
2227
  resetConnection: z2.literal(true).optional()
2214
2228
  });
2215
2229
  var $kycShape = obj2({ next: z2.literal("kyc"), fields: z2.array(FormFieldSchema).min(1), fieldErrors: z2.array($fieldError).min(1).optional() });
2216
- var $waitPrompt = obj2({ next: z2.literal("wait"), retryAfterMs: z2.number().int().positive().max(6e4) });
2217
- var $orderPrompt = obj2({ next: z2.literal("order"), orderId: $nonEmpty, quoteInput: $quoteInput });
2218
- var checkConsent = (prompt, context) => {
2219
- if (!hasUniqueIds2(prompt.documents.map((document) => document.id))) {
2230
+ var $waitNextAction = obj2({ next: z2.literal("wait"), retryAfterMs: z2.number().int().positive().max(6e4) });
2231
+ var $orderNextAction = obj2({ next: z2.literal("order"), orderId: $nonEmpty, quoteInput: $quoteInput });
2232
+ var checkConsent = (nextAction, context) => {
2233
+ if (!hasUniqueIds2(nextAction.documents.map((document) => document.id))) {
2220
2234
  context.addIssue({ code: "custom", path: ["documents"], message: "document ids must be unique" });
2221
2235
  }
2222
2236
  };
2223
- var checkKyc = (prompt, context) => {
2224
- const fieldIds = prompt.fields.map((field) => field.id);
2237
+ var checkKyc = (nextAction, context) => {
2238
+ const fieldIds = nextAction.fields.map((field) => field.id);
2225
2239
  if (!hasUniqueIds2(fieldIds)) {
2226
2240
  context.addIssue({ code: "custom", path: ["fields"], message: "field ids must be unique" });
2227
2241
  }
2228
- if (prompt.fieldErrors?.some((error) => !fieldIds.includes(error.fieldId))) {
2229
- context.addIssue({ code: "custom", path: ["fieldErrors"], message: "a field error must name a field in this prompt" });
2242
+ if (nextAction.fieldErrors?.some((error) => !fieldIds.includes(error.fieldId))) {
2243
+ context.addIssue({ code: "custom", path: ["fieldErrors"], message: "a field error must name a field in this next action" });
2230
2244
  }
2231
- if (prompt.fieldErrors?.some((error) => error.code && FIELD_OF_CODE[error.code] !== error.fieldId)) {
2245
+ if (nextAction.fieldErrors?.some((error) => error.code && FIELD_OF_CODE[error.code] !== error.fieldId)) {
2232
2246
  context.addIssue({ code: "custom", path: ["fieldErrors"], message: "a field error code must match its field" });
2233
2247
  }
2234
2248
  };
2235
- var MoonPayConsentPromptSchema = $consentShape.superRefine(checkConsent);
2236
- var MoonPayConnectPromptSchema = $connectPrompt;
2237
- var MoonPayKycPromptSchema = $kycShape.superRefine(checkKyc);
2238
- var MoonPayWaitPromptSchema = $waitPrompt;
2239
- var MoonPayOrderPromptSchema = $orderPrompt;
2240
- var checkPrompt = (response, context) => {
2249
+ var MoonPayConsentNextActionSchema = $consentShape.superRefine(checkConsent);
2250
+ var MoonPayConnectNextActionSchema = $connectNextAction;
2251
+ var MoonPayKycNextActionSchema = $kycShape.superRefine(checkKyc);
2252
+ var MoonPayWaitNextActionSchema = $waitNextAction;
2253
+ var MoonPayOrderNextActionSchema = $orderNextAction;
2254
+ var checkNextAction = (response, context) => {
2241
2255
  if (response.next === "consent") checkConsent(response, context);
2242
2256
  if (response.next === "kyc") checkKyc(response, context);
2243
2257
  };
2244
- var $promptOptions = [$consentShape, $connectPrompt, $kycShape, $waitPrompt, $orderPrompt];
2245
- var $prompt = z2.discriminatedUnion("next", [...$promptOptions]).superRefine(checkPrompt);
2246
- var MoonPayPromptSchema = $prompt;
2258
+ var $nextActionOptions = [$consentShape, $connectNextAction, $kycShape, $waitNextAction, $orderNextAction];
2259
+ var $nextAction = z2.discriminatedUnion("next", [...$nextActionOptions]).superRefine(checkNextAction);
2260
+ var MoonPayNextActionSchema = $nextAction;
2247
2261
  var $done = obj2({ next: z2.literal("done"), order: FiatStepResponseSchema });
2248
2262
  var MoonPayDoneSchema = $done;
2249
2263
  var $stepRefused = obj2({
@@ -2256,9 +2270,9 @@ var $orderRefused = obj2({
2256
2270
  reason: z2.enum(["CUSTOMER_MISMATCH", "WALLET_MISMATCH", "UNRECORDABLE"]),
2257
2271
  recovery: z2.literal("NONE")
2258
2272
  });
2259
- var $stepResponse2 = z2.discriminatedUnion("next", [...$promptOptions, $stepRefused]).superRefine(checkPrompt);
2273
+ var $stepResponse2 = z2.discriminatedUnion("next", [...$nextActionOptions, $stepRefused]).superRefine(checkNextAction);
2260
2274
  var MoonPayStepResponseSchema = $stepResponse2;
2261
- var $orderResponse = z2.discriminatedUnion("next", [$done, $orderPrompt, $orderRefused]);
2275
+ var $orderResponse = z2.discriminatedUnion("next", [$done, $orderNextAction, $orderRefused]);
2262
2276
  var MoonPayOrderResponseSchema = $orderResponse;
2263
2277
  var MoonPayResponseSchemaFor = {
2264
2278
  observe: MoonPayStepResponseSchema,
@@ -2313,6 +2327,7 @@ export {
2313
2327
  FiatRoutingQuoteTermsSchema,
2314
2328
  FiatRoutingTableErrorBodySchema,
2315
2329
  FiatRoutingTableQuerySchema,
2330
+ FiatRoutingTableRequestSchema,
2316
2331
  FiatRoutingTableResponseSchema,
2317
2332
  FiatStepResponseSchema,
2318
2333
  FiatTermsErrorBodySchema,
@@ -2338,28 +2353,28 @@ export {
2338
2353
  KycSdkResultReportSchema,
2339
2354
  MOONPAY_ENDPOINTS,
2340
2355
  MoonPayCheckoutSchema,
2341
- MoonPayConnectPromptSchema,
2356
+ MoonPayConnectNextActionSchema,
2342
2357
  MoonPayConnectRequestSchema,
2343
- MoonPayConsentPromptSchema,
2358
+ MoonPayConsentNextActionSchema,
2344
2359
  MoonPayConsentRequestSchema,
2345
2360
  MoonPayDoneSchema,
2346
2361
  MoonPayErrorBodySchema,
2347
2362
  MoonPayFaultSchema,
2348
- MoonPayKycPromptSchema,
2363
+ MoonPayKycNextActionSchema,
2349
2364
  MoonPayKycRequestSchema,
2365
+ MoonPayNextActionSchema,
2350
2366
  MoonPayNextRequestSchema,
2351
2367
  MoonPayObserveRequestSchema,
2352
- MoonPayOrderPromptSchema,
2368
+ MoonPayOrderNextActionSchema,
2353
2369
  MoonPayOrderRequestSchema,
2354
2370
  MoonPayOrderResponseSchema,
2355
- MoonPayPromptSchema,
2356
2371
  MoonPayQuoteInputSchema,
2357
2372
  MoonPayRequestContextSchema,
2358
2373
  MoonPayRequestSchema,
2359
2374
  MoonPayResponseSchemaFor,
2360
2375
  MoonPaySdkCredentialsSchema,
2361
2376
  MoonPayStepResponseSchema,
2362
- MoonPayWaitPromptSchema,
2377
+ MoonPayWaitNextActionSchema,
2363
2378
  OrderAwaitingConfirmationStateSchema,
2364
2379
  OrderCreatedStateSchema,
2365
2380
  OrderRefSchema,
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * The MoonPay flow on `POST /fiat/next`.
3
3
  *
4
- * Each action has one name and two types. A response's prompt names it in `next` and carries what
4
+ * Each action has one name and two types. A response names the next action in `next` and carries what
5
5
  * the client needs to do it. The client's request names it in `action` and carries the result. Every
6
- * response is the next prompt, `done`, or `refused` (`MoonPayResponseFor`). `observe` carries no
7
- * result and answers the current prompt. `wait` has no request: the client sends `observe` after it.
6
+ * response is the next action, `done`, or `refused` (`MoonPayResponseFor`). `observe` carries no
7
+ * result and answers the current next action. `wait` has no request: the client sends `observe` after it.
8
8
  *
9
9
  * The body is `MoonPayNextRequest`: `provider`, the shared `geo`, the context (`checkout`, and
10
10
  * `credentials` after `connect`), and the action's result. Identity and the deposit wallet always
@@ -69,12 +69,12 @@ export interface MoonPayQuoteInput {
69
69
  };
70
70
  feeBehavior: 'inclusive';
71
71
  }
72
- /** No prompt of its own: the answer is the current prompt. Writes nothing. */
72
+ /** No next action of its own: the answer is the current next action. Writes nothing. */
73
73
  export type MoonPayObserveRequest = {
74
74
  action: 'observe';
75
75
  };
76
76
  /** MoonPay's terms first. Later, before `kyc`, Fun's KYC consent if the buyer has not accepted it. */
77
- export type MoonPayConsentPrompt = {
77
+ export type MoonPayConsentNextAction = {
78
78
  next: 'consent';
79
79
  documents: TermsDocument[];
80
80
  };
@@ -87,7 +87,7 @@ export type MoonPayConsentRequest = {
87
87
  * Run MoonPay's connection check with `sessionToken`; it asks for an OTP only if the hidden check
88
88
  * fails. `resetConnection`: the device's connection is another buyer's, so reset it first.
89
89
  */
90
- export type MoonPayConnectPrompt = {
90
+ export type MoonPayConnectNextAction = {
91
91
  next: 'connect';
92
92
  sessionToken: string;
93
93
  quoteInput: MoonPayQuoteInput;
@@ -101,7 +101,7 @@ export type MoonPayConnectRequest = {
101
101
  /** Another MoonPay customer already holds the value; only a different one goes through. */
102
102
  export type MoonPayFieldErrorCode = 'PHONE_IN_USE' | 'TAX_ID_IN_USE';
103
103
  /**
104
- * A reason on one field of a `kyc` prompt. `fieldId` names a field in that prompt. `code` is set
104
+ * A reason on one field of a `kyc` next action. `fieldId` names a field in that next action. `code` is set
105
105
  * only for a refusal the client words itself: `PHONE_IN_USE` on `PHONE_NUMBER`, `TAX_ID_IN_USE` on `TAX_IDENTIFIER`.
106
106
  */
107
107
  export interface MoonPayFieldError {
@@ -110,24 +110,24 @@ export interface MoonPayFieldError {
110
110
  code?: MoonPayFieldErrorCode;
111
111
  }
112
112
  /** Show the shared form. */
113
- export type MoonPayKycPrompt = {
113
+ export type MoonPayKycNextAction = {
114
114
  next: 'kyc';
115
115
  fields: FormField[];
116
116
  fieldErrors?: MoonPayFieldError[];
117
117
  };
118
- /** Keyed by the ids of the prompt's fields; there is no form id. Needs `credentials`: the backend reads the customer. */
118
+ /** Keyed by the ids of the next action's fields; there is no form id. Needs `credentials`: the backend reads the customer. */
119
119
  export type MoonPayKycRequest = {
120
120
  action: 'kyc';
121
121
  credentials: MoonPaySdkCredentials;
122
122
  values: Partial<Record<KycFieldId, string>>;
123
123
  };
124
124
  /** MoonPay is reviewing. No request of its own: send `observe` after the delay. */
125
- export type MoonPayWaitPrompt = {
125
+ export type MoonPayWaitNextAction = {
126
126
  next: 'wait';
127
127
  retryAfterMs: number;
128
128
  };
129
129
  /** Get the device quote from `quoteInput`, mount Apple Pay with `externalTransactionId = orderId`. */
130
- export type MoonPayOrderPrompt = {
130
+ export type MoonPayOrderNextAction = {
131
131
  next: 'order';
132
132
  orderId: string;
133
133
  quoteInput: MoonPayQuoteInput;
@@ -157,7 +157,7 @@ export type MoonPayStepRefusal = 'NOT_ELIGIBLE' | 'DOCUMENTS_REQUIRED' | 'FINAL_
157
157
  * assertion's. `UNRECORDABLE`: a charge no retry can record, held for refund review.
158
158
  */
159
159
  export type MoonPayOrderRefusal = 'CUSTOMER_MISMATCH' | 'WALLET_MISMATCH' | 'UNRECORDABLE';
160
- export type MoonPayPrompt = MoonPayConsentPrompt | MoonPayConnectPrompt | MoonPayKycPrompt | MoonPayWaitPrompt | MoonPayOrderPrompt;
160
+ export type MoonPayNextAction = MoonPayConsentNextAction | MoonPayConnectNextAction | MoonPayKycNextAction | MoonPayWaitNextAction | MoonPayOrderNextAction;
161
161
  /** `order` is the `GET /fiat/orders/:orderId` body; the shared order screen renders it. */
162
162
  export type MoonPayDone = {
163
163
  next: 'done';
@@ -170,13 +170,13 @@ export type MoonPayRefused<R, V> = {
170
170
  recovery: V;
171
171
  };
172
172
  /** The answer to `observe`, `consent`, `connect` and `kyc`. */
173
- export type MoonPayStepResponse = MoonPayPrompt | MoonPayRefused<MoonPayStepRefusal, 'REQUOTE' | 'NONE'>;
173
+ export type MoonPayStepResponse = MoonPayNextAction | MoonPayRefused<MoonPayStepRefusal, 'REQUOTE' | 'NONE'>;
174
174
  /**
175
175
  * The answer to `order`. A failed charge is recorded too: `done` with the order in `FAILED`, and the
176
176
  * client requotes for a new `orderId`. `order` again while MoonPay does not list the transaction
177
177
  * yet. A refusal after a charge never requotes: that would start a second payment.
178
178
  */
179
- export type MoonPayOrderResponse = MoonPayDone | MoonPayOrderPrompt | MoonPayRefused<MoonPayOrderRefusal, 'NONE'>;
179
+ export type MoonPayOrderResponse = MoonPayDone | MoonPayOrderNextAction | MoonPayRefused<MoonPayOrderRefusal, 'NONE'>;
180
180
  export type MoonPayResponseFor = {
181
181
  observe: MoonPayStepResponse;
182
182
  consent: MoonPayStepResponse;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MOONPAY_ENDPOINTS
3
- } from "../chunk-W5HOOK34.mjs";
3
+ } from "../chunk-F4NRKWF5.mjs";
4
4
  export {
5
5
  MOONPAY_ENDPOINTS
6
6
  };
@@ -3,7 +3,7 @@
3
3
  * exported from the package root, never from `./moonpay`, so the production entry stays free of zod.
4
4
  */
5
5
  import { z } from 'zod';
6
- import type { MoonPayCheckout, MoonPayConnectPrompt, MoonPayConnectRequest, MoonPayConsentPrompt, MoonPayConsentRequest, MoonPayDone, MoonPayErrorBody, MoonPayFault, MoonPayKycPrompt, MoonPayKycRequest, MoonPayNextRequest, MoonPayObserveRequest, MoonPayOrderPrompt, MoonPayOrderRequest, MoonPayOrderResponse, MoonPayPrompt, MoonPayQuoteInput, MoonPayRequest, MoonPayRequestContext, MoonPayResponseFor, MoonPaySdkCredentials, MoonPayStepResponse, MoonPayWaitPrompt } from './moonpay';
6
+ import type { MoonPayCheckout, MoonPayConnectNextAction, MoonPayConnectRequest, MoonPayConsentNextAction, MoonPayConsentRequest, MoonPayDone, MoonPayErrorBody, MoonPayFault, MoonPayKycNextAction, MoonPayKycRequest, MoonPayNextRequest, MoonPayObserveRequest, MoonPayOrderNextAction, MoonPayOrderRequest, MoonPayOrderResponse, MoonPayNextAction, MoonPayQuoteInput, MoonPayRequest, MoonPayRequestContext, MoonPayResponseFor, MoonPaySdkCredentials, MoonPayStepResponse, MoonPayWaitNextAction } from './moonpay';
7
7
  export declare const MoonPayCheckoutSchema: z.ZodType<MoonPayCheckout>;
8
8
  export declare const MoonPaySdkCredentialsSchema: z.ZodType<MoonPaySdkCredentials>;
9
9
  export declare const MoonPayRequestContextSchema: z.ZodType<MoonPayRequestContext>;
@@ -15,12 +15,12 @@ export declare const MoonPayKycRequestSchema: z.ZodType<MoonPayRequestContext &
15
15
  export declare const MoonPayOrderRequestSchema: z.ZodType<MoonPayRequestContext & MoonPayOrderRequest>;
16
16
  export declare const MoonPayRequestSchema: z.ZodType<MoonPayRequest>;
17
17
  export declare const MoonPayNextRequestSchema: z.ZodType<MoonPayNextRequest>;
18
- export declare const MoonPayConsentPromptSchema: z.ZodType<MoonPayConsentPrompt>;
19
- export declare const MoonPayConnectPromptSchema: z.ZodType<MoonPayConnectPrompt>;
20
- export declare const MoonPayKycPromptSchema: z.ZodType<MoonPayKycPrompt>;
21
- export declare const MoonPayWaitPromptSchema: z.ZodType<MoonPayWaitPrompt>;
22
- export declare const MoonPayOrderPromptSchema: z.ZodType<MoonPayOrderPrompt>;
23
- export declare const MoonPayPromptSchema: z.ZodType<MoonPayPrompt>;
18
+ export declare const MoonPayConsentNextActionSchema: z.ZodType<MoonPayConsentNextAction>;
19
+ export declare const MoonPayConnectNextActionSchema: z.ZodType<MoonPayConnectNextAction>;
20
+ export declare const MoonPayKycNextActionSchema: z.ZodType<MoonPayKycNextAction>;
21
+ export declare const MoonPayWaitNextActionSchema: z.ZodType<MoonPayWaitNextAction>;
22
+ export declare const MoonPayOrderNextActionSchema: z.ZodType<MoonPayOrderNextAction>;
23
+ export declare const MoonPayNextActionSchema: z.ZodType<MoonPayNextAction>;
24
24
  export declare const MoonPayDoneSchema: z.ZodType<MoonPayDone>;
25
25
  export declare const MoonPayStepResponseSchema: z.ZodType<MoonPayStepResponse>;
26
26
  export declare const MoonPayOrderResponseSchema: z.ZodType<MoonPayOrderResponse>;
package/dist/routing.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The routing table: `GET /fiat/routing/table` and `POST /fiat/routing/quote`.
2
+ * The routing table: `POST /fiat/routing/table` and `POST /fiat/routing/quote`.
3
3
  *
4
4
  * The client loads the table when the sheet opens. For each payment method it lists every amount
5
5
  * interval and the providers that serve it, best first, each with what it needs from the buyer next.
@@ -10,6 +10,9 @@
10
10
  * The table is advisory: every routing quote checks the named provider's eligibility again. Refetch it
11
11
  * at `expiresAt`, on `refreshLimits: true`, and after auth, KYC or a `REQUOTE` refusal.
12
12
  *
13
+ * Provider inputs are optional; see `FiatRoutingTableMoonPayInputs` for credential handling.
14
+ * Malformed inputs and unknown keys return 400. Deploy backend support before new provider keys.
15
+ *
13
16
  * Changes to both routes only add fields and enum values. Map an unknown `next` to the generic
14
17
  * Continue label.
15
18
  *
@@ -20,15 +23,45 @@
20
23
  import type { CountryCode, FiatCurrencyCode, PaymentMethodCategory } from './codes';
21
24
  import type { FiatAmount, FiatProvider, QuoteLimitRange } from './types';
22
25
  export declare const ROUTING_ENDPOINTS: {
23
- readonly table: "GET /fiat/routing/table";
26
+ readonly table: "POST /fiat/routing/table";
24
27
  /** Temporary: `POST /fiat/next` replaces it for each provider that moves there. */
25
28
  readonly quote: "POST /fiat/routing/quote";
26
29
  };
27
30
  /**
28
- * The query string of `GET /fiat/routing/table`. `country` and `region` are the geo endpoint's
29
- * `alpha2` and `region`, held to the `POST /fiat/quote` geo rules: a US buyer's `region` must be a
31
+ * MoonPay SDK access token (`client.getCredentials().accessToken`). The backend uses the
32
+ * authenticated quote's remaining limits, bounded by corridor limits. Missing, expired or
33
+ * provider-rejected tokens use corridor limits. Omit blank tokens. Sent in the body; never logged.
34
+ */
35
+ export interface FiatRoutingTableMoonPayInputs {
36
+ accessToken?: string;
37
+ }
38
+ /** Provider-specific inputs, keyed by `RoutingProvider`. All keys and fields are optional. */
39
+ export interface FiatRoutingTableProviderInputs {
40
+ MOONPAY?: FiatRoutingTableMoonPayInputs;
41
+ }
42
+ /**
43
+ * The body of `POST /fiat/routing/table`. `country` and `region` are the geo endpoint's `alpha2`
44
+ * and `region`, held to the `POST /fiat/quote` geo rules: a US buyer's `region` must be a
30
45
  * `UsStateCode`, and an empty `region` counts as absent.
31
46
  */
47
+ export interface FiatRoutingTableRequest {
48
+ /** Defaults to `USD`. */
49
+ fiatCurrencyCode?: FiatCurrencyCode;
50
+ cryptoCurrencyCode: string;
51
+ chainId: string;
52
+ country: CountryCode;
53
+ region?: string;
54
+ /** At least one. The response lists each once, in this order. */
55
+ methods: PaymentMethodCategory[];
56
+ /** Optional provider-specific inputs. */
57
+ providers?: FiatRoutingTableProviderInputs;
58
+ }
59
+ /**
60
+ * The query string of `GET /fiat/routing/table`, which `POST /fiat/routing/table` replaces.
61
+ *
62
+ * @deprecated Send a `FiatRoutingTableRequest` to `ROUTING_ENDPOINTS.table`. The GET route still
63
+ * answers while clients move, with no provider inputs.
64
+ */
32
65
  export interface FiatRoutingTableQuery {
33
66
  /** Defaults to `USD`. */
34
67
  fiatCurrencyCode?: FiatCurrencyCode;
@@ -174,7 +207,7 @@ export type RoutingRateLimitedErrorBody = ErrorBodyFields & {
174
207
  export type RoutingFaultErrorBody = ErrorBodyFields & {
175
208
  errorCode: string;
176
209
  };
177
- /** `GET /fiat/routing/table` refusals. */
210
+ /** Error bodies for the routing table endpoint (POST and deprecated GET). */
178
211
  export type FiatRoutingTableErrorBody = RoutingRateLimitedErrorBody | RoutingFaultErrorBody;
179
212
  /**
180
213
  * `POST /fiat/routing/quote` refusals. A `FiatNoRouteError` (any `reason`) or either amount error is
package/dist/routing.js CHANGED
@@ -24,7 +24,7 @@ __export(routing_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(routing_exports);
26
26
  var ROUTING_ENDPOINTS = {
27
- table: "GET /fiat/routing/table",
27
+ table: "POST /fiat/routing/table",
28
28
  /** Temporary: `POST /fiat/next` replaces it for each provider that moves there. */
29
29
  quote: "POST /fiat/routing/quote"
30
30
  };
package/dist/routing.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ROUTING_ENDPOINTS
3
- } from "./chunk-7ZIZANFX.mjs";
3
+ } from "./chunk-3SZPKXVL.mjs";
4
4
  export {
5
5
  ROUTING_ENDPOINTS
6
6
  };
package/dist/schemas.d.ts CHANGED
@@ -30,7 +30,7 @@ import { z } from 'zod';
30
30
  import type { UsStateCode } from './codes';
31
31
  import type { BlockedReason, CryptoAmount, FailureReason, FeeLine, FiatAmount, FiatEndpoint, FiatProvider, FiatStepResponse, FieldSpec, FlowState, FormDescriptor, FormField, FormFieldType, InstructionField, Instructions, Instrument, JsonValue, KYCProvider, 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';
32
32
  import type { FiatTermsErrorBody, FiatTermsRequest, FiatTermsResponse, TermsDocument, TermsDocumentAcceptance } from './terms';
33
- import type { FiatRoutingQuoteErrorBody, FiatRoutingQuoteRequest, FiatRoutingQuoteTerms, FiatRoutingTableErrorBody, FiatRoutingTableQuery, FiatRoutingTableResponse } from './routing';
33
+ import type { FiatRoutingQuoteErrorBody, FiatRoutingQuoteRequest, FiatRoutingQuoteTerms, FiatRoutingTableErrorBody, FiatRoutingTableQuery, FiatRoutingTableRequest, FiatRoutingTableResponse } from './routing';
34
34
  export declare const JsonSchema: z.ZodType<JsonValue>;
35
35
  export declare const HTTP_VERBS: readonly ["GET", "POST"];
36
36
  /** `"POST /fiat/session/verify"`, `"GET /fiat/orders/o_31c"` — the verb rides the string. */
@@ -112,7 +112,9 @@ export declare const TermsDocumentAcceptanceSchema: z.ZodType<TermsDocumentAccep
112
112
  export declare const FiatTermsRequestSchema: z.ZodType<FiatTermsRequest>;
113
113
  export declare const FiatTermsResponseSchema: z.ZodType<FiatTermsResponse>;
114
114
  export declare const FiatTermsErrorBodySchema: z.ZodType<FiatTermsErrorBody>;
115
+ /** @deprecated `GET /fiat/routing/table` is replaced by `POST /fiat/routing/table` (`FiatRoutingTableRequestSchema`). */
115
116
  export declare const FiatRoutingTableQuerySchema: z.ZodType<FiatRoutingTableQuery>;
117
+ export declare const FiatRoutingTableRequestSchema: z.ZodType<FiatRoutingTableRequest>;
116
118
  export declare const FiatRoutingTableResponseSchema: z.ZodType<FiatRoutingTableResponse>;
117
119
  export declare const FiatRoutingQuoteTermsSchema: z.ZodType<FiatRoutingQuoteTerms>;
118
120
  export declare const FiatRoutingQuoteRequestSchema: z.ZodType<FiatRoutingQuoteRequest>;
package/dist/table.js CHANGED
@@ -36,7 +36,7 @@ __export(table_exports, {
36
36
  module.exports = __toCommonJS(table_exports);
37
37
 
38
38
  // package.json
39
- var version = "0.27.0";
39
+ var version = "0.28.0";
40
40
 
41
41
  // src/table.ts
42
42
  var TABLE_VERSION = version;
package/dist/table.mjs CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  tableEntry,
12
12
  unofferedEndpoints,
13
13
  unreachableStates
14
- } from "./chunk-K573F2ON.mjs";
14
+ } from "./chunk-YNVLBTT7.mjs";
15
15
  export {
16
16
  DOCUMENTED_ENDPOINTS,
17
17
  STATE_KEYS,
package/dist/terms.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * The platform terms route: `POST /fiat/terms`, shared by every provider.
3
3
  *
4
4
  * A checkout shows the user documents to accept. `CHECKOUT` documents are the constants below;
5
- * `KYC` documents arrive in a provider flow's consent prompt. The user's Continue tap is the
5
+ * `KYC` documents arrive in a provider flow's consent next action. The user's Continue tap is the
6
6
  * acceptance, and the client records it here before the next provider call. A repeat writes nothing.
7
7
  *
8
8
  * Zero runtime dependencies, so production React Native code can import it. The zod schemas are
package/dist/terms.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  FUN_KYC_CONSENT_DOCUMENTS,
4
4
  PROVIDER_CHECKOUT_DOCUMENTS,
5
5
  PUBLISHED_TERMS_DOCUMENTS
6
- } from "./chunk-CRNKRIKR.mjs";
6
+ } from "./chunk-XKI5XTUO.mjs";
7
7
  export {
8
8
  FIAT_TERMS_ENDPOINT,
9
9
  FUN_KYC_CONSENT_DOCUMENTS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fun-xyz/fiat-contract",
3
- "version": "0.27.0",
3
+ "version": "0.28.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": {