@fun-xyz/fiat-contract 0.45.0 → 0.47.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 ADDED
@@ -0,0 +1,10 @@
1
+ # Fiat contract
2
+
3
+ ## MoonPay guest provider
4
+
5
+ `MOONPAY_GUEST` owns guest checkout on `POST /fiat/next`; regular `MOONPAY` retains customer connection and KYC.
6
+ Select guest checkout through `routingOverrides.providers` on a quote (or the ordered `providers` list on a routing quote).
7
+ The backend requires explicit client selection and its own enablement switch. A guest quote answers `handoff: { provider: "MOONPAY_GUEST" }`.
8
+ Send `provider: "MOONPAY_GUEST"` on every next request, with no `path` or customer credentials.
9
+ After a guest refusal with `REQUOTE`, omit `MOONPAY_GUEST` from the next selection so `MOONPAY` remains available.
10
+ The separate `./moonpay-guest` entry exports its wire types; schemas are exported from the root.
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "0.45.0";
2
+ var version = "0.47.0";
3
3
 
4
4
  // src/table.ts
5
5
  var TABLE_VERSION = version;
File without changes
@@ -32,7 +32,8 @@ var MOONPAY_KYC_SHARING = {
32
32
  links: [{ label: "Persona Privacy Policy", url: "https://withpersona.com/legal/privacy-policy" }]
33
33
  };
34
34
  var PROVIDER_CHECKOUT_DOCUMENTS = {
35
- MOONPAY: [MOONPAY_TERMS]
35
+ MOONPAY: [MOONPAY_TERMS],
36
+ MOONPAY_GUEST: [MOONPAY_TERMS]
36
37
  };
37
38
  var PROVIDER_KYC_DOCUMENTS = {
38
39
  MOONPAY: [MOONPAY_KYC_SHARING]
package/dist/index.d.ts CHANGED
@@ -17,3 +17,5 @@ export * from './providers/moonpay.schemas';
17
17
  export * from './providers/coinbase';
18
18
  export * from './providers/coinbase.schemas';
19
19
  export { FIXTURES, FIXTURE_COVERAGE_GAPS, fixtureMeta, loadFixture, loadFixtures, type FixtureMeta, type FixtureSource, type LoadedFixture, } from './fixtures/index';
20
+ export * from './providers/moonpay-guest';
21
+ export * from './providers/moonpay-guest.schemas';
package/dist/index.js CHANGED
@@ -81,7 +81,6 @@ __export(index_exports, {
81
81
  FiatCurrencyCode: () => FiatCurrencyCode,
82
82
  FiatEndpointSchema: () => FiatEndpointSchema,
83
83
  FiatGeoSchema: () => FiatGeoSchema,
84
- FiatHandoffPathSchema: () => FiatHandoffPathSchema,
85
84
  FiatNextRequestSchema: () => FiatNextRequestSchema,
86
85
  FiatProviderSchema: () => FiatProviderSchema,
87
86
  FiatRoutingQuoteErrorBodySchema: () => FiatRoutingQuoteErrorBodySchema,
@@ -127,7 +126,20 @@ __export(index_exports, {
127
126
  MoonPayDoneSchema: () => MoonPayDoneSchema,
128
127
  MoonPayErrorBodySchema: () => MoonPayErrorBodySchema,
129
128
  MoonPayFaultSchema: () => MoonPayFaultSchema,
129
+ MoonPayGuestConsentRequestSchema: () => MoonPayGuestConsentRequestSchema,
130
130
  MoonPayGuestDeclineReasonSchema: () => MoonPayGuestDeclineReasonSchema,
131
+ MoonPayGuestDeclineRequestSchema: () => MoonPayGuestDeclineRequestSchema,
132
+ MoonPayGuestNextRequestSchema: () => MoonPayGuestNextRequestSchema,
133
+ MoonPayGuestObserveRequestSchema: () => MoonPayGuestObserveRequestSchema,
134
+ MoonPayGuestOrderRequestSchema: () => MoonPayGuestOrderRequestSchema,
135
+ MoonPayGuestPhoneCodeRequestSchema: () => MoonPayGuestPhoneCodeRequestSchema,
136
+ MoonPayGuestPhoneNumberRequestSchema: () => MoonPayGuestPhoneNumberRequestSchema,
137
+ MoonPayGuestPhoneRequestSchema: () => MoonPayGuestPhoneRequestSchema,
138
+ MoonPayGuestPhoneResendRequestSchema: () => MoonPayGuestPhoneResendRequestSchema,
139
+ MoonPayGuestRequestSchema: () => MoonPayGuestRequestSchema,
140
+ MoonPayGuestResponseSchema: () => MoonPayGuestResponseSchema,
141
+ MoonPayGuestSessionRequestSchema: () => MoonPayGuestSessionRequestSchema,
142
+ MoonPayGuestStepResponseSchema: () => MoonPayGuestStepResponseSchema,
131
143
  MoonPayKycNextActionSchema: () => MoonPayKycNextActionSchema,
132
144
  MoonPayKycRequestSchema: () => MoonPayKycRequestSchema,
133
145
  MoonPayNextActionSchema: () => MoonPayNextActionSchema,
@@ -137,8 +149,11 @@ __export(index_exports, {
137
149
  MoonPayOrderPendingNextActionSchema: () => MoonPayOrderPendingNextActionSchema,
138
150
  MoonPayOrderRequestSchema: () => MoonPayOrderRequestSchema,
139
151
  MoonPayOrderResponseSchema: () => MoonPayOrderResponseSchema,
140
- MoonPayPathSchema: () => MoonPayPathSchema,
141
152
  MoonPayPayNextActionSchema: () => MoonPayPayNextActionSchema,
153
+ MoonPayPhoneCodeNextActionSchema: () => MoonPayPhoneCodeNextActionSchema,
154
+ MoonPayPhoneCodeRequestSchema: () => MoonPayPhoneCodeRequestSchema,
155
+ MoonPayPhoneNextActionSchema: () => MoonPayPhoneNextActionSchema,
156
+ MoonPayPhoneRequestSchema: () => MoonPayPhoneRequestSchema,
142
157
  MoonPayPrepareCaptureNextActionSchema: () => MoonPayPrepareCaptureNextActionSchema,
143
158
  MoonPayPrepareCaptureRequestSchema: () => MoonPayPrepareCaptureRequestSchema,
144
159
  MoonPayQuoteInputSchema: () => MoonPayQuoteInputSchema,
@@ -564,15 +579,12 @@ var $provider = import_zod.z.enum([
564
579
  "SWAPPED",
565
580
  "BANXA",
566
581
  "MOONPAY",
582
+ "MOONPAY_GUEST",
567
583
  "STRIPE",
568
584
  "COINBASE",
569
585
  "CROSSMINT"
570
586
  ]);
571
587
  var FiatProviderSchema = $provider;
572
- var HANDOFF_PATHS = ["MOONPAY/guest_checkout"];
573
- var $handoffPath = import_zod.z.enum(HANDOFF_PATHS);
574
- var FiatHandoffPathSchema = $handoffPath;
575
- var $handoffPathName = import_zod.z.literal("guest_checkout");
576
588
  var $kycProvider = import_zod.z.enum(["SUMSUB"]);
577
589
  var KYCProviderSchema = $kycProvider;
578
590
  var $surfaceProvider = import_zod.z.enum([...$provider.options, ...$kycProvider.options]);
@@ -754,9 +766,9 @@ var $clientExecutedDelivery = obj({
754
766
  channel: import_zod.z.literal("CLIENT_EXECUTED"),
755
767
  source: import_zod.z.literal("CURRENT_SESSION_INPUTS"),
756
768
  allowedFieldIds: import_zod.z.array($kycFieldId).min(1)
757
- }).superRefine((delivery, context) => {
769
+ }).superRefine((delivery, context2) => {
758
770
  if (new Set(delivery.allowedFieldIds).size !== delivery.allowedFieldIds.length) {
759
- context.addIssue({
771
+ context2.addIssue({
760
772
  code: "custom",
761
773
  path: ["allowedFieldIds"],
762
774
  message: "allowedFieldIds must be unique"
@@ -1165,7 +1177,7 @@ var compareDecimals = (left, right) => {
1165
1177
  return leftDigits < rightDigits ? -1 : leftDigits > rightDigits ? 1 : 0;
1166
1178
  };
1167
1179
  var $countryCode = import_zod.z.enum(Object.keys(CountryCode));
1168
- var $routingProvider = $provider.extract(["TRANSAK", "BANXA", "MOONPAY", "STRIPE", "COINBASE"]);
1180
+ var $routingProvider = $provider.extract(["TRANSAK", "BANXA", "MOONPAY", "MOONPAY_GUEST", "STRIPE", "COINBASE"]);
1169
1181
  var $optionalGeoField = import_zod.z.union([$nonBlank, import_zod.z.literal("")]).optional();
1170
1182
  var US_REGION_REQUIRED = "a US buyer needs a US state code as region";
1171
1183
  var hasUsRegion = (country, region) => country !== "US" || UsStateCodeSchema.safeParse(region).success;
@@ -1181,7 +1193,8 @@ var $routingTableRequest = obj({
1181
1193
  // Duplicates are allowed; the response lists each method once.
1182
1194
  methods: import_zod.z.array(import_zod.z.enum(PAYMENT_METHOD_CATEGORIES)).min(1),
1183
1195
  providers: $routingTableProviderInputs.optional(),
1184
- destinationAsset: $destinationAsset.optional()
1196
+ destinationAsset: $destinationAsset.optional(),
1197
+ depositAddress: $nonBlank.optional()
1185
1198
  }).refine((request) => hasUsRegion(request.country, request.region), { message: US_REGION_REQUIRED, path: ["region"] });
1186
1199
  var FiatRoutingTableRequestSchema = $routingTableRequest;
1187
1200
  var $routingTableProvider = obj({
@@ -1198,11 +1211,11 @@ var $routingTableInterval = obj({
1198
1211
  var $routingTableMethod = obj({
1199
1212
  method: import_zod.z.enum(PAYMENT_METHOD_CATEGORIES),
1200
1213
  unavailableReason: import_zod.z.enum(["USER_LIMIT", "KYC_REJECTED", "PROVIDER_OUTAGE", "NOT_SERVED"]).optional(),
1201
- intervals: import_zod.z.array($routingTableInterval).superRefine((intervals, context) => {
1214
+ intervals: import_zod.z.array($routingTableInterval).superRefine((intervals, context2) => {
1202
1215
  intervals.forEach((interval, index) => {
1203
1216
  const previous = intervals[index - 1];
1204
1217
  if (previous !== void 0 && compareDecimals(interval.min, previous.max) <= 0) {
1205
- context.addIssue({ code: "custom", path: [index, "min"], message: "intervals are sorted and do not overlap" });
1218
+ context2.addIssue({ code: "custom", path: [index, "min"], message: "intervals are sorted and do not overlap" });
1206
1219
  }
1207
1220
  });
1208
1221
  })
@@ -1229,7 +1242,7 @@ var $routingQuoteTermsShape = {
1229
1242
  prepareSessionAuth: import_zod.z.boolean().optional(),
1230
1243
  routingOverrides: obj({ providers: import_zod.z.array($routingProvider) }).optional(),
1231
1244
  destinationAsset: $destinationAsset.optional(),
1232
- handoffPaths: import_zod.z.array($handoffPath).refine(hasUniqueIds, "each handoff path is listed once").optional()
1245
+ depositAddress: $nonBlank.optional()
1233
1246
  };
1234
1247
  var $routingQuoteTerms = obj($routingQuoteTermsShape);
1235
1248
  var FiatRoutingQuoteTermsSchema = $routingQuoteTerms;
@@ -1285,7 +1298,13 @@ var $routingQuoteErrorBody = import_zod.z.union([$routingNoRouteErrorBody, $rout
1285
1298
  var FiatRoutingQuoteErrorBodySchema = $routingQuoteErrorBody;
1286
1299
  var $fiatGeo = obj({ alpha2: import_zod.z.string().regex(/^[A-Z]{2}$/), region: $nonBlank.optional(), ip: $nonBlank.optional() });
1287
1300
  var FiatGeoSchema = $fiatGeo;
1288
- var $nextRequest = import_zod.z.object({ provider: $provider, action: $nonBlank, geo: $fiatGeo, destinationAsset: $destinationAsset.optional() }).catchall(import_zod.z.unknown());
1301
+ var $nextRequest = import_zod.z.object({
1302
+ provider: $provider,
1303
+ action: $nonBlank,
1304
+ geo: $fiatGeo,
1305
+ destinationAsset: $destinationAsset.optional(),
1306
+ depositAddress: $nonBlank.optional()
1307
+ }).catchall(import_zod.z.unknown());
1289
1308
  var FiatNextRequestSchema = $nextRequest;
1290
1309
  var $authStartRequest = import_zod.z.union([obj({ email: $nonBlank }), obj({ verificationRef: $nonBlank })]);
1291
1310
  var FiatAuthStartRequestSchema = $authStartRequest;
@@ -1312,38 +1331,31 @@ var $providerBoundStepResponse = obj({
1312
1331
  state: $providerBoundFlowState,
1313
1332
  provider: $provider,
1314
1333
  preparedPayment: $preparedPayment.optional(),
1315
- handoff: obj({ provider: $provider, path: $handoffPathName.optional() }).optional()
1316
- }).superRefine((response, context) => {
1334
+ handoff: obj({ provider: $provider }).optional()
1335
+ }).superRefine((response, context2) => {
1317
1336
  if (response.preparedPayment !== void 0 && response.preparedPayment.surface.provider !== response.provider) {
1318
- context.addIssue({
1337
+ context2.addIssue({
1319
1338
  code: "custom",
1320
1339
  path: ["preparedPayment", "surface", "provider"],
1321
1340
  message: "preparedPayment.surface.provider must match the response provider"
1322
1341
  });
1323
1342
  }
1324
1343
  if (response.handoff !== void 0 && response.handoff.provider !== response.provider) {
1325
- context.addIssue({
1344
+ context2.addIssue({
1326
1345
  code: "custom",
1327
1346
  path: ["handoff", "provider"],
1328
1347
  message: "handoff.provider must match the response provider"
1329
1348
  });
1330
1349
  }
1331
- if (response.handoff?.path !== void 0 && !HANDOFF_PATHS.includes(`${response.handoff.provider}/${response.handoff.path}`)) {
1332
- context.addIssue({
1333
- code: "custom",
1334
- path: ["handoff", "path"],
1335
- message: "handoff.path must name a handoff path of handoff.provider"
1336
- });
1337
- }
1338
1350
  if (response.handoff !== void 0 && response.state.kind !== "QUOTE") {
1339
- context.addIssue({
1351
+ context2.addIssue({
1340
1352
  code: "custom",
1341
1353
  path: ["handoff"],
1342
1354
  message: "only a QUOTE response hands off to a provider"
1343
1355
  });
1344
1356
  }
1345
1357
  if (response.handoff !== void 0 && response.transitions.length > 0) {
1346
- context.addIssue({
1358
+ context2.addIssue({
1347
1359
  code: "custom",
1348
1360
  path: ["transitions"],
1349
1361
  message: "a handoff response carries no transitions"
@@ -1365,15 +1377,15 @@ var $funAuthStepResponse = obj({
1365
1377
  state: $funAuthState,
1366
1378
  provider: $provider.optional(),
1367
1379
  session: $fiatSession.optional()
1368
- }).superRefine((response, context) => {
1380
+ }).superRefine((response, context2) => {
1369
1381
  const { phase } = response.state;
1370
1382
  if (response.session !== void 0 && phase !== "VERIFIED") {
1371
- context.addIssue({ code: "custom", path: ["session"], message: "only a FUN_AUTH response in phase VERIFIED carries session" });
1383
+ context2.addIssue({ code: "custom", path: ["session"], message: "only a FUN_AUTH response in phase VERIFIED carries session" });
1372
1384
  }
1373
1385
  const allowed = FUN_AUTH_TRANSITIONS_BY_PHASE[phase];
1374
1386
  response.transitions.forEach((transition, index) => {
1375
1387
  if (!allowed.includes(transition.id)) {
1376
- context.addIssue({
1388
+ context2.addIssue({
1377
1389
  code: "custom",
1378
1390
  path: ["transitions", index, "id"],
1379
1391
  message: `FUN_AUTH phase ${phase} offers ${allowed.join(" or ") || "no transitions"}, not "${transition.id}"`
@@ -1385,7 +1397,7 @@ var $stepResponse = import_zod.z.union([$providerBoundStepResponse, $funAuthStep
1385
1397
  var FiatStepResponseSchema = $stepResponse;
1386
1398
 
1387
1399
  // package.json
1388
- var version = "0.45.0";
1400
+ var version = "0.47.0";
1389
1401
 
1390
1402
  // src/table.ts
1391
1403
  var TABLE_VERSION = version;
@@ -3333,7 +3345,8 @@ var MOONPAY_KYC_SHARING = {
3333
3345
  links: [{ label: "Persona Privacy Policy", url: "https://withpersona.com/legal/privacy-policy" }]
3334
3346
  };
3335
3347
  var PROVIDER_CHECKOUT_DOCUMENTS = {
3336
- MOONPAY: [MOONPAY_TERMS]
3348
+ MOONPAY: [MOONPAY_TERMS],
3349
+ MOONPAY_GUEST: [MOONPAY_TERMS]
3337
3350
  };
3338
3351
  var PROVIDER_KYC_DOCUMENTS = {
3339
3352
  MOONPAY: [MOONPAY_KYC_SHARING]
@@ -3389,13 +3402,10 @@ var $checkout = obj2({
3389
3402
  var MoonPayCheckoutSchema = $checkout;
3390
3403
  var $credentials = obj2({ customerId: $nonEmpty, accessToken: $nonEmpty });
3391
3404
  var MoonPaySdkCredentialsSchema = $credentials;
3392
- var $path = import_zod2.z.literal("guest_checkout");
3393
- var MoonPayPathSchema = $path;
3394
3405
  var $context = {
3395
3406
  checkout: $checkout,
3396
3407
  credentials: $credentials.optional(),
3397
- destinationAsset: DestinationAssetSchema.optional(),
3398
- path: $path.optional()
3408
+ destinationAsset: DestinationAssetSchema.optional()
3399
3409
  };
3400
3410
  var $requestContext = obj2($context);
3401
3411
  var MoonPayRequestContextSchema = $requestContext;
@@ -3414,6 +3424,9 @@ var $consentFields = {
3414
3424
  };
3415
3425
  var $sessionFields = { action: import_zod2.z.literal("session") };
3416
3426
  var $connectFields = { action: import_zod2.z.literal("connect"), customerId: $nonEmpty, accessToken: $nonEmpty };
3427
+ var $phoneNumberFields = { action: import_zod2.z.literal("phone"), phoneNumber: import_zod2.z.string().regex(/^\+[1-9]\d{1,14}$/) };
3428
+ var $phoneResendFields = { action: import_zod2.z.literal("phone"), resend: $nonEmpty };
3429
+ var $phoneCodeFields = { action: import_zod2.z.literal("phoneCode"), verificationRef: $nonEmpty, otpCode: import_zod2.z.string().regex(/^\d{6}$/) };
3417
3430
  var $guestDeclineReason = import_zod2.z.enum(["NOT_OFFERED", "MISMATCH", "OVER_LIMIT"]);
3418
3431
  var MoonPayGuestDeclineReasonSchema = $guestDeclineReason;
3419
3432
  var $declineFields = { action: import_zod2.z.literal("decline"), reason: $guestDeclineReason };
@@ -3429,6 +3442,8 @@ var $observeRequest = obj2({ ...$context, ...$observeFields });
3429
3442
  var $consentRequest = obj2({ ...$context, ...$consentFields });
3430
3443
  var $sessionRequest = obj2({ ...$context, ...$sessionFields });
3431
3444
  var $connectRequest = obj2({ ...$context, ...$connectFields });
3445
+ var $phoneRequest = import_zod2.z.union([obj2({ ...$context, ...$phoneNumberFields }), obj2({ ...$context, ...$phoneResendFields })]);
3446
+ var $phoneCodeRequest = obj2({ ...$context, ...$phoneCodeFields });
3432
3447
  var $declineRequest = obj2({ ...$context, ...$declineFields });
3433
3448
  var $kycRequest = obj2({ ...$context, ...$kycFields });
3434
3449
  var $prepareCaptureRequest = obj2({ ...$context, ...$prepareCaptureFields });
@@ -3438,30 +3453,30 @@ var MoonPayObserveRequestSchema = $observeRequest;
3438
3453
  var MoonPayConsentRequestSchema = $consentRequest;
3439
3454
  var MoonPaySessionRequestSchema = $sessionRequest;
3440
3455
  var MoonPayConnectRequestSchema = $connectRequest;
3456
+ var MoonPayPhoneRequestSchema = $phoneRequest;
3457
+ var MoonPayPhoneCodeRequestSchema = $phoneCodeRequest;
3441
3458
  var MoonPayDeclineRequestSchema = $declineRequest;
3442
3459
  var MoonPayKycRequestSchema = $kycRequest;
3443
3460
  var MoonPayPrepareCaptureRequestSchema = $prepareCaptureRequest;
3444
3461
  var MoonPayCaptureRequestSchema = $captureRequest;
3445
3462
  var MoonPayOrderRequestSchema = $orderRequest;
3446
- var $request = import_zod2.z.discriminatedUnion("action", [
3463
+ var $request = import_zod2.z.union([
3447
3464
  $observeRequest,
3448
3465
  $consentRequest,
3449
3466
  $sessionRequest,
3450
3467
  $connectRequest,
3451
- $declineRequest,
3452
3468
  $kycRequest,
3453
3469
  $prepareCaptureRequest,
3454
3470
  $captureRequest,
3455
3471
  $orderRequest
3456
3472
  ]);
3457
3473
  var MoonPayRequestSchema = $request;
3458
- var $envelope = { provider: import_zod2.z.literal("MOONPAY"), geo: FiatGeoSchema, ...$context };
3459
- var $nextRequest2 = import_zod2.z.discriminatedUnion("action", [
3474
+ var $envelope = { provider: import_zod2.z.literal("MOONPAY"), geo: FiatGeoSchema, depositAddress: $nonEmpty.optional(), ...$context };
3475
+ var $nextRequest2 = import_zod2.z.union([
3460
3476
  obj2({ ...$envelope, ...$observeFields }),
3461
3477
  obj2({ ...$envelope, ...$consentFields }),
3462
3478
  obj2({ ...$envelope, ...$sessionFields }),
3463
3479
  obj2({ ...$envelope, ...$connectFields }),
3464
- obj2({ ...$envelope, ...$declineFields }),
3465
3480
  obj2({ ...$envelope, ...$kycFields }),
3466
3481
  obj2({ ...$envelope, ...$prepareCaptureFields }),
3467
3482
  obj2({ ...$envelope, ...$captureFields }),
@@ -3478,6 +3493,13 @@ var $connectNextAction = obj2({
3478
3493
  quoteInput: $quoteInput,
3479
3494
  resetConnection: import_zod2.z.literal(true).optional()
3480
3495
  });
3496
+ var $phoneNextAction = obj2({ next: import_zod2.z.literal("phone"), error: import_zod2.z.literal("CODE_EXPIRED").nullable() });
3497
+ var $phoneCodeNextAction = obj2({
3498
+ next: import_zod2.z.literal("phoneCode"),
3499
+ verificationRef: $nonEmpty,
3500
+ expiresAt: import_zod2.z.string().datetime({ offset: true }),
3501
+ error: import_zod2.z.literal("CODE_INVALID").nullable()
3502
+ });
3481
3503
  var $payNextAction = obj2({ next: import_zod2.z.literal("pay"), sessionToken: $nonEmpty, orderId: $nonEmpty, quoteInput: $quoteInput });
3482
3504
  var CAPTURE_DOCUMENTS = ["IDENTITY_DOCUMENT", "SELFIE", "PROOF_OF_ADDRESS", "PROOF_OF_INCOME"];
3483
3505
  var $captureDocument = import_zod2.z.enum(CAPTURE_DOCUMENTS);
@@ -3509,35 +3531,37 @@ var $orderPendingNextAction = obj2({
3509
3531
  retryAfterMs: import_zod2.z.number().int().positive().max(6e4),
3510
3532
  order: FiatStepResponseSchema.nullable()
3511
3533
  });
3512
- var checkConsent = (nextAction, context) => {
3534
+ var checkConsent = (nextAction, context2) => {
3513
3535
  if (!hasUniqueIds2(nextAction.documents.map((document) => document.id))) {
3514
- context.addIssue({ code: "custom", path: ["documents"], message: "document ids must be unique" });
3536
+ context2.addIssue({ code: "custom", path: ["documents"], message: "document ids must be unique" });
3515
3537
  }
3516
3538
  };
3517
- var checkKyc = (nextAction, context) => {
3539
+ var checkKyc = (nextAction, context2) => {
3518
3540
  const fieldIds = nextAction.fields.map((field) => field.id);
3519
3541
  if (!hasUniqueIds2(fieldIds)) {
3520
- context.addIssue({ code: "custom", path: ["fields"], message: "field ids must be unique" });
3542
+ context2.addIssue({ code: "custom", path: ["fields"], message: "field ids must be unique" });
3521
3543
  }
3522
3544
  if (nextAction.fieldErrors?.some((error) => !fieldIds.includes(error.fieldId))) {
3523
- context.addIssue({ code: "custom", path: ["fieldErrors"], message: "a field error must name a field in this next action" });
3545
+ context2.addIssue({ code: "custom", path: ["fieldErrors"], message: "a field error must name a field in this next action" });
3524
3546
  }
3525
3547
  if (nextAction.fieldErrors?.some((error) => error.code && FIELD_OF_CODE[error.code] !== error.fieldId)) {
3526
- context.addIssue({ code: "custom", path: ["fieldErrors"], message: "a field error code must match its field" });
3548
+ context2.addIssue({ code: "custom", path: ["fieldErrors"], message: "a field error code must match its field" });
3527
3549
  }
3528
3550
  if (nextAction.reask?.requirements.some((requirement) => !fieldIds.includes(requirement))) {
3529
- context.addIssue({ code: "custom", path: ["reask"], message: "a kyc reask must name fields in this next action" });
3551
+ context2.addIssue({ code: "custom", path: ["reask"], message: "a kyc reask must name fields in this next action" });
3530
3552
  }
3531
3553
  };
3532
3554
  var isCaptureDocument = (requirement) => CAPTURE_DOCUMENTS.includes(requirement);
3533
- var checkCapture = (nextAction, context) => {
3555
+ var checkCapture = (nextAction, context2) => {
3534
3556
  if (nextAction.reask?.requirements.some((requirement) => !isCaptureDocument(requirement))) {
3535
- context.addIssue({ code: "custom", path: ["reask"], message: "a capture reask must name documents only" });
3557
+ context2.addIssue({ code: "custom", path: ["reask"], message: "a capture reask must name documents only" });
3536
3558
  }
3537
3559
  };
3538
3560
  var MoonPayConsentNextActionSchema = $consentShape.superRefine(checkConsent);
3539
3561
  var MoonPaySessionNextActionSchema = $sessionNextAction;
3540
3562
  var MoonPayConnectNextActionSchema = $connectNextAction;
3563
+ var MoonPayPhoneNextActionSchema = $phoneNextAction;
3564
+ var MoonPayPhoneCodeNextActionSchema = $phoneCodeNextAction;
3541
3565
  var MoonPayPayNextActionSchema = $payNextAction;
3542
3566
  var MoonPayKycNextActionSchema = $kycShape.superRefine(checkKyc);
3543
3567
  var MoonPayPrepareCaptureNextActionSchema = $prepareCaptureNextAction;
@@ -3549,16 +3573,15 @@ var MoonPayCaptureNextActionSchema = $captureShape.superRefine(checkCapture);
3549
3573
  var MoonPayWaitNextActionSchema = $waitNextAction;
3550
3574
  var MoonPayOrderNextActionSchema = $orderNextAction;
3551
3575
  var MoonPayOrderPendingNextActionSchema = $orderPendingNextAction;
3552
- var checkNextAction = (response, context) => {
3553
- if (response.next === "consent") checkConsent(response, context);
3554
- if (response.next === "kyc") checkKyc(response, context);
3555
- if (response.next === "capture") checkCapture(response, context);
3576
+ var checkNextAction = (response, context2) => {
3577
+ if (response.next === "consent") checkConsent(response, context2);
3578
+ if (response.next === "kyc") checkKyc(response, context2);
3579
+ if (response.next === "capture") checkCapture(response, context2);
3556
3580
  };
3557
3581
  var $nextActionOptions = [
3558
3582
  $consentShape,
3559
3583
  $sessionNextAction,
3560
3584
  $connectNextAction,
3561
- $payNextAction,
3562
3585
  $kycShape,
3563
3586
  $prepareCaptureNextAction,
3564
3587
  $captureShape,
@@ -3588,7 +3611,6 @@ var MoonPayResponseSchemaFor = {
3588
3611
  consent: MoonPayStepResponseSchema,
3589
3612
  session: MoonPayStepResponseSchema,
3590
3613
  connect: MoonPayStepResponseSchema,
3591
- decline: MoonPayStepResponseSchema,
3592
3614
  kyc: MoonPayStepResponseSchema,
3593
3615
  prepareCapture: MoonPayStepResponseSchema,
3594
3616
  capture: MoonPayStepResponseSchema,
@@ -3668,7 +3690,7 @@ var CoinbasePlaceOrderRequestSchema = $placeOrderRequest;
3668
3690
  var CoinbaseOrderRequestSchema = $orderRequest2;
3669
3691
  var $request2 = import_zod3.z.union([$observeRequest2, $consentRequest2, $sessionRequest2, $otpRequest, $kycRequest2, $placeOrderRequest, $orderRequest2]);
3670
3692
  var CoinbaseRequestSchema = $request2;
3671
- var envelope = { provider: import_zod3.z.literal("COINBASE"), geo: FiatGeoSchema, ...contextFields };
3693
+ var envelope = { provider: import_zod3.z.literal("COINBASE"), geo: FiatGeoSchema, depositAddress: $nonEmpty2.optional(), ...contextFields };
3672
3694
  var $nextRequest3 = import_zod3.z.union([
3673
3695
  obj3({ ...envelope, ...observeFields }),
3674
3696
  obj3({ ...envelope, ...consentFields }),
@@ -3717,21 +3739,21 @@ var $orderPendingNextAction2 = obj3({
3717
3739
  retryAfterMs: $retryAfterMs,
3718
3740
  order: FiatStepResponseSchema.nullable()
3719
3741
  });
3720
- var checkConsent2 = (nextAction, context) => {
3742
+ var checkConsent2 = (nextAction, context2) => {
3721
3743
  if (!hasUniqueIds3(nextAction.documents.map((document) => document.id))) {
3722
- context.addIssue({ code: "custom", path: ["documents"], message: "document ids must be unique" });
3744
+ context2.addIssue({ code: "custom", path: ["documents"], message: "document ids must be unique" });
3723
3745
  }
3724
3746
  };
3725
- var checkKyc2 = (nextAction, context) => {
3747
+ var checkKyc2 = (nextAction, context2) => {
3726
3748
  const fieldIds = nextAction.fields.map((field) => field.id);
3727
3749
  if (!hasUniqueIds3(fieldIds)) {
3728
- context.addIssue({ code: "custom", path: ["fields"], message: "field ids must be unique" });
3750
+ context2.addIssue({ code: "custom", path: ["fields"], message: "field ids must be unique" });
3729
3751
  }
3730
3752
  if (nextAction.fieldErrors?.some((error) => !fieldIds.includes(error.fieldId))) {
3731
- context.addIssue({ code: "custom", path: ["fieldErrors"], message: "a field error must name a field in this next action" });
3753
+ context2.addIssue({ code: "custom", path: ["fieldErrors"], message: "a field error must name a field in this next action" });
3732
3754
  }
3733
3755
  if (nextAction.reask?.requirements.some((requirement) => !fieldIds.includes(requirement))) {
3734
- context.addIssue({ code: "custom", path: ["reask"], message: "a kyc reask must name fields in this next action" });
3756
+ context2.addIssue({ code: "custom", path: ["reask"], message: "a kyc reask must name fields in this next action" });
3735
3757
  }
3736
3758
  };
3737
3759
  var CoinbaseConsentNextActionSchema = $consentShape2.superRefine(checkConsent2);
@@ -3742,9 +3764,9 @@ var CoinbaseWaitNextActionSchema = $waitNextAction2;
3742
3764
  var CoinbasePlaceOrderNextActionSchema = $placeOrderNextAction;
3743
3765
  var CoinbasePayNextActionSchema = $payNextAction2;
3744
3766
  var CoinbaseOrderPendingNextActionSchema = $orderPendingNextAction2;
3745
- var checkNextAction2 = (response, context) => {
3746
- if (response.next === "consent") checkConsent2(response, context);
3747
- if (response.next === "kyc") checkKyc2(response, context);
3767
+ var checkNextAction2 = (response, context2) => {
3768
+ if (response.next === "consent") checkConsent2(response, context2);
3769
+ if (response.next === "kyc") checkKyc2(response, context2);
3748
3770
  };
3749
3771
  var $nextActionOptions2 = [
3750
3772
  $consentShape2,
@@ -3801,3 +3823,57 @@ var $errorBody2 = obj3({
3801
3823
  retryAfterSeconds: import_zod3.z.number().int().positive().optional()
3802
3824
  });
3803
3825
  var CoinbaseErrorBodySchema = $errorBody2;
3826
+
3827
+ // src/providers/moonpay-guest.schemas.ts
3828
+ var import_zod4 = require("zod");
3829
+ var context = { checkout: MoonPayCheckoutSchema, destinationAsset: DestinationAssetSchema.optional() };
3830
+ var obj4 = (shape) => import_zod4.z.object(shape).strict();
3831
+ var nonEmpty = import_zod4.z.string().refine((value) => value.trim().length > 0, "must not be blank");
3832
+ var actions = [
3833
+ { action: import_zod4.z.literal("observe") },
3834
+ { action: import_zod4.z.literal("session") },
3835
+ { action: import_zod4.z.literal("consent"), acceptances: import_zod4.z.array(TermsDocumentAcceptanceSchema).min(1).refine((values) => new Set(values.map((v) => v.documentId)).size === values.length, "each document is accepted once") },
3836
+ { action: import_zod4.z.literal("order"), orderId: nonEmpty, quotedAmount: FiatAmountSchema, transactionId: nonEmpty.optional() },
3837
+ { action: import_zod4.z.literal("phone"), phoneNumber: import_zod4.z.string().regex(/^\+[1-9]\d{1,14}$/) },
3838
+ { action: import_zod4.z.literal("phone"), resend: nonEmpty },
3839
+ { action: import_zod4.z.literal("phoneCode"), verificationRef: nonEmpty, otpCode: import_zod4.z.string().regex(/^\d{6}$/) },
3840
+ { action: import_zod4.z.literal("decline"), reason: MoonPayGuestDeclineReasonSchema }
3841
+ ];
3842
+ var MoonPayGuestObserveRequestSchema = obj4({ ...context, ...actions[0] });
3843
+ var MoonPayGuestSessionRequestSchema = obj4({ ...context, ...actions[1] });
3844
+ var MoonPayGuestConsentRequestSchema = obj4({ ...context, ...actions[2] });
3845
+ var MoonPayGuestOrderRequestSchema = obj4({ ...context, ...actions[3] });
3846
+ var MoonPayGuestPhoneNumberRequestSchema = obj4({ ...context, ...actions[4] });
3847
+ var MoonPayGuestPhoneResendRequestSchema = obj4({ ...context, ...actions[5] });
3848
+ var MoonPayGuestPhoneCodeRequestSchema = obj4({ ...context, ...actions[6] });
3849
+ var MoonPayGuestDeclineRequestSchema = obj4({ ...context, ...actions[7] });
3850
+ var MoonPayGuestPhoneRequestSchema = import_zod4.z.union([MoonPayGuestPhoneNumberRequestSchema, MoonPayGuestPhoneResendRequestSchema]);
3851
+ var MoonPayGuestRequestSchema = import_zod4.z.union([
3852
+ MoonPayGuestObserveRequestSchema,
3853
+ MoonPayGuestSessionRequestSchema,
3854
+ MoonPayGuestConsentRequestSchema,
3855
+ MoonPayGuestOrderRequestSchema,
3856
+ MoonPayGuestPhoneNumberRequestSchema,
3857
+ MoonPayGuestPhoneResendRequestSchema,
3858
+ MoonPayGuestPhoneCodeRequestSchema,
3859
+ MoonPayGuestDeclineRequestSchema
3860
+ ]);
3861
+ var MoonPayGuestNextRequestSchema = import_zod4.z.union([
3862
+ obj4({ provider: import_zod4.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty.optional(), ...context, ...actions[0] }),
3863
+ obj4({ provider: import_zod4.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty.optional(), ...context, ...actions[1] }),
3864
+ obj4({ provider: import_zod4.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty.optional(), ...context, ...actions[2] }),
3865
+ obj4({ provider: import_zod4.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty.optional(), ...context, ...actions[3] }),
3866
+ obj4({ provider: import_zod4.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty.optional(), ...context, ...actions[4] }),
3867
+ obj4({ provider: import_zod4.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty.optional(), ...context, ...actions[5] }),
3868
+ obj4({ provider: import_zod4.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty.optional(), ...context, ...actions[6] }),
3869
+ obj4({ provider: import_zod4.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty.optional(), ...context, ...actions[7] })
3870
+ ]);
3871
+ var MoonPayGuestStepResponseSchema = import_zod4.z.union([
3872
+ MoonPayConsentNextActionSchema,
3873
+ MoonPaySessionNextActionSchema,
3874
+ MoonPayPhoneNextActionSchema,
3875
+ MoonPayPhoneCodeNextActionSchema,
3876
+ MoonPayPayNextActionSchema,
3877
+ obj4({ next: import_zod4.z.literal("refused"), reason: import_zod4.z.enum(["NOT_ELIGIBLE", "FINAL_REJECTION"]), recovery: import_zod4.z.enum(["REQUOTE", "NONE"]) })
3878
+ ]);
3879
+ var MoonPayGuestResponseSchema = import_zod4.z.union([MoonPayGuestStepResponseSchema, MoonPayOrderResponseSchema]);