@fun-xyz/fiat-contract 0.39.0 → 0.42.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/index.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import "./chunk-WBQAMGXK.mjs";
2
2
  import {
3
3
  DOCUMENTED_ENDPOINTS,
4
+ FUN_AUTH_ERROR_CODES,
4
5
  STATE_KEYS,
5
6
  TABLE_VERSION,
6
7
  TERMINAL_ORDER_STATUSES,
@@ -12,10 +13,14 @@ import {
12
13
  tableEntry,
13
14
  unofferedEndpoints,
14
15
  unreachableStates
15
- } from "./chunk-LMF4OMUW.mjs";
16
+ } from "./chunk-RGQE53YP.mjs";
16
17
  import {
17
18
  MOONPAY_ENDPOINTS
18
19
  } from "./chunk-TIEGTTFY.mjs";
20
+ import {
21
+ COINBASE_ENDPOINTS,
22
+ COINBASE_TERMS
23
+ } from "./chunk-SFR4SCDU.mjs";
19
24
  import {
20
25
  FIAT_TERMS_ENDPOINT,
21
26
  FUN_KYC_CONSENT_DOCUMENTS,
@@ -741,8 +746,6 @@ var $preparedPayment = obj({
741
746
  transition: $clientSurfaceTransition
742
747
  });
743
748
  var PreparedPaymentSchema = $preparedPayment;
744
- var $authChallenge = z.record(z.string(), JsonSchema);
745
- var AuthChallengeSchema = $authChallenge;
746
749
  var $quoteState = obj({
747
750
  kind: z.literal("QUOTE"),
748
751
  quote: $quote,
@@ -755,10 +758,20 @@ var $quoteState = obj({
755
758
  var QuoteStateSchema = $quoteState;
756
759
  var $funAuthState = obj({
757
760
  kind: z.literal("FUN_AUTH"),
758
- challenge: $authChallenge,
761
+ channel: z.enum(["EMAIL_OTP", "SMS_OTP"]),
762
+ phase: z.enum(["IDENTIFIER", "CODE", "VERIFIED"]),
763
+ expiresAtMs: z.number().int().nonnegative().optional(),
764
+ resendAvailableAtMs: z.number().int().nonnegative().optional(),
765
+ attemptsRemaining: z.number().int().nonnegative().optional(),
759
766
  error: $failureReason.optional()
760
767
  });
761
768
  var FunAuthStateSchema = $funAuthState;
769
+ var $fiatSession = obj({
770
+ accessToken: z.string().min(1),
771
+ refreshHandle: z.string().min(1),
772
+ expiresAtMs: z.number().int().nonnegative()
773
+ });
774
+ var FiatSessionSchema = $fiatSession;
762
775
  var $sessionAuthState = obj({
763
776
  kind: z.literal("SESSION_AUTH"),
764
777
  channel: z.enum(["EMAIL_OTP", "SMS_OTP", "PROVIDER_RENDERED"]),
@@ -864,7 +877,6 @@ var $deliveryState = z.discriminatedUnion("state", [
864
877
  var DeliveryStateSchema = $deliveryState;
865
878
  var $providerBoundFlowState = z.union([
866
879
  $quoteState,
867
- $funAuthState,
868
880
  $sessionAuthState,
869
881
  $kycCaptureState,
870
882
  $kycInputRequiredState,
@@ -876,7 +888,7 @@ var $providerBoundFlowState = z.union([
876
888
  $orderCreatedState,
877
889
  $deliveryState
878
890
  ]);
879
- var $flowState = z.union([$providerBoundFlowState, $blockedState]);
891
+ var $flowState = z.union([$providerBoundFlowState, $funAuthState, $blockedState]);
880
892
  var FlowStateSchema = $flowState;
881
893
  var $nonBlank = z.string().refine((value) => value.trim().length > 0, "must not be blank");
882
894
  var $isoInstant = z.string().datetime({ offset: true });
@@ -1083,12 +1095,18 @@ var $fiatGeo = obj({ alpha2: z.string().regex(/^[A-Z]{2}$/), region: $nonBlank.o
1083
1095
  var FiatGeoSchema = $fiatGeo;
1084
1096
  var $nextRequest = z.object({ provider: $provider, action: $nonBlank, geo: $fiatGeo, destinationAsset: $destinationAsset.optional() }).catchall(z.unknown());
1085
1097
  var FiatNextRequestSchema = $nextRequest;
1086
- var $providerBoundStepResponse = obj({
1087
- state: $providerBoundFlowState,
1088
- provider: $provider,
1098
+ var $authStartRequest = z.union([obj({ email: $nonBlank }), obj({ verificationRef: $nonBlank })]);
1099
+ var FiatAuthStartRequestSchema = $authStartRequest;
1100
+ var $authVerifyRequest = obj({ verificationRef: $nonBlank, otpCode: z.string().regex(/^\d{6}$/, "must be six digits") });
1101
+ var FiatAuthVerifyRequestSchema = $authVerifyRequest;
1102
+ var $authRefreshRequest = obj({ refreshHandle: $nonBlank });
1103
+ var FiatAuthRefreshRequestSchema = $authRefreshRequest;
1104
+ var $authRefreshResponse = obj({ session: $fiatSession });
1105
+ var FiatAuthRefreshResponseSchema = $authRefreshResponse;
1106
+ var $authRevokeRequest = obj({ refreshHandle: $nonBlank });
1107
+ var FiatAuthRevokeRequestSchema = $authRevokeRequest;
1108
+ var $stepResponseBase = {
1089
1109
  transitions: z.array($transition),
1090
- preparedPayment: $preparedPayment.optional(),
1091
- handoff: obj({ provider: $provider }).optional(),
1092
1110
  routingSessionRef: z.string().optional(),
1093
1111
  providerAuthToken: obj({
1094
1112
  clientSecret: z.string(),
@@ -1096,6 +1114,13 @@ var $providerBoundStepResponse = obj({
1096
1114
  }).optional(),
1097
1115
  orderId: z.string().optional(),
1098
1116
  refreshLimits: z.literal(true).optional()
1117
+ };
1118
+ var $providerBoundStepResponse = obj({
1119
+ ...$stepResponseBase,
1120
+ state: $providerBoundFlowState,
1121
+ provider: $provider,
1122
+ preparedPayment: $preparedPayment.optional(),
1123
+ handoff: obj({ provider: $provider }).optional()
1099
1124
  }).superRefine((response, context) => {
1100
1125
  if (response.preparedPayment !== void 0 && response.preparedPayment.surface.provider !== response.provider) {
1101
1126
  context.addIssue({
@@ -1127,18 +1152,37 @@ var $providerBoundStepResponse = obj({
1127
1152
  }
1128
1153
  });
1129
1154
  var $blockedStepResponse = obj({
1155
+ ...$stepResponseBase,
1130
1156
  state: $blockedState,
1157
+ provider: $provider.optional()
1158
+ });
1159
+ var FUN_AUTH_TRANSITIONS_BY_PHASE = {
1160
+ IDENTIFIER: ["start"],
1161
+ CODE: ["verify", "resend"],
1162
+ VERIFIED: []
1163
+ };
1164
+ var $funAuthStepResponse = obj({
1165
+ ...$stepResponseBase,
1166
+ state: $funAuthState,
1131
1167
  provider: $provider.optional(),
1132
- transitions: z.array($transition),
1133
- routingSessionRef: z.string().optional(),
1134
- providerAuthToken: obj({
1135
- clientSecret: z.string(),
1136
- expiresAt: z.string()
1137
- }).optional(),
1138
- orderId: z.string().optional(),
1139
- refreshLimits: z.literal(true).optional()
1168
+ session: $fiatSession.optional()
1169
+ }).superRefine((response, context) => {
1170
+ const { phase } = response.state;
1171
+ if (response.session !== void 0 && phase !== "VERIFIED") {
1172
+ context.addIssue({ code: "custom", path: ["session"], message: "only a FUN_AUTH response in phase VERIFIED carries session" });
1173
+ }
1174
+ const allowed = FUN_AUTH_TRANSITIONS_BY_PHASE[phase];
1175
+ response.transitions.forEach((transition, index) => {
1176
+ if (!allowed.includes(transition.id)) {
1177
+ context.addIssue({
1178
+ code: "custom",
1179
+ path: ["transitions", index, "id"],
1180
+ message: `FUN_AUTH phase ${phase} offers ${allowed.join(" or ") || "no transitions"}, not "${transition.id}"`
1181
+ });
1182
+ }
1183
+ });
1140
1184
  });
1141
- var $stepResponse = z.union([$providerBoundStepResponse, $blockedStepResponse]);
1185
+ var $stepResponse = z.union([$providerBoundStepResponse, $funAuthStepResponse, $blockedStepResponse]);
1142
1186
  var FiatStepResponseSchema = $stepResponse;
1143
1187
 
1144
1188
  // src/fixtures/data.ts
@@ -1180,6 +1224,79 @@ var FIXTURE_DATA = {
1180
1224
  "provider": "MOONPAY",
1181
1225
  "transitions": []
1182
1226
  },
1227
+ "fun-auth-01-identifier": {
1228
+ "state": {
1229
+ "kind": "FUN_AUTH",
1230
+ "channel": "EMAIL_OTP",
1231
+ "phase": "IDENTIFIER",
1232
+ "error": {
1233
+ "category": "USER_ERROR",
1234
+ "retryable": true,
1235
+ "recovery": "NONE",
1236
+ "code": "INVALID_EMAIL"
1237
+ }
1238
+ },
1239
+ "transitions": [
1240
+ {
1241
+ "id": "start",
1242
+ "mode": "SUBMIT",
1243
+ "endpoint": "POST /fiat/auth",
1244
+ "inputs": {
1245
+ "email": {
1246
+ "type": "TEXT"
1247
+ }
1248
+ }
1249
+ }
1250
+ ]
1251
+ },
1252
+ "fun-auth-02-code": {
1253
+ "state": {
1254
+ "kind": "FUN_AUTH",
1255
+ "channel": "EMAIL_OTP",
1256
+ "phase": "CODE",
1257
+ "expiresAtMs": 17600006e5,
1258
+ "resendAvailableAtMs": 176000006e4,
1259
+ "attemptsRemaining": 3
1260
+ },
1261
+ "transitions": [
1262
+ {
1263
+ "id": "verify",
1264
+ "mode": "SUBMIT",
1265
+ "endpoint": "POST /fiat/auth/verify",
1266
+ "params": {
1267
+ "verificationRef": "vr_7c1"
1268
+ },
1269
+ "inputs": {
1270
+ "otpCode": {
1271
+ "type": "TEXT",
1272
+ "length": 6,
1273
+ "regex": "^\\d{6}$"
1274
+ }
1275
+ }
1276
+ },
1277
+ {
1278
+ "id": "resend",
1279
+ "mode": "SUBMIT",
1280
+ "endpoint": "POST /fiat/auth",
1281
+ "params": {
1282
+ "verificationRef": "vr_7c1"
1283
+ }
1284
+ }
1285
+ ]
1286
+ },
1287
+ "fun-auth-03-verified": {
1288
+ "state": {
1289
+ "kind": "FUN_AUTH",
1290
+ "channel": "EMAIL_OTP",
1291
+ "phase": "VERIFIED"
1292
+ },
1293
+ "transitions": [],
1294
+ "session": {
1295
+ "accessToken": "<access-token>",
1296
+ "refreshHandle": "<refresh-handle>",
1297
+ "expiresAtMs": 176e10
1298
+ }
1299
+ },
1183
1300
  "screen-01-quote": {
1184
1301
  "state": {
1185
1302
  "kind": "QUOTE",
@@ -2007,6 +2124,36 @@ var FIXTURES = [
2007
2124
  screen: 2,
2008
2125
  stateKey: "SESSION_AUTH"
2009
2126
  },
2127
+ {
2128
+ id: "fun-auth-01-identifier",
2129
+ file: "fun-auth-01-identifier.json",
2130
+ source: "IDENTITY_DOC",
2131
+ docRef: "Fiat identity design doc (2026-10-20) \xB7 Contract changes",
2132
+ stateKey: "FUN_AUTH",
2133
+ notes: [
2134
+ "The server re-asks for the email after a start that failed with a user-correctable error. The first IDENTIFIER is entered client-side.",
2135
+ "No provider: FUN_AUTH runs before any provider is chosen."
2136
+ ]
2137
+ },
2138
+ {
2139
+ id: "fun-auth-02-code",
2140
+ file: "fun-auth-02-code.json",
2141
+ source: "IDENTITY_DOC",
2142
+ docRef: "Fiat identity design doc (2026-10-20) \xB7 Contract changes",
2143
+ stateKey: "FUN_AUTH",
2144
+ notes: ["verify and resend carry the same verificationRef; resend is usable once resendAvailableAtMs has passed."]
2145
+ },
2146
+ {
2147
+ id: "fun-auth-03-verified",
2148
+ file: "fun-auth-03-verified.json",
2149
+ source: "IDENTITY_DOC",
2150
+ docRef: "Fiat identity design doc (2026-10-20) \xB7 Contract changes",
2151
+ stateKey: "FUN_AUTH",
2152
+ notes: [
2153
+ "A Fun-run login: the envelope carries the Fun session and no transitions. The SDK then starts the flow at QUOTE with accessToken as Bearer.",
2154
+ "accessToken and refreshHandle are placeholders."
2155
+ ]
2156
+ },
2010
2157
  {
2011
2158
  id: "screen-03-kyc-input-required",
2012
2159
  file: "screen-03-kyc-input-required.json",
@@ -2197,12 +2344,7 @@ var FIXTURES = [
2197
2344
  ]
2198
2345
  }
2199
2346
  ];
2200
- var FIXTURE_COVERAGE_GAPS = [
2201
- {
2202
- stateKey: "FUN_AUTH",
2203
- reason: "No step response exists in either doc \u2014 shape owned by the auth spike, and FUN_AUTH never renders in fomo. TODO(open-decision): contract \xA7Auth & ref binding, item 5."
2204
- }
2205
- ];
2347
+ var FIXTURE_COVERAGE_GAPS = [];
2206
2348
  var fixtureMeta = (id) => {
2207
2349
  const meta = FIXTURES.find((f) => f.id === id);
2208
2350
  if (!meta) throw new Error(`unknown fixture: ${id}`);
@@ -2564,13 +2706,222 @@ var $fault = obj2($faultFields);
2564
2706
  var MoonPayFaultSchema = $fault;
2565
2707
  var $errorBody = obj2({ ...$faultFields, errorCode: $nonEmpty, errorMsg: z2.string(), reqId: z2.string().optional() });
2566
2708
  var MoonPayErrorBodySchema = $errorBody;
2709
+
2710
+ // src/providers/coinbase.schemas.ts
2711
+ import { z as z3 } from "zod";
2712
+ var obj3 = (shape) => z3.object(shape).strict();
2713
+ var $nonEmpty2 = z3.string().refine((value) => value.trim().length > 0, "must not be blank");
2714
+ var hasUniqueIds3 = (ids) => new Set(ids).size === ids.length;
2715
+ var $retryAfterMs = z3.number().int().positive().max(6e4);
2716
+ var $positiveAmount = z3.string().regex(/^(?:0|[1-9]\d*)(?:\.\d+)?$/, "must be a decimal string").refine((amount) => Number(amount) > 0, "must be positive");
2717
+ var $checkout2 = obj3({
2718
+ amount: obj3({ currency: z3.literal("USD"), amount: $positiveAmount }),
2719
+ destination: obj3({ asset: $nonEmpty2, network: $nonEmpty2 }),
2720
+ paymentMethod: z3.literal("apple_pay")
2721
+ });
2722
+ var CoinbaseCheckoutSchema = $checkout2;
2723
+ var contextFields = { checkout: $checkout2, destinationAsset: DestinationAssetSchema.optional() };
2724
+ var $requestContext2 = obj3(contextFields);
2725
+ var CoinbaseRequestContextSchema = $requestContext2;
2726
+ var observeFields = { action: z3.literal("observe") };
2727
+ var consentFields = {
2728
+ action: z3.literal("consent"),
2729
+ acceptances: z3.array(TermsDocumentAcceptanceSchema).min(1).refine((acceptances) => hasUniqueIds3(acceptances.map((acceptance) => acceptance.documentId)), "each document is accepted once")
2730
+ };
2731
+ var sessionPhoneFields = { action: z3.literal("session"), phoneNumber: z3.string().regex(/^\+[1-9]\d{1,14}$/) };
2732
+ var sessionResendFields = { action: z3.literal("session"), resend: $nonEmpty2 };
2733
+ var otpFields = { action: z3.literal("otp"), verificationRef: $nonEmpty2, otpCode: z3.string().regex(/^\d{6}$/) };
2734
+ var $kycValues = z3.record(KycFieldIdSchema, z3.string());
2735
+ var kycFields = { action: z3.literal("kyc"), values: $kycValues };
2736
+ var $mintedOrderId = z3.string().regex(/^cbo_[A-Za-z0-9_-]{22}$/, "must be an order id a placeOrder answer minted");
2737
+ var placeOrderFields = { action: z3.literal("placeOrder"), orderId: $mintedOrderId };
2738
+ var orderFields = { action: z3.literal("order"), orderId: $mintedOrderId };
2739
+ var $observeRequest2 = obj3({ ...contextFields, ...observeFields });
2740
+ var $consentRequest2 = obj3({ ...contextFields, ...consentFields });
2741
+ var $sessionRequest2 = z3.union([obj3({ ...contextFields, ...sessionPhoneFields }), obj3({ ...contextFields, ...sessionResendFields })]);
2742
+ var $otpRequest = obj3({ ...contextFields, ...otpFields });
2743
+ var $kycRequest2 = obj3({ ...contextFields, ...kycFields });
2744
+ var $placeOrderRequest = obj3({ ...contextFields, ...placeOrderFields });
2745
+ var $orderRequest2 = obj3({ ...contextFields, ...orderFields });
2746
+ var CoinbaseObserveRequestSchema = $observeRequest2;
2747
+ var CoinbaseConsentRequestSchema = $consentRequest2;
2748
+ var CoinbaseSessionRequestSchema = $sessionRequest2;
2749
+ var CoinbaseOtpRequestSchema = $otpRequest;
2750
+ var CoinbaseKycRequestSchema = $kycRequest2;
2751
+ var CoinbasePlaceOrderRequestSchema = $placeOrderRequest;
2752
+ var CoinbaseOrderRequestSchema = $orderRequest2;
2753
+ var $request2 = z3.union([$observeRequest2, $consentRequest2, $sessionRequest2, $otpRequest, $kycRequest2, $placeOrderRequest, $orderRequest2]);
2754
+ var CoinbaseRequestSchema = $request2;
2755
+ var envelope = { provider: z3.literal("COINBASE"), geo: FiatGeoSchema, ...contextFields };
2756
+ var $nextRequest3 = z3.union([
2757
+ obj3({ ...envelope, ...observeFields }),
2758
+ obj3({ ...envelope, ...consentFields }),
2759
+ obj3({ ...envelope, ...sessionPhoneFields }),
2760
+ obj3({ ...envelope, ...sessionResendFields }),
2761
+ obj3({ ...envelope, ...otpFields }),
2762
+ obj3({ ...envelope, ...kycFields }),
2763
+ obj3({ ...envelope, ...placeOrderFields }),
2764
+ obj3({ ...envelope, ...orderFields })
2765
+ ]);
2766
+ var CoinbaseNextRequestSchema = $nextRequest3;
2767
+ var $price = obj3({ total: FiatAmountSchema, fees: z3.array(FeeLineSchema), cryptoAmount: $nonEmpty2 });
2768
+ var CoinbasePriceSchema = $price;
2769
+ var $reask2 = obj3({
2770
+ requirements: z3.array(KycFieldIdSchema).min(1).refine(hasUniqueIds3, "requirements must be unique"),
2771
+ reason: z3.enum(["REJECTED"]).nullable()
2772
+ });
2773
+ var CoinbaseReaskSchema = $reask2;
2774
+ var $consentShape2 = obj3({ next: z3.literal("consent"), documents: z3.array(TermsDocumentSchema).min(1) });
2775
+ var $sessionNextAction2 = obj3({ next: z3.literal("session"), error: z3.literal("CODE_EXPIRED").nullable() });
2776
+ var $otpNextAction = obj3({
2777
+ next: z3.literal("otp"),
2778
+ verificationRef: $nonEmpty2,
2779
+ expiresAt: z3.string().datetime({ offset: true }),
2780
+ error: z3.literal("CODE_INVALID").nullable()
2781
+ });
2782
+ var $kycShape2 = obj3({
2783
+ next: z3.literal("kyc"),
2784
+ fields: z3.array(FormFieldSchema),
2785
+ fieldErrors: z3.array(obj3({ fieldId: $nonEmpty2, message: $nonEmpty2 })).min(1).optional(),
2786
+ reask: $reask2.nullable()
2787
+ });
2788
+ var $waitNextAction2 = obj3({ next: z3.literal("wait"), retryAfterMs: $retryAfterMs });
2789
+ var $placeOrderNextAction = obj3({ next: z3.literal("placeOrder"), price: $price, orderId: $nonEmpty2 });
2790
+ var $payNextAction = obj3({
2791
+ next: z3.literal("pay"),
2792
+ orderId: $nonEmpty2,
2793
+ price: $price,
2794
+ // As the shared links are checked: `z.string().url()` would also take `http:` and `javascript:`.
2795
+ paymentLink: obj3({ url: z3.string().regex(/^https:\/\/\S+$/, "must be an https URL") }),
2796
+ environment: z3.enum(["sandbox", "production"])
2797
+ });
2798
+ var $orderPendingNextAction2 = obj3({
2799
+ next: z3.literal("orderPending"),
2800
+ orderId: $nonEmpty2,
2801
+ retryAfterMs: $retryAfterMs,
2802
+ order: FiatStepResponseSchema.nullable()
2803
+ });
2804
+ var checkConsent2 = (nextAction, context) => {
2805
+ if (!hasUniqueIds3(nextAction.documents.map((document) => document.id))) {
2806
+ context.addIssue({ code: "custom", path: ["documents"], message: "document ids must be unique" });
2807
+ }
2808
+ };
2809
+ var checkKyc2 = (nextAction, context) => {
2810
+ const fieldIds = nextAction.fields.map((field) => field.id);
2811
+ if (!hasUniqueIds3(fieldIds)) {
2812
+ context.addIssue({ code: "custom", path: ["fields"], message: "field ids must be unique" });
2813
+ }
2814
+ if (nextAction.fieldErrors?.some((error) => !fieldIds.includes(error.fieldId))) {
2815
+ context.addIssue({ code: "custom", path: ["fieldErrors"], message: "a field error must name a field in this next action" });
2816
+ }
2817
+ if (nextAction.reask?.requirements.some((requirement) => !fieldIds.includes(requirement))) {
2818
+ context.addIssue({ code: "custom", path: ["reask"], message: "a kyc reask must name fields in this next action" });
2819
+ }
2820
+ };
2821
+ var CoinbaseConsentNextActionSchema = $consentShape2.superRefine(checkConsent2);
2822
+ var CoinbaseSessionNextActionSchema = $sessionNextAction2;
2823
+ var CoinbaseOtpNextActionSchema = $otpNextAction;
2824
+ var CoinbaseKycNextActionSchema = $kycShape2.superRefine(checkKyc2);
2825
+ var CoinbaseWaitNextActionSchema = $waitNextAction2;
2826
+ var CoinbasePlaceOrderNextActionSchema = $placeOrderNextAction;
2827
+ var CoinbasePayNextActionSchema = $payNextAction;
2828
+ var CoinbaseOrderPendingNextActionSchema = $orderPendingNextAction2;
2829
+ var checkNextAction2 = (response, context) => {
2830
+ if (response.next === "consent") checkConsent2(response, context);
2831
+ if (response.next === "kyc") checkKyc2(response, context);
2832
+ };
2833
+ var $nextActionOptions2 = [
2834
+ $consentShape2,
2835
+ $sessionNextAction2,
2836
+ $otpNextAction,
2837
+ $kycShape2,
2838
+ $waitNextAction2,
2839
+ $placeOrderNextAction,
2840
+ $payNextAction,
2841
+ $orderPendingNextAction2
2842
+ ];
2843
+ var $nextAction2 = z3.discriminatedUnion("next", [...$nextActionOptions2]).superRefine(checkNextAction2);
2844
+ var CoinbaseNextActionSchema = $nextAction2;
2845
+ var $done2 = obj3({ next: z3.literal("done"), order: FiatStepResponseSchema });
2846
+ var CoinbaseDoneSchema = $done2;
2847
+ var $refused = z3.union([
2848
+ obj3({
2849
+ next: z3.literal("refused"),
2850
+ reason: z3.enum(["NOT_ELIGIBLE", "KYC_UPGRADE_REJECTED", "FINAL_REJECTION", "TOTAL_MISMATCH"]),
2851
+ recovery: z3.enum(["REQUOTE", "NONE"])
2852
+ }),
2853
+ obj3({
2854
+ next: z3.literal("refused"),
2855
+ reason: z3.literal("LIMITS_EXCEEDED"),
2856
+ recovery: z3.literal("REQUOTE"),
2857
+ maxAmount: FiatAmountSchema.nullable()
2858
+ })
2859
+ ]);
2860
+ var CoinbaseRefusedSchema = $refused;
2861
+ var $stepResponse3 = z3.union([z3.discriminatedUnion("next", [...$nextActionOptions2, $done2]), $refused]).superRefine(checkNextAction2);
2862
+ var CoinbaseStepResponseSchema = $stepResponse3;
2863
+ var $orderResponse2 = z3.discriminatedUnion("next", [$done2, $orderPendingNextAction2]);
2864
+ var CoinbaseOrderResponseSchema = $orderResponse2;
2865
+ var CoinbaseResponseSchemaFor = {
2866
+ observe: CoinbaseStepResponseSchema,
2867
+ consent: CoinbaseStepResponseSchema,
2868
+ session: CoinbaseStepResponseSchema,
2869
+ otp: CoinbaseStepResponseSchema,
2870
+ kyc: CoinbaseStepResponseSchema,
2871
+ placeOrder: CoinbaseStepResponseSchema,
2872
+ order: CoinbaseOrderResponseSchema
2873
+ };
2874
+ var faultFields = {
2875
+ reason: z3.enum(["SESSION_BUDGET_SPENT", "RATE_LIMITED", "PROVIDER_UNAVAILABLE", "KYC_PROVIDER_UNAVAILABLE", "SERVICE_UNAVAILABLE", "INVALID_REQUEST"]),
2876
+ recovery: z3.enum(["RETRY", "REQUOTE", "NONE"])
2877
+ };
2878
+ var $fault2 = obj3(faultFields);
2879
+ var CoinbaseFaultSchema = $fault2;
2880
+ var $errorBody2 = obj3({
2881
+ ...faultFields,
2882
+ errorCode: $nonEmpty2,
2883
+ errorMsg: z3.string(),
2884
+ reqId: z3.string().optional(),
2885
+ retryAfterSeconds: z3.number().int().positive().optional()
2886
+ });
2887
+ var CoinbaseErrorBodySchema = $errorBody2;
2567
2888
  export {
2568
- AuthChallengeSchema,
2569
2889
  BlockedReasonSchema,
2570
2890
  BlockedStateSchema,
2891
+ COINBASE_ENDPOINTS,
2892
+ COINBASE_TERMS,
2571
2893
  COUNTRY_NAMES,
2572
2894
  COUNTRY_TO_CURRENCY,
2573
2895
  ClientExecutedDeliverySchema,
2896
+ CoinbaseCheckoutSchema,
2897
+ CoinbaseConsentNextActionSchema,
2898
+ CoinbaseConsentRequestSchema,
2899
+ CoinbaseDoneSchema,
2900
+ CoinbaseErrorBodySchema,
2901
+ CoinbaseFaultSchema,
2902
+ CoinbaseKycNextActionSchema,
2903
+ CoinbaseKycRequestSchema,
2904
+ CoinbaseNextActionSchema,
2905
+ CoinbaseNextRequestSchema,
2906
+ CoinbaseObserveRequestSchema,
2907
+ CoinbaseOrderPendingNextActionSchema,
2908
+ CoinbaseOrderRequestSchema,
2909
+ CoinbaseOrderResponseSchema,
2910
+ CoinbaseOtpNextActionSchema,
2911
+ CoinbaseOtpRequestSchema,
2912
+ CoinbasePayNextActionSchema,
2913
+ CoinbasePlaceOrderNextActionSchema,
2914
+ CoinbasePlaceOrderRequestSchema,
2915
+ CoinbasePriceSchema,
2916
+ CoinbaseReaskSchema,
2917
+ CoinbaseRefusedSchema,
2918
+ CoinbaseRequestContextSchema,
2919
+ CoinbaseRequestSchema,
2920
+ CoinbaseResponseSchemaFor,
2921
+ CoinbaseSessionNextActionSchema,
2922
+ CoinbaseSessionRequestSchema,
2923
+ CoinbaseStepResponseSchema,
2924
+ CoinbaseWaitNextActionSchema,
2574
2925
  ContractViolation,
2575
2926
  CountryCode,
2576
2927
  CryptoAmountSchema,
@@ -2583,10 +2934,16 @@ export {
2583
2934
  FIELD_SPEC_TYPES,
2584
2935
  FIXTURES,
2585
2936
  FIXTURE_COVERAGE_GAPS,
2937
+ FUN_AUTH_ERROR_CODES,
2586
2938
  FUN_KYC_CONSENT_DOCUMENTS,
2587
2939
  FailureReasonSchema,
2588
2940
  FeeLineSchema,
2589
2941
  FiatAmountSchema,
2942
+ FiatAuthRefreshRequestSchema,
2943
+ FiatAuthRefreshResponseSchema,
2944
+ FiatAuthRevokeRequestSchema,
2945
+ FiatAuthStartRequestSchema,
2946
+ FiatAuthVerifyRequestSchema,
2590
2947
  FiatCurrencyCode,
2591
2948
  FiatEndpointSchema,
2592
2949
  FiatGeoSchema,
@@ -2598,6 +2955,7 @@ export {
2598
2955
  FiatRoutingTableErrorBodySchema,
2599
2956
  FiatRoutingTableRequestSchema,
2600
2957
  FiatRoutingTableResponseSchema,
2958
+ FiatSessionSchema,
2601
2959
  FiatStepResponseSchema,
2602
2960
  FiatTermsErrorBodySchema,
2603
2961
  FiatTermsRequestSchema,