@fun-xyz/fiat-contract 0.42.0 → 0.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-RGQE53YP.mjs → chunk-XENZL32Y.mjs} +7 -2
- package/dist/index.js +80 -10
- package/dist/index.mjs +74 -9
- package/dist/providers/moonpay.d.ts +38 -5
- package/dist/providers/moonpay.schemas.d.ts +5 -1
- package/dist/routing.d.ts +7 -1
- package/dist/schemas.d.ts +4 -1
- package/dist/table.d.ts +1 -1
- package/dist/table.js +7 -2
- package/dist/table.mjs +1 -1
- package/dist/types.d.ts +51 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// package.json
|
|
2
|
-
var version = "0.
|
|
2
|
+
var version = "0.44.0";
|
|
3
3
|
|
|
4
4
|
// src/table.ts
|
|
5
5
|
var TABLE_VERSION = version;
|
|
@@ -112,7 +112,7 @@ var TRANSITION_TABLE = {
|
|
|
112
112
|
"Not in the FE doc, so no screen number: the client renders it on its contact and OTP screens.",
|
|
113
113
|
"Every FUN_AUTH error is category USER_ERROR with a code from FUN_AUTH_ERROR_CODES. A wrong code re-enters CODE with BAD_CODE and a lower attemptsRemaining; TOO_MANY_ATTEMPTS and CODE_EXPIRED drop the challenge and offer resend; OTP_DISPATCH_THROTTLED re-enters with resendAvailableAtMs set.",
|
|
114
114
|
"resend carries the verificationRef the client holds, even one the server has dropped (expired, too many attempts); the server starts a fresh challenge for the same email while it still remembers the challenge (its code expiry plus a short grace); once it is forgotten the answer is IDENTIFIER with CODE_EXPIRED.",
|
|
115
|
-
"POST /fiat/auth/refresh and /
|
|
115
|
+
"POST /fiat/auth/refresh, /revoke and /recipient are called by the SDK session store, never offered as transitions."
|
|
116
116
|
]
|
|
117
117
|
},
|
|
118
118
|
SESSION_AUTH: {
|
|
@@ -478,6 +478,7 @@ var DOCUMENTED_ENDPOINTS = [
|
|
|
478
478
|
"POST /fiat/auth/verify",
|
|
479
479
|
"POST /fiat/auth/refresh",
|
|
480
480
|
"POST /fiat/auth/revoke",
|
|
481
|
+
"POST /fiat/auth/recipient",
|
|
481
482
|
"POST /fiat/payment-session",
|
|
482
483
|
"POST /fiat/session",
|
|
483
484
|
"POST /fiat/session/verify",
|
|
@@ -509,6 +510,10 @@ var UNOFFERED_ENDPOINTS = [
|
|
|
509
510
|
endpoint: "POST /fiat/auth/revoke",
|
|
510
511
|
reason: "SDK session store, not a transition."
|
|
511
512
|
},
|
|
513
|
+
{
|
|
514
|
+
endpoint: "POST /fiat/auth/recipient",
|
|
515
|
+
reason: "SDK session store at beginDeposit, not a transition."
|
|
516
|
+
},
|
|
512
517
|
{
|
|
513
518
|
endpoint: "POST /fiat/kyc/document",
|
|
514
519
|
reason: "FILE fields use it for a direct provider/vendor upload handshake and completion report; the harness owns that auxiliary path and it is not a transition (see KYC/INPUT_REQUIRED notes)."
|
package/dist/index.js
CHANGED
|
@@ -73,6 +73,8 @@ __export(index_exports, {
|
|
|
73
73
|
FailureReasonSchema: () => FailureReasonSchema,
|
|
74
74
|
FeeLineSchema: () => FeeLineSchema,
|
|
75
75
|
FiatAmountSchema: () => FiatAmountSchema,
|
|
76
|
+
FiatAuthRecipientRequestSchema: () => FiatAuthRecipientRequestSchema,
|
|
77
|
+
FiatAuthRecipientResponseSchema: () => FiatAuthRecipientResponseSchema,
|
|
76
78
|
FiatAuthRefreshRequestSchema: () => FiatAuthRefreshRequestSchema,
|
|
77
79
|
FiatAuthRefreshResponseSchema: () => FiatAuthRefreshResponseSchema,
|
|
78
80
|
FiatAuthRevokeRequestSchema: () => FiatAuthRevokeRequestSchema,
|
|
@@ -81,6 +83,7 @@ __export(index_exports, {
|
|
|
81
83
|
FiatCurrencyCode: () => FiatCurrencyCode,
|
|
82
84
|
FiatEndpointSchema: () => FiatEndpointSchema,
|
|
83
85
|
FiatGeoSchema: () => FiatGeoSchema,
|
|
86
|
+
FiatHandoffPathSchema: () => FiatHandoffPathSchema,
|
|
84
87
|
FiatNextRequestSchema: () => FiatNextRequestSchema,
|
|
85
88
|
FiatProviderSchema: () => FiatProviderSchema,
|
|
86
89
|
FiatRoutingQuoteErrorBodySchema: () => FiatRoutingQuoteErrorBodySchema,
|
|
@@ -122,9 +125,11 @@ __export(index_exports, {
|
|
|
122
125
|
MoonPayConnectRequestSchema: () => MoonPayConnectRequestSchema,
|
|
123
126
|
MoonPayConsentNextActionSchema: () => MoonPayConsentNextActionSchema,
|
|
124
127
|
MoonPayConsentRequestSchema: () => MoonPayConsentRequestSchema,
|
|
128
|
+
MoonPayDeclineRequestSchema: () => MoonPayDeclineRequestSchema,
|
|
125
129
|
MoonPayDoneSchema: () => MoonPayDoneSchema,
|
|
126
130
|
MoonPayErrorBodySchema: () => MoonPayErrorBodySchema,
|
|
127
131
|
MoonPayFaultSchema: () => MoonPayFaultSchema,
|
|
132
|
+
MoonPayGuestDeclineReasonSchema: () => MoonPayGuestDeclineReasonSchema,
|
|
128
133
|
MoonPayKycNextActionSchema: () => MoonPayKycNextActionSchema,
|
|
129
134
|
MoonPayKycRequestSchema: () => MoonPayKycRequestSchema,
|
|
130
135
|
MoonPayNextActionSchema: () => MoonPayNextActionSchema,
|
|
@@ -134,6 +139,8 @@ __export(index_exports, {
|
|
|
134
139
|
MoonPayOrderPendingNextActionSchema: () => MoonPayOrderPendingNextActionSchema,
|
|
135
140
|
MoonPayOrderRequestSchema: () => MoonPayOrderRequestSchema,
|
|
136
141
|
MoonPayOrderResponseSchema: () => MoonPayOrderResponseSchema,
|
|
142
|
+
MoonPayPathSchema: () => MoonPayPathSchema,
|
|
143
|
+
MoonPayPayNextActionSchema: () => MoonPayPayNextActionSchema,
|
|
137
144
|
MoonPayPrepareCaptureNextActionSchema: () => MoonPayPrepareCaptureNextActionSchema,
|
|
138
145
|
MoonPayPrepareCaptureRequestSchema: () => MoonPayPrepareCaptureRequestSchema,
|
|
139
146
|
MoonPayQuoteInputSchema: () => MoonPayQuoteInputSchema,
|
|
@@ -564,6 +571,10 @@ var $provider = import_zod.z.enum([
|
|
|
564
571
|
"CROSSMINT"
|
|
565
572
|
]);
|
|
566
573
|
var FiatProviderSchema = $provider;
|
|
574
|
+
var HANDOFF_PATHS = ["MOONPAY/guest_checkout"];
|
|
575
|
+
var $handoffPath = import_zod.z.enum(HANDOFF_PATHS);
|
|
576
|
+
var FiatHandoffPathSchema = $handoffPath;
|
|
577
|
+
var $handoffPathName = import_zod.z.literal("guest_checkout");
|
|
567
578
|
var $kycProvider = import_zod.z.enum(["SUMSUB"]);
|
|
568
579
|
var KYCProviderSchema = $kycProvider;
|
|
569
580
|
var $surfaceProvider = import_zod.z.enum([...$provider.options, ...$kycProvider.options]);
|
|
@@ -1219,7 +1230,8 @@ var $routingQuoteTermsShape = {
|
|
|
1219
1230
|
),
|
|
1220
1231
|
prepareSessionAuth: import_zod.z.boolean().optional(),
|
|
1221
1232
|
routingOverrides: obj({ providers: import_zod.z.array($routingProvider) }).optional(),
|
|
1222
|
-
destinationAsset: $destinationAsset.optional()
|
|
1233
|
+
destinationAsset: $destinationAsset.optional(),
|
|
1234
|
+
handoffPaths: import_zod.z.array($handoffPath).refine(hasUniqueIds, "each handoff path is listed once").optional()
|
|
1223
1235
|
};
|
|
1224
1236
|
var $routingQuoteTerms = obj($routingQuoteTermsShape);
|
|
1225
1237
|
var FiatRoutingQuoteTermsSchema = $routingQuoteTerms;
|
|
@@ -1287,6 +1299,16 @@ var $authRefreshResponse = obj({ session: $fiatSession });
|
|
|
1287
1299
|
var FiatAuthRefreshResponseSchema = $authRefreshResponse;
|
|
1288
1300
|
var $authRevokeRequest = obj({ refreshHandle: $nonBlank });
|
|
1289
1301
|
var FiatAuthRevokeRequestSchema = $authRevokeRequest;
|
|
1302
|
+
var $authRecipientRequest = import_zod.z.discriminatedUnion("vm", [
|
|
1303
|
+
obj({ refreshHandle: $nonBlank, vm: import_zod.z.literal("EVM"), chainId: import_zod.z.number().int().positive(), depositAddress: $evmAddress }),
|
|
1304
|
+
obj({ refreshHandle: $nonBlank, vm: import_zod.z.literal("SOLANA"), depositAddress: $solanaAddress })
|
|
1305
|
+
]);
|
|
1306
|
+
var FiatAuthRecipientRequestSchema = $authRecipientRequest;
|
|
1307
|
+
var $authRecipientResponse = obj({
|
|
1308
|
+
boundAtMs: import_zod.z.number().int().nonnegative(),
|
|
1309
|
+
expiresAtMs: import_zod.z.number().int().nonnegative()
|
|
1310
|
+
});
|
|
1311
|
+
var FiatAuthRecipientResponseSchema = $authRecipientResponse;
|
|
1290
1312
|
var $stepResponseBase = {
|
|
1291
1313
|
transitions: import_zod.z.array($transition),
|
|
1292
1314
|
routingSessionRef: import_zod.z.string().optional(),
|
|
@@ -1302,7 +1324,7 @@ var $providerBoundStepResponse = obj({
|
|
|
1302
1324
|
state: $providerBoundFlowState,
|
|
1303
1325
|
provider: $provider,
|
|
1304
1326
|
preparedPayment: $preparedPayment.optional(),
|
|
1305
|
-
handoff: obj({ provider: $provider }).optional()
|
|
1327
|
+
handoff: obj({ provider: $provider, path: $handoffPathName.optional() }).optional()
|
|
1306
1328
|
}).superRefine((response, context) => {
|
|
1307
1329
|
if (response.preparedPayment !== void 0 && response.preparedPayment.surface.provider !== response.provider) {
|
|
1308
1330
|
context.addIssue({
|
|
@@ -1318,6 +1340,13 @@ var $providerBoundStepResponse = obj({
|
|
|
1318
1340
|
message: "handoff.provider must match the response provider"
|
|
1319
1341
|
});
|
|
1320
1342
|
}
|
|
1343
|
+
if (response.handoff?.path !== void 0 && !HANDOFF_PATHS.includes(`${response.handoff.provider}/${response.handoff.path}`)) {
|
|
1344
|
+
context.addIssue({
|
|
1345
|
+
code: "custom",
|
|
1346
|
+
path: ["handoff", "path"],
|
|
1347
|
+
message: "handoff.path must name a handoff path of handoff.provider"
|
|
1348
|
+
});
|
|
1349
|
+
}
|
|
1321
1350
|
if (response.handoff !== void 0 && response.state.kind !== "QUOTE") {
|
|
1322
1351
|
context.addIssue({
|
|
1323
1352
|
code: "custom",
|
|
@@ -1368,7 +1397,7 @@ var $stepResponse = import_zod.z.union([$providerBoundStepResponse, $funAuthStep
|
|
|
1368
1397
|
var FiatStepResponseSchema = $stepResponse;
|
|
1369
1398
|
|
|
1370
1399
|
// package.json
|
|
1371
|
-
var version = "0.
|
|
1400
|
+
var version = "0.44.0";
|
|
1372
1401
|
|
|
1373
1402
|
// src/table.ts
|
|
1374
1403
|
var TABLE_VERSION = version;
|
|
@@ -1481,7 +1510,7 @@ var TRANSITION_TABLE = {
|
|
|
1481
1510
|
"Not in the FE doc, so no screen number: the client renders it on its contact and OTP screens.",
|
|
1482
1511
|
"Every FUN_AUTH error is category USER_ERROR with a code from FUN_AUTH_ERROR_CODES. A wrong code re-enters CODE with BAD_CODE and a lower attemptsRemaining; TOO_MANY_ATTEMPTS and CODE_EXPIRED drop the challenge and offer resend; OTP_DISPATCH_THROTTLED re-enters with resendAvailableAtMs set.",
|
|
1483
1512
|
"resend carries the verificationRef the client holds, even one the server has dropped (expired, too many attempts); the server starts a fresh challenge for the same email while it still remembers the challenge (its code expiry plus a short grace); once it is forgotten the answer is IDENTIFIER with CODE_EXPIRED.",
|
|
1484
|
-
"POST /fiat/auth/refresh and /
|
|
1513
|
+
"POST /fiat/auth/refresh, /revoke and /recipient are called by the SDK session store, never offered as transitions."
|
|
1485
1514
|
]
|
|
1486
1515
|
},
|
|
1487
1516
|
SESSION_AUTH: {
|
|
@@ -1847,6 +1876,7 @@ var DOCUMENTED_ENDPOINTS = [
|
|
|
1847
1876
|
"POST /fiat/auth/verify",
|
|
1848
1877
|
"POST /fiat/auth/refresh",
|
|
1849
1878
|
"POST /fiat/auth/revoke",
|
|
1879
|
+
"POST /fiat/auth/recipient",
|
|
1850
1880
|
"POST /fiat/payment-session",
|
|
1851
1881
|
"POST /fiat/session",
|
|
1852
1882
|
"POST /fiat/session/verify",
|
|
@@ -1878,6 +1908,10 @@ var UNOFFERED_ENDPOINTS = [
|
|
|
1878
1908
|
endpoint: "POST /fiat/auth/revoke",
|
|
1879
1909
|
reason: "SDK session store, not a transition."
|
|
1880
1910
|
},
|
|
1911
|
+
{
|
|
1912
|
+
endpoint: "POST /fiat/auth/recipient",
|
|
1913
|
+
reason: "SDK session store at beginDeposit, not a transition."
|
|
1914
|
+
},
|
|
1881
1915
|
{
|
|
1882
1916
|
endpoint: "POST /fiat/kyc/document",
|
|
1883
1917
|
reason: "FILE fields use it for a direct provider/vendor upload handshake and completion report; the harness owns that auxiliary path and it is not a transition (see KYC/INPUT_REQUIRED notes)."
|
|
@@ -3372,7 +3406,14 @@ var $checkout = obj2({
|
|
|
3372
3406
|
var MoonPayCheckoutSchema = $checkout;
|
|
3373
3407
|
var $credentials = obj2({ customerId: $nonEmpty, accessToken: $nonEmpty });
|
|
3374
3408
|
var MoonPaySdkCredentialsSchema = $credentials;
|
|
3375
|
-
var $
|
|
3409
|
+
var $path = import_zod2.z.literal("guest_checkout");
|
|
3410
|
+
var MoonPayPathSchema = $path;
|
|
3411
|
+
var $context = {
|
|
3412
|
+
checkout: $checkout,
|
|
3413
|
+
credentials: $credentials.optional(),
|
|
3414
|
+
destinationAsset: DestinationAssetSchema.optional(),
|
|
3415
|
+
path: $path.optional()
|
|
3416
|
+
};
|
|
3376
3417
|
var $requestContext = obj2($context);
|
|
3377
3418
|
var MoonPayRequestContextSchema = $requestContext;
|
|
3378
3419
|
var $quoteInput = obj2({
|
|
@@ -3390,6 +3431,9 @@ var $consentFields = {
|
|
|
3390
3431
|
};
|
|
3391
3432
|
var $sessionFields = { action: import_zod2.z.literal("session") };
|
|
3392
3433
|
var $connectFields = { action: import_zod2.z.literal("connect"), customerId: $nonEmpty, accessToken: $nonEmpty };
|
|
3434
|
+
var $guestDeclineReason = import_zod2.z.enum(["NOT_OFFERED", "MISMATCH", "OVER_LIMIT"]);
|
|
3435
|
+
var MoonPayGuestDeclineReasonSchema = $guestDeclineReason;
|
|
3436
|
+
var $declineFields = { action: import_zod2.z.literal("decline"), reason: $guestDeclineReason };
|
|
3393
3437
|
var $kycFields = {
|
|
3394
3438
|
action: import_zod2.z.literal("kyc"),
|
|
3395
3439
|
credentials: $credentials,
|
|
@@ -3402,6 +3446,7 @@ var $observeRequest = obj2({ ...$context, ...$observeFields });
|
|
|
3402
3446
|
var $consentRequest = obj2({ ...$context, ...$consentFields });
|
|
3403
3447
|
var $sessionRequest = obj2({ ...$context, ...$sessionFields });
|
|
3404
3448
|
var $connectRequest = obj2({ ...$context, ...$connectFields });
|
|
3449
|
+
var $declineRequest = obj2({ ...$context, ...$declineFields });
|
|
3405
3450
|
var $kycRequest = obj2({ ...$context, ...$kycFields });
|
|
3406
3451
|
var $prepareCaptureRequest = obj2({ ...$context, ...$prepareCaptureFields });
|
|
3407
3452
|
var $captureRequest = obj2({ ...$context, ...$captureFields });
|
|
@@ -3410,11 +3455,22 @@ var MoonPayObserveRequestSchema = $observeRequest;
|
|
|
3410
3455
|
var MoonPayConsentRequestSchema = $consentRequest;
|
|
3411
3456
|
var MoonPaySessionRequestSchema = $sessionRequest;
|
|
3412
3457
|
var MoonPayConnectRequestSchema = $connectRequest;
|
|
3458
|
+
var MoonPayDeclineRequestSchema = $declineRequest;
|
|
3413
3459
|
var MoonPayKycRequestSchema = $kycRequest;
|
|
3414
3460
|
var MoonPayPrepareCaptureRequestSchema = $prepareCaptureRequest;
|
|
3415
3461
|
var MoonPayCaptureRequestSchema = $captureRequest;
|
|
3416
3462
|
var MoonPayOrderRequestSchema = $orderRequest;
|
|
3417
|
-
var $request = import_zod2.z.discriminatedUnion("action", [
|
|
3463
|
+
var $request = import_zod2.z.discriminatedUnion("action", [
|
|
3464
|
+
$observeRequest,
|
|
3465
|
+
$consentRequest,
|
|
3466
|
+
$sessionRequest,
|
|
3467
|
+
$connectRequest,
|
|
3468
|
+
$declineRequest,
|
|
3469
|
+
$kycRequest,
|
|
3470
|
+
$prepareCaptureRequest,
|
|
3471
|
+
$captureRequest,
|
|
3472
|
+
$orderRequest
|
|
3473
|
+
]);
|
|
3418
3474
|
var MoonPayRequestSchema = $request;
|
|
3419
3475
|
var $envelope = { provider: import_zod2.z.literal("MOONPAY"), geo: FiatGeoSchema, ...$context };
|
|
3420
3476
|
var $nextRequest2 = import_zod2.z.discriminatedUnion("action", [
|
|
@@ -3422,6 +3478,7 @@ var $nextRequest2 = import_zod2.z.discriminatedUnion("action", [
|
|
|
3422
3478
|
obj2({ ...$envelope, ...$consentFields }),
|
|
3423
3479
|
obj2({ ...$envelope, ...$sessionFields }),
|
|
3424
3480
|
obj2({ ...$envelope, ...$connectFields }),
|
|
3481
|
+
obj2({ ...$envelope, ...$declineFields }),
|
|
3425
3482
|
obj2({ ...$envelope, ...$kycFields }),
|
|
3426
3483
|
obj2({ ...$envelope, ...$prepareCaptureFields }),
|
|
3427
3484
|
obj2({ ...$envelope, ...$captureFields }),
|
|
@@ -3438,6 +3495,7 @@ var $connectNextAction = obj2({
|
|
|
3438
3495
|
quoteInput: $quoteInput,
|
|
3439
3496
|
resetConnection: import_zod2.z.literal(true).optional()
|
|
3440
3497
|
});
|
|
3498
|
+
var $payNextAction = obj2({ next: import_zod2.z.literal("pay"), sessionToken: $nonEmpty, orderId: $nonEmpty, quoteInput: $quoteInput });
|
|
3441
3499
|
var CAPTURE_DOCUMENTS = ["IDENTITY_DOCUMENT", "SELFIE", "PROOF_OF_ADDRESS", "PROOF_OF_INCOME"];
|
|
3442
3500
|
var $captureDocument = import_zod2.z.enum(CAPTURE_DOCUMENTS);
|
|
3443
3501
|
var $reaskRequirement = import_zod2.z.union([KycFieldIdSchema, $captureDocument]);
|
|
@@ -3497,6 +3555,7 @@ var checkCapture = (nextAction, context) => {
|
|
|
3497
3555
|
var MoonPayConsentNextActionSchema = $consentShape.superRefine(checkConsent);
|
|
3498
3556
|
var MoonPaySessionNextActionSchema = $sessionNextAction;
|
|
3499
3557
|
var MoonPayConnectNextActionSchema = $connectNextAction;
|
|
3558
|
+
var MoonPayPayNextActionSchema = $payNextAction;
|
|
3500
3559
|
var MoonPayKycNextActionSchema = $kycShape.superRefine(checkKyc);
|
|
3501
3560
|
var MoonPayPrepareCaptureNextActionSchema = $prepareCaptureNextAction;
|
|
3502
3561
|
var MoonPayCaptureDocumentSchema = $captureDocument;
|
|
@@ -3512,7 +3571,17 @@ var checkNextAction = (response, context) => {
|
|
|
3512
3571
|
if (response.next === "kyc") checkKyc(response, context);
|
|
3513
3572
|
if (response.next === "capture") checkCapture(response, context);
|
|
3514
3573
|
};
|
|
3515
|
-
var $nextActionOptions = [
|
|
3574
|
+
var $nextActionOptions = [
|
|
3575
|
+
$consentShape,
|
|
3576
|
+
$sessionNextAction,
|
|
3577
|
+
$connectNextAction,
|
|
3578
|
+
$payNextAction,
|
|
3579
|
+
$kycShape,
|
|
3580
|
+
$prepareCaptureNextAction,
|
|
3581
|
+
$captureShape,
|
|
3582
|
+
$waitNextAction,
|
|
3583
|
+
$orderNextAction
|
|
3584
|
+
];
|
|
3516
3585
|
var $nextAction = import_zod2.z.discriminatedUnion("next", [...$nextActionOptions]).superRefine(checkNextAction);
|
|
3517
3586
|
var MoonPayNextActionSchema = $nextAction;
|
|
3518
3587
|
var $done = obj2({ next: import_zod2.z.literal("done"), order: FiatStepResponseSchema });
|
|
@@ -3536,6 +3605,7 @@ var MoonPayResponseSchemaFor = {
|
|
|
3536
3605
|
consent: MoonPayStepResponseSchema,
|
|
3537
3606
|
session: MoonPayStepResponseSchema,
|
|
3538
3607
|
connect: MoonPayStepResponseSchema,
|
|
3608
|
+
decline: MoonPayStepResponseSchema,
|
|
3539
3609
|
kyc: MoonPayStepResponseSchema,
|
|
3540
3610
|
prepareCapture: MoonPayStepResponseSchema,
|
|
3541
3611
|
capture: MoonPayStepResponseSchema,
|
|
@@ -3650,7 +3720,7 @@ var $kycShape2 = obj3({
|
|
|
3650
3720
|
});
|
|
3651
3721
|
var $waitNextAction2 = obj3({ next: import_zod3.z.literal("wait"), retryAfterMs: $retryAfterMs });
|
|
3652
3722
|
var $placeOrderNextAction = obj3({ next: import_zod3.z.literal("placeOrder"), price: $price, orderId: $nonEmpty2 });
|
|
3653
|
-
var $
|
|
3723
|
+
var $payNextAction2 = obj3({
|
|
3654
3724
|
next: import_zod3.z.literal("pay"),
|
|
3655
3725
|
orderId: $nonEmpty2,
|
|
3656
3726
|
price: $price,
|
|
@@ -3687,7 +3757,7 @@ var CoinbaseOtpNextActionSchema = $otpNextAction;
|
|
|
3687
3757
|
var CoinbaseKycNextActionSchema = $kycShape2.superRefine(checkKyc2);
|
|
3688
3758
|
var CoinbaseWaitNextActionSchema = $waitNextAction2;
|
|
3689
3759
|
var CoinbasePlaceOrderNextActionSchema = $placeOrderNextAction;
|
|
3690
|
-
var CoinbasePayNextActionSchema = $
|
|
3760
|
+
var CoinbasePayNextActionSchema = $payNextAction2;
|
|
3691
3761
|
var CoinbaseOrderPendingNextActionSchema = $orderPendingNextAction2;
|
|
3692
3762
|
var checkNextAction2 = (response, context) => {
|
|
3693
3763
|
if (response.next === "consent") checkConsent2(response, context);
|
|
@@ -3700,7 +3770,7 @@ var $nextActionOptions2 = [
|
|
|
3700
3770
|
$kycShape2,
|
|
3701
3771
|
$waitNextAction2,
|
|
3702
3772
|
$placeOrderNextAction,
|
|
3703
|
-
$
|
|
3773
|
+
$payNextAction2,
|
|
3704
3774
|
$orderPendingNextAction2
|
|
3705
3775
|
];
|
|
3706
3776
|
var $nextAction2 = import_zod3.z.discriminatedUnion("next", [...$nextActionOptions2]).superRefine(checkNextAction2);
|
package/dist/index.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
tableEntry,
|
|
14
14
|
unofferedEndpoints,
|
|
15
15
|
unreachableStates
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-XENZL32Y.mjs";
|
|
17
17
|
import {
|
|
18
18
|
MOONPAY_ENDPOINTS
|
|
19
19
|
} from "./chunk-TIEGTTFY.mjs";
|
|
@@ -382,6 +382,10 @@ var $provider = z.enum([
|
|
|
382
382
|
"CROSSMINT"
|
|
383
383
|
]);
|
|
384
384
|
var FiatProviderSchema = $provider;
|
|
385
|
+
var HANDOFF_PATHS = ["MOONPAY/guest_checkout"];
|
|
386
|
+
var $handoffPath = z.enum(HANDOFF_PATHS);
|
|
387
|
+
var FiatHandoffPathSchema = $handoffPath;
|
|
388
|
+
var $handoffPathName = z.literal("guest_checkout");
|
|
385
389
|
var $kycProvider = z.enum(["SUMSUB"]);
|
|
386
390
|
var KYCProviderSchema = $kycProvider;
|
|
387
391
|
var $surfaceProvider = z.enum([...$provider.options, ...$kycProvider.options]);
|
|
@@ -1037,7 +1041,8 @@ var $routingQuoteTermsShape = {
|
|
|
1037
1041
|
),
|
|
1038
1042
|
prepareSessionAuth: z.boolean().optional(),
|
|
1039
1043
|
routingOverrides: obj({ providers: z.array($routingProvider) }).optional(),
|
|
1040
|
-
destinationAsset: $destinationAsset.optional()
|
|
1044
|
+
destinationAsset: $destinationAsset.optional(),
|
|
1045
|
+
handoffPaths: z.array($handoffPath).refine(hasUniqueIds, "each handoff path is listed once").optional()
|
|
1041
1046
|
};
|
|
1042
1047
|
var $routingQuoteTerms = obj($routingQuoteTermsShape);
|
|
1043
1048
|
var FiatRoutingQuoteTermsSchema = $routingQuoteTerms;
|
|
@@ -1105,6 +1110,16 @@ var $authRefreshResponse = obj({ session: $fiatSession });
|
|
|
1105
1110
|
var FiatAuthRefreshResponseSchema = $authRefreshResponse;
|
|
1106
1111
|
var $authRevokeRequest = obj({ refreshHandle: $nonBlank });
|
|
1107
1112
|
var FiatAuthRevokeRequestSchema = $authRevokeRequest;
|
|
1113
|
+
var $authRecipientRequest = z.discriminatedUnion("vm", [
|
|
1114
|
+
obj({ refreshHandle: $nonBlank, vm: z.literal("EVM"), chainId: z.number().int().positive(), depositAddress: $evmAddress }),
|
|
1115
|
+
obj({ refreshHandle: $nonBlank, vm: z.literal("SOLANA"), depositAddress: $solanaAddress })
|
|
1116
|
+
]);
|
|
1117
|
+
var FiatAuthRecipientRequestSchema = $authRecipientRequest;
|
|
1118
|
+
var $authRecipientResponse = obj({
|
|
1119
|
+
boundAtMs: z.number().int().nonnegative(),
|
|
1120
|
+
expiresAtMs: z.number().int().nonnegative()
|
|
1121
|
+
});
|
|
1122
|
+
var FiatAuthRecipientResponseSchema = $authRecipientResponse;
|
|
1108
1123
|
var $stepResponseBase = {
|
|
1109
1124
|
transitions: z.array($transition),
|
|
1110
1125
|
routingSessionRef: z.string().optional(),
|
|
@@ -1120,7 +1135,7 @@ var $providerBoundStepResponse = obj({
|
|
|
1120
1135
|
state: $providerBoundFlowState,
|
|
1121
1136
|
provider: $provider,
|
|
1122
1137
|
preparedPayment: $preparedPayment.optional(),
|
|
1123
|
-
handoff: obj({ provider: $provider }).optional()
|
|
1138
|
+
handoff: obj({ provider: $provider, path: $handoffPathName.optional() }).optional()
|
|
1124
1139
|
}).superRefine((response, context) => {
|
|
1125
1140
|
if (response.preparedPayment !== void 0 && response.preparedPayment.surface.provider !== response.provider) {
|
|
1126
1141
|
context.addIssue({
|
|
@@ -1136,6 +1151,13 @@ var $providerBoundStepResponse = obj({
|
|
|
1136
1151
|
message: "handoff.provider must match the response provider"
|
|
1137
1152
|
});
|
|
1138
1153
|
}
|
|
1154
|
+
if (response.handoff?.path !== void 0 && !HANDOFF_PATHS.includes(`${response.handoff.provider}/${response.handoff.path}`)) {
|
|
1155
|
+
context.addIssue({
|
|
1156
|
+
code: "custom",
|
|
1157
|
+
path: ["handoff", "path"],
|
|
1158
|
+
message: "handoff.path must name a handoff path of handoff.provider"
|
|
1159
|
+
});
|
|
1160
|
+
}
|
|
1139
1161
|
if (response.handoff !== void 0 && response.state.kind !== "QUOTE") {
|
|
1140
1162
|
context.addIssue({
|
|
1141
1163
|
code: "custom",
|
|
@@ -2522,7 +2544,14 @@ var $checkout = obj2({
|
|
|
2522
2544
|
var MoonPayCheckoutSchema = $checkout;
|
|
2523
2545
|
var $credentials = obj2({ customerId: $nonEmpty, accessToken: $nonEmpty });
|
|
2524
2546
|
var MoonPaySdkCredentialsSchema = $credentials;
|
|
2525
|
-
var $
|
|
2547
|
+
var $path = z2.literal("guest_checkout");
|
|
2548
|
+
var MoonPayPathSchema = $path;
|
|
2549
|
+
var $context = {
|
|
2550
|
+
checkout: $checkout,
|
|
2551
|
+
credentials: $credentials.optional(),
|
|
2552
|
+
destinationAsset: DestinationAssetSchema.optional(),
|
|
2553
|
+
path: $path.optional()
|
|
2554
|
+
};
|
|
2526
2555
|
var $requestContext = obj2($context);
|
|
2527
2556
|
var MoonPayRequestContextSchema = $requestContext;
|
|
2528
2557
|
var $quoteInput = obj2({
|
|
@@ -2540,6 +2569,9 @@ var $consentFields = {
|
|
|
2540
2569
|
};
|
|
2541
2570
|
var $sessionFields = { action: z2.literal("session") };
|
|
2542
2571
|
var $connectFields = { action: z2.literal("connect"), customerId: $nonEmpty, accessToken: $nonEmpty };
|
|
2572
|
+
var $guestDeclineReason = z2.enum(["NOT_OFFERED", "MISMATCH", "OVER_LIMIT"]);
|
|
2573
|
+
var MoonPayGuestDeclineReasonSchema = $guestDeclineReason;
|
|
2574
|
+
var $declineFields = { action: z2.literal("decline"), reason: $guestDeclineReason };
|
|
2543
2575
|
var $kycFields = {
|
|
2544
2576
|
action: z2.literal("kyc"),
|
|
2545
2577
|
credentials: $credentials,
|
|
@@ -2552,6 +2584,7 @@ var $observeRequest = obj2({ ...$context, ...$observeFields });
|
|
|
2552
2584
|
var $consentRequest = obj2({ ...$context, ...$consentFields });
|
|
2553
2585
|
var $sessionRequest = obj2({ ...$context, ...$sessionFields });
|
|
2554
2586
|
var $connectRequest = obj2({ ...$context, ...$connectFields });
|
|
2587
|
+
var $declineRequest = obj2({ ...$context, ...$declineFields });
|
|
2555
2588
|
var $kycRequest = obj2({ ...$context, ...$kycFields });
|
|
2556
2589
|
var $prepareCaptureRequest = obj2({ ...$context, ...$prepareCaptureFields });
|
|
2557
2590
|
var $captureRequest = obj2({ ...$context, ...$captureFields });
|
|
@@ -2560,11 +2593,22 @@ var MoonPayObserveRequestSchema = $observeRequest;
|
|
|
2560
2593
|
var MoonPayConsentRequestSchema = $consentRequest;
|
|
2561
2594
|
var MoonPaySessionRequestSchema = $sessionRequest;
|
|
2562
2595
|
var MoonPayConnectRequestSchema = $connectRequest;
|
|
2596
|
+
var MoonPayDeclineRequestSchema = $declineRequest;
|
|
2563
2597
|
var MoonPayKycRequestSchema = $kycRequest;
|
|
2564
2598
|
var MoonPayPrepareCaptureRequestSchema = $prepareCaptureRequest;
|
|
2565
2599
|
var MoonPayCaptureRequestSchema = $captureRequest;
|
|
2566
2600
|
var MoonPayOrderRequestSchema = $orderRequest;
|
|
2567
|
-
var $request = z2.discriminatedUnion("action", [
|
|
2601
|
+
var $request = z2.discriminatedUnion("action", [
|
|
2602
|
+
$observeRequest,
|
|
2603
|
+
$consentRequest,
|
|
2604
|
+
$sessionRequest,
|
|
2605
|
+
$connectRequest,
|
|
2606
|
+
$declineRequest,
|
|
2607
|
+
$kycRequest,
|
|
2608
|
+
$prepareCaptureRequest,
|
|
2609
|
+
$captureRequest,
|
|
2610
|
+
$orderRequest
|
|
2611
|
+
]);
|
|
2568
2612
|
var MoonPayRequestSchema = $request;
|
|
2569
2613
|
var $envelope = { provider: z2.literal("MOONPAY"), geo: FiatGeoSchema, ...$context };
|
|
2570
2614
|
var $nextRequest2 = z2.discriminatedUnion("action", [
|
|
@@ -2572,6 +2616,7 @@ var $nextRequest2 = z2.discriminatedUnion("action", [
|
|
|
2572
2616
|
obj2({ ...$envelope, ...$consentFields }),
|
|
2573
2617
|
obj2({ ...$envelope, ...$sessionFields }),
|
|
2574
2618
|
obj2({ ...$envelope, ...$connectFields }),
|
|
2619
|
+
obj2({ ...$envelope, ...$declineFields }),
|
|
2575
2620
|
obj2({ ...$envelope, ...$kycFields }),
|
|
2576
2621
|
obj2({ ...$envelope, ...$prepareCaptureFields }),
|
|
2577
2622
|
obj2({ ...$envelope, ...$captureFields }),
|
|
@@ -2588,6 +2633,7 @@ var $connectNextAction = obj2({
|
|
|
2588
2633
|
quoteInput: $quoteInput,
|
|
2589
2634
|
resetConnection: z2.literal(true).optional()
|
|
2590
2635
|
});
|
|
2636
|
+
var $payNextAction = obj2({ next: z2.literal("pay"), sessionToken: $nonEmpty, orderId: $nonEmpty, quoteInput: $quoteInput });
|
|
2591
2637
|
var CAPTURE_DOCUMENTS = ["IDENTITY_DOCUMENT", "SELFIE", "PROOF_OF_ADDRESS", "PROOF_OF_INCOME"];
|
|
2592
2638
|
var $captureDocument = z2.enum(CAPTURE_DOCUMENTS);
|
|
2593
2639
|
var $reaskRequirement = z2.union([KycFieldIdSchema, $captureDocument]);
|
|
@@ -2647,6 +2693,7 @@ var checkCapture = (nextAction, context) => {
|
|
|
2647
2693
|
var MoonPayConsentNextActionSchema = $consentShape.superRefine(checkConsent);
|
|
2648
2694
|
var MoonPaySessionNextActionSchema = $sessionNextAction;
|
|
2649
2695
|
var MoonPayConnectNextActionSchema = $connectNextAction;
|
|
2696
|
+
var MoonPayPayNextActionSchema = $payNextAction;
|
|
2650
2697
|
var MoonPayKycNextActionSchema = $kycShape.superRefine(checkKyc);
|
|
2651
2698
|
var MoonPayPrepareCaptureNextActionSchema = $prepareCaptureNextAction;
|
|
2652
2699
|
var MoonPayCaptureDocumentSchema = $captureDocument;
|
|
@@ -2662,7 +2709,17 @@ var checkNextAction = (response, context) => {
|
|
|
2662
2709
|
if (response.next === "kyc") checkKyc(response, context);
|
|
2663
2710
|
if (response.next === "capture") checkCapture(response, context);
|
|
2664
2711
|
};
|
|
2665
|
-
var $nextActionOptions = [
|
|
2712
|
+
var $nextActionOptions = [
|
|
2713
|
+
$consentShape,
|
|
2714
|
+
$sessionNextAction,
|
|
2715
|
+
$connectNextAction,
|
|
2716
|
+
$payNextAction,
|
|
2717
|
+
$kycShape,
|
|
2718
|
+
$prepareCaptureNextAction,
|
|
2719
|
+
$captureShape,
|
|
2720
|
+
$waitNextAction,
|
|
2721
|
+
$orderNextAction
|
|
2722
|
+
];
|
|
2666
2723
|
var $nextAction = z2.discriminatedUnion("next", [...$nextActionOptions]).superRefine(checkNextAction);
|
|
2667
2724
|
var MoonPayNextActionSchema = $nextAction;
|
|
2668
2725
|
var $done = obj2({ next: z2.literal("done"), order: FiatStepResponseSchema });
|
|
@@ -2686,6 +2743,7 @@ var MoonPayResponseSchemaFor = {
|
|
|
2686
2743
|
consent: MoonPayStepResponseSchema,
|
|
2687
2744
|
session: MoonPayStepResponseSchema,
|
|
2688
2745
|
connect: MoonPayStepResponseSchema,
|
|
2746
|
+
decline: MoonPayStepResponseSchema,
|
|
2689
2747
|
kyc: MoonPayStepResponseSchema,
|
|
2690
2748
|
prepareCapture: MoonPayStepResponseSchema,
|
|
2691
2749
|
capture: MoonPayStepResponseSchema,
|
|
@@ -2787,7 +2845,7 @@ var $kycShape2 = obj3({
|
|
|
2787
2845
|
});
|
|
2788
2846
|
var $waitNextAction2 = obj3({ next: z3.literal("wait"), retryAfterMs: $retryAfterMs });
|
|
2789
2847
|
var $placeOrderNextAction = obj3({ next: z3.literal("placeOrder"), price: $price, orderId: $nonEmpty2 });
|
|
2790
|
-
var $
|
|
2848
|
+
var $payNextAction2 = obj3({
|
|
2791
2849
|
next: z3.literal("pay"),
|
|
2792
2850
|
orderId: $nonEmpty2,
|
|
2793
2851
|
price: $price,
|
|
@@ -2824,7 +2882,7 @@ var CoinbaseOtpNextActionSchema = $otpNextAction;
|
|
|
2824
2882
|
var CoinbaseKycNextActionSchema = $kycShape2.superRefine(checkKyc2);
|
|
2825
2883
|
var CoinbaseWaitNextActionSchema = $waitNextAction2;
|
|
2826
2884
|
var CoinbasePlaceOrderNextActionSchema = $placeOrderNextAction;
|
|
2827
|
-
var CoinbasePayNextActionSchema = $
|
|
2885
|
+
var CoinbasePayNextActionSchema = $payNextAction2;
|
|
2828
2886
|
var CoinbaseOrderPendingNextActionSchema = $orderPendingNextAction2;
|
|
2829
2887
|
var checkNextAction2 = (response, context) => {
|
|
2830
2888
|
if (response.next === "consent") checkConsent2(response, context);
|
|
@@ -2837,7 +2895,7 @@ var $nextActionOptions2 = [
|
|
|
2837
2895
|
$kycShape2,
|
|
2838
2896
|
$waitNextAction2,
|
|
2839
2897
|
$placeOrderNextAction,
|
|
2840
|
-
$
|
|
2898
|
+
$payNextAction2,
|
|
2841
2899
|
$orderPendingNextAction2
|
|
2842
2900
|
];
|
|
2843
2901
|
var $nextAction2 = z3.discriminatedUnion("next", [...$nextActionOptions2]).superRefine(checkNextAction2);
|
|
@@ -2939,6 +2997,8 @@ export {
|
|
|
2939
2997
|
FailureReasonSchema,
|
|
2940
2998
|
FeeLineSchema,
|
|
2941
2999
|
FiatAmountSchema,
|
|
3000
|
+
FiatAuthRecipientRequestSchema,
|
|
3001
|
+
FiatAuthRecipientResponseSchema,
|
|
2942
3002
|
FiatAuthRefreshRequestSchema,
|
|
2943
3003
|
FiatAuthRefreshResponseSchema,
|
|
2944
3004
|
FiatAuthRevokeRequestSchema,
|
|
@@ -2947,6 +3007,7 @@ export {
|
|
|
2947
3007
|
FiatCurrencyCode,
|
|
2948
3008
|
FiatEndpointSchema,
|
|
2949
3009
|
FiatGeoSchema,
|
|
3010
|
+
FiatHandoffPathSchema,
|
|
2950
3011
|
FiatNextRequestSchema,
|
|
2951
3012
|
FiatProviderSchema,
|
|
2952
3013
|
FiatRoutingQuoteErrorBodySchema,
|
|
@@ -2988,9 +3049,11 @@ export {
|
|
|
2988
3049
|
MoonPayConnectRequestSchema,
|
|
2989
3050
|
MoonPayConsentNextActionSchema,
|
|
2990
3051
|
MoonPayConsentRequestSchema,
|
|
3052
|
+
MoonPayDeclineRequestSchema,
|
|
2991
3053
|
MoonPayDoneSchema,
|
|
2992
3054
|
MoonPayErrorBodySchema,
|
|
2993
3055
|
MoonPayFaultSchema,
|
|
3056
|
+
MoonPayGuestDeclineReasonSchema,
|
|
2994
3057
|
MoonPayKycNextActionSchema,
|
|
2995
3058
|
MoonPayKycRequestSchema,
|
|
2996
3059
|
MoonPayNextActionSchema,
|
|
@@ -3000,6 +3063,8 @@ export {
|
|
|
3000
3063
|
MoonPayOrderPendingNextActionSchema,
|
|
3001
3064
|
MoonPayOrderRequestSchema,
|
|
3002
3065
|
MoonPayOrderResponseSchema,
|
|
3066
|
+
MoonPayPathSchema,
|
|
3067
|
+
MoonPayPayNextActionSchema,
|
|
3003
3068
|
MoonPayPrepareCaptureNextActionSchema,
|
|
3004
3069
|
MoonPayPrepareCaptureRequestSchema,
|
|
3005
3070
|
MoonPayQuoteInputSchema,
|
|
@@ -8,6 +8,11 @@
|
|
|
8
8
|
* `orderPending` answers only `order` and has no request either: the client follows its order body's `delivery`
|
|
9
9
|
* transition when it offers one, and otherwise sends the same `order` after it.
|
|
10
10
|
*
|
|
11
|
+
* Guest checkout is the routing path `MOONPAY/guest_checkout`. A quote whose `handoff.path` is `guest_checkout`
|
|
12
|
+
* runs this flow with `path: 'guest_checkout'` on every request: `session` answers `pay`, and after `pay` the
|
|
13
|
+
* client sends `order`, or `decline` when the device cannot pay as a guest. `decline` is request-only, like
|
|
14
|
+
* `observe`, and is answered `refused NOT_ELIGIBLE / REQUOTE`; the requote then leaves the guest path out.
|
|
15
|
+
*
|
|
11
16
|
* The body is `MoonPayNextRequest`: `provider`, the shared `geo`, the context (`checkout`, and
|
|
12
17
|
* `credentials` after `connect`), and the action's result. Identity and the deposit wallet always
|
|
13
18
|
* come from the verified partner assertion, never from a request body.
|
|
@@ -26,7 +31,7 @@ import type { FiatAmount, DestinationAsset, FiatGeo, FiatStepResponse, FormField
|
|
|
26
31
|
export declare const MOONPAY_ENDPOINTS: {
|
|
27
32
|
readonly next: "POST /fiat/next";
|
|
28
33
|
};
|
|
29
|
-
export type MoonPayAction = 'observe' | 'consent' | 'session' | 'connect' | 'kyc' | 'prepareCapture' | 'capture' | 'wait' | 'order';
|
|
34
|
+
export type MoonPayAction = 'observe' | 'consent' | 'session' | 'connect' | 'pay' | 'decline' | 'kyc' | 'prepareCapture' | 'capture' | 'wait' | 'order';
|
|
30
35
|
/** The checkout terms. The client holds them and sends them on every request. */
|
|
31
36
|
export interface MoonPayCheckout {
|
|
32
37
|
amount: FiatAmount;
|
|
@@ -45,13 +50,17 @@ export interface MoonPaySdkCredentials {
|
|
|
45
50
|
/**
|
|
46
51
|
* On every request, not part of the result. `credentials` is present after `connect`.
|
|
47
52
|
* `destinationAsset` is the asset the user receives at the end; `checkout.destination` stays the quote's
|
|
48
|
-
* asset, which MoonPay delivers.
|
|
53
|
+
* asset, which MoonPay delivers. `path` is `guest_checkout` when the quote's `handoff.path` was; absent is the
|
|
54
|
+
* normal flow.
|
|
49
55
|
*/
|
|
50
56
|
export type MoonPayRequestContext = {
|
|
51
57
|
checkout: MoonPayCheckout;
|
|
52
58
|
credentials?: MoonPaySdkCredentials;
|
|
53
59
|
destinationAsset?: DestinationAsset;
|
|
60
|
+
path?: MoonPayPath;
|
|
54
61
|
};
|
|
62
|
+
/** A MoonPay routing path other than the normal flow, named by the quote's `handoff.path`. */
|
|
63
|
+
export type MoonPayPath = 'guest_checkout';
|
|
55
64
|
/**
|
|
56
65
|
* The parameters for the device `client.getQuote`, not a quote. The backend builds them because the
|
|
57
66
|
* wallet must be the verified one and MoonPay's currency codes differ by environment.
|
|
@@ -117,6 +126,29 @@ export type MoonPayConnectRequest = {
|
|
|
117
126
|
customerId: string;
|
|
118
127
|
accessToken: string;
|
|
119
128
|
};
|
|
129
|
+
/**
|
|
130
|
+
* The guest path's answer to `session`. Run the hidden connection check with `sessionToken`. When it returns
|
|
131
|
+
* `connectionRequired` with `capabilities.guestCheckout` and no `mismatch`, get the device quote from
|
|
132
|
+
* `quoteInput`. When that quote is executable with no `challenge`, mount Apple Pay with
|
|
133
|
+
* `externalTransactionId = orderId`, then send `order`. Otherwise send `decline`. Every `pay` answer carries a new
|
|
134
|
+
* `orderId`, so after a retried `session` the device must use the `orderId` of the latest `pay`.
|
|
135
|
+
*/
|
|
136
|
+
export type MoonPayPayNextAction = {
|
|
137
|
+
next: 'pay';
|
|
138
|
+
sessionToken: string;
|
|
139
|
+
orderId: string;
|
|
140
|
+
quoteInput: MoonPayQuoteInput;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Why the device cannot pay as a guest. `NOT_OFFERED`: the check did not offer guest checkout. `MISMATCH`: the
|
|
144
|
+
* check named a `mismatch`. `OVER_LIMIT`: the device quote was not executable or carried a `challenge`.
|
|
145
|
+
*/
|
|
146
|
+
export type MoonPayGuestDeclineReason = 'NOT_OFFERED' | 'MISMATCH' | 'OVER_LIMIT';
|
|
147
|
+
/** Request-only, after `pay`, before any charge. Answered `refused NOT_ELIGIBLE / REQUOTE`. */
|
|
148
|
+
export type MoonPayDeclineRequest = {
|
|
149
|
+
action: 'decline';
|
|
150
|
+
reason: MoonPayGuestDeclineReason;
|
|
151
|
+
};
|
|
120
152
|
/** Another MoonPay customer already holds the value; only a different one goes through. */
|
|
121
153
|
export type MoonPayFieldErrorCode = 'PHONE_IN_USE' | 'TAX_ID_IN_USE';
|
|
122
154
|
/**
|
|
@@ -234,7 +266,7 @@ export type MoonPayOrderPendingNextAction = {
|
|
|
234
266
|
retryAfterMs: number;
|
|
235
267
|
order: FiatStepResponse | null;
|
|
236
268
|
};
|
|
237
|
-
export type MoonPayRequest = MoonPayRequestContext & (MoonPayObserveRequest | MoonPayConsentRequest | MoonPaySessionRequest | MoonPayConnectRequest | MoonPayKycRequest | MoonPayPrepareCaptureRequest | MoonPayCaptureRequest | MoonPayOrderRequest);
|
|
269
|
+
export type MoonPayRequest = MoonPayRequestContext & (MoonPayObserveRequest | MoonPayConsentRequest | MoonPaySessionRequest | MoonPayConnectRequest | MoonPayDeclineRequest | MoonPayKycRequest | MoonPayPrepareCaptureRequest | MoonPayCaptureRequest | MoonPayOrderRequest);
|
|
238
270
|
/** The wire body. The orchestrator reads `provider` and `geo`; MoonPay's action schemas read the rest. */
|
|
239
271
|
export type MoonPayNextRequest = {
|
|
240
272
|
provider: 'MOONPAY';
|
|
@@ -252,7 +284,7 @@ export type MoonPayStepRefusal = 'NOT_ELIGIBLE' | 'DOCUMENTS_REQUIRED' | 'FINAL_
|
|
|
252
284
|
* assertion's. `UNRECORDABLE`: a charge no retry can record, held for refund review.
|
|
253
285
|
*/
|
|
254
286
|
export type MoonPayOrderRefusal = 'CUSTOMER_MISMATCH' | 'WALLET_MISMATCH' | 'UNRECORDABLE';
|
|
255
|
-
export type MoonPayNextAction = MoonPayConsentNextAction | MoonPaySessionNextAction | MoonPayConnectNextAction | MoonPayKycNextAction | MoonPayPrepareCaptureNextAction | MoonPayCaptureNextAction | MoonPayWaitNextAction | MoonPayOrderNextAction;
|
|
287
|
+
export type MoonPayNextAction = MoonPayConsentNextAction | MoonPaySessionNextAction | MoonPayConnectNextAction | MoonPayPayNextAction | MoonPayKycNextAction | MoonPayPrepareCaptureNextAction | MoonPayCaptureNextAction | MoonPayWaitNextAction | MoonPayOrderNextAction;
|
|
256
288
|
/**
|
|
257
289
|
* The order is terminal. `order` is its body, which the shared order screen renders. Nothing is left to
|
|
258
290
|
* send to `/fiat/next`. A converted order's `SETTLED` body offers the `delivery` transition: follow it.
|
|
@@ -267,7 +299,7 @@ export type MoonPayRefused<R, V> = {
|
|
|
267
299
|
reason: R;
|
|
268
300
|
recovery: V;
|
|
269
301
|
};
|
|
270
|
-
/** The answer to `observe`, `consent`, `session`, `connect`, `kyc`, `prepareCapture` and `capture`. */
|
|
302
|
+
/** The answer to `observe`, `consent`, `session`, `connect`, `decline`, `kyc`, `prepareCapture` and `capture`. */
|
|
271
303
|
export type MoonPayStepResponse = MoonPayNextAction | MoonPayRefused<MoonPayStepRefusal, 'REQUOTE' | 'NONE'>;
|
|
272
304
|
/**
|
|
273
305
|
* The answer to `order`. `done` once the order is terminal. A failed charge is recorded too: `done` with
|
|
@@ -284,6 +316,7 @@ export type MoonPayResponseFor = {
|
|
|
284
316
|
consent: MoonPayStepResponse;
|
|
285
317
|
session: MoonPayStepResponse;
|
|
286
318
|
connect: MoonPayStepResponse;
|
|
319
|
+
decline: MoonPayStepResponse;
|
|
287
320
|
kyc: MoonPayStepResponse;
|
|
288
321
|
prepareCapture: MoonPayStepResponse;
|
|
289
322
|
capture: MoonPayStepResponse;
|
|
@@ -3,15 +3,18 @@
|
|
|
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 { MoonPayCaptureDocument, MoonPayCaptureNextAction, MoonPayCaptureRequest, MoonPayCheckout, MoonPayConnectNextAction, MoonPayConnectRequest, MoonPayConsentNextAction, MoonPayConsentRequest, MoonPayDone, MoonPayErrorBody, MoonPayFault, MoonPayKycNextAction, MoonPayKycRequest, MoonPayNextRequest, MoonPayObserveRequest, MoonPayOrderNextAction, MoonPayOrderPendingNextAction, MoonPayOrderRequest, MoonPayOrderResponse, MoonPayPrepareCaptureNextAction, MoonPayPrepareCaptureRequest, MoonPayReask, MoonPayReaskReason, MoonPayReaskRequirement, MoonPayNextAction, MoonPayQuoteInput, MoonPayRequest, MoonPayRequestContext, MoonPayResponseFor, MoonPaySdkCredentials, MoonPaySessionNextAction, MoonPaySessionRequest, MoonPayStepResponse, MoonPayWaitNextAction } from './moonpay';
|
|
6
|
+
import type { MoonPayCaptureDocument, MoonPayCaptureNextAction, MoonPayCaptureRequest, MoonPayCheckout, MoonPayConnectNextAction, MoonPayConnectRequest, MoonPayConsentNextAction, MoonPayConsentRequest, MoonPayDeclineRequest, MoonPayDone, MoonPayErrorBody, MoonPayFault, MoonPayGuestDeclineReason, MoonPayKycNextAction, MoonPayKycRequest, MoonPayNextRequest, MoonPayObserveRequest, MoonPayOrderNextAction, MoonPayOrderPendingNextAction, MoonPayOrderRequest, MoonPayOrderResponse, MoonPayPath, MoonPayPayNextAction, MoonPayPrepareCaptureNextAction, MoonPayPrepareCaptureRequest, MoonPayReask, MoonPayReaskReason, MoonPayReaskRequirement, MoonPayNextAction, MoonPayQuoteInput, MoonPayRequest, MoonPayRequestContext, MoonPayResponseFor, MoonPaySdkCredentials, MoonPaySessionNextAction, MoonPaySessionRequest, MoonPayStepResponse, MoonPayWaitNextAction } from './moonpay';
|
|
7
7
|
export declare const MoonPayCheckoutSchema: z.ZodType<MoonPayCheckout>;
|
|
8
8
|
export declare const MoonPaySdkCredentialsSchema: z.ZodType<MoonPaySdkCredentials>;
|
|
9
|
+
export declare const MoonPayPathSchema: z.ZodType<MoonPayPath>;
|
|
9
10
|
export declare const MoonPayRequestContextSchema: z.ZodType<MoonPayRequestContext>;
|
|
10
11
|
export declare const MoonPayQuoteInputSchema: z.ZodType<MoonPayQuoteInput>;
|
|
12
|
+
export declare const MoonPayGuestDeclineReasonSchema: z.ZodType<MoonPayGuestDeclineReason>;
|
|
11
13
|
export declare const MoonPayObserveRequestSchema: z.ZodType<MoonPayRequestContext & MoonPayObserveRequest>;
|
|
12
14
|
export declare const MoonPayConsentRequestSchema: z.ZodType<MoonPayRequestContext & MoonPayConsentRequest>;
|
|
13
15
|
export declare const MoonPaySessionRequestSchema: z.ZodType<MoonPayRequestContext & MoonPaySessionRequest>;
|
|
14
16
|
export declare const MoonPayConnectRequestSchema: z.ZodType<MoonPayRequestContext & MoonPayConnectRequest>;
|
|
17
|
+
export declare const MoonPayDeclineRequestSchema: z.ZodType<MoonPayRequestContext & MoonPayDeclineRequest>;
|
|
15
18
|
export declare const MoonPayKycRequestSchema: z.ZodType<MoonPayRequestContext & MoonPayKycRequest>;
|
|
16
19
|
export declare const MoonPayPrepareCaptureRequestSchema: z.ZodType<MoonPayRequestContext & MoonPayPrepareCaptureRequest>;
|
|
17
20
|
export declare const MoonPayCaptureRequestSchema: z.ZodType<MoonPayRequestContext & MoonPayCaptureRequest>;
|
|
@@ -21,6 +24,7 @@ export declare const MoonPayNextRequestSchema: z.ZodType<MoonPayNextRequest>;
|
|
|
21
24
|
export declare const MoonPayConsentNextActionSchema: z.ZodType<MoonPayConsentNextAction>;
|
|
22
25
|
export declare const MoonPaySessionNextActionSchema: z.ZodType<MoonPaySessionNextAction>;
|
|
23
26
|
export declare const MoonPayConnectNextActionSchema: z.ZodType<MoonPayConnectNextAction>;
|
|
27
|
+
export declare const MoonPayPayNextActionSchema: z.ZodType<MoonPayPayNextAction>;
|
|
24
28
|
export declare const MoonPayKycNextActionSchema: z.ZodType<MoonPayKycNextAction>;
|
|
25
29
|
export declare const MoonPayPrepareCaptureNextActionSchema: z.ZodType<MoonPayPrepareCaptureNextAction>;
|
|
26
30
|
export declare const MoonPayCaptureDocumentSchema: z.ZodType<MoonPayCaptureDocument>;
|
package/dist/routing.d.ts
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* an extra key or a blank string fails them, so send only the declared fields.
|
|
22
22
|
*/
|
|
23
23
|
import type { CountryCode, FiatCurrencyCode, PaymentMethodCategory } from './codes';
|
|
24
|
-
import type { FiatAmount, DestinationAsset, FiatProvider, QuoteLimitRange } from './types';
|
|
24
|
+
import type { FiatAmount, DestinationAsset, FiatHandoffPath, FiatProvider, QuoteLimitRange } from './types';
|
|
25
25
|
export declare const ROUTING_ENDPOINTS: {
|
|
26
26
|
readonly table: "POST /fiat/routing/table";
|
|
27
27
|
/** Temporary: `POST /fiat/next` replaces it for each provider that moves there. */
|
|
@@ -146,6 +146,12 @@ export interface FiatRoutingQuoteTerms {
|
|
|
146
146
|
* from the partner's configured asset. Optional so an older client still parses.
|
|
147
147
|
*/
|
|
148
148
|
destinationAsset?: DestinationAsset;
|
|
149
|
+
/**
|
|
150
|
+
* Provider paths this client can run, each at most once. Routing considers such a path only when it is
|
|
151
|
+
* listed, and a quote that picks one carries `handoff.path`. Leave a path out of the requote after its
|
|
152
|
+
* flow answers `refused` with `REQUOTE`, so routing can still pick the provider's other paths.
|
|
153
|
+
*/
|
|
154
|
+
handoffPaths?: FiatHandoffPath[];
|
|
149
155
|
}
|
|
150
156
|
/**
|
|
151
157
|
* `POST /fiat/routing/quote`: the terms plus which providers to price, in one of two forms.
|
package/dist/schemas.d.ts
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
*/
|
|
29
29
|
import { z } from 'zod';
|
|
30
30
|
import type { UsStateCode } from './codes';
|
|
31
|
-
import type { BlockedReason, CryptoAmount, FailureReason, FeeLine, FiatAmount, FiatEndpoint, FiatProvider, FiatAuthRefreshRequest, FiatAuthRefreshResponse, FiatAuthRevokeRequest, FiatAuthStartRequest, FiatAuthVerifyRequest, FiatSession, FiatStepResponse, FieldSpec, FlowState, FormDescriptor, FormField, FormFieldType, InstructionField, Instructions, Instrument, JsonValue, KYCProvider, KycReviewDuration, OrderRef, OrderStatus, OrderSummary, PollSpec, PreparedPayment, PaymentSurface, Quote, QuoteLimitRange, QuoteLimits, Recovery, Refund, ReportSpec, SelectOption, StatusHistoryEntry, Surface, PreferredIdentityDocument, KycFieldId, ClientExecutedDelivery, KycSdkResultReport, SurfaceKind, SurfaceProvider, TermsAcceptance, Transition, TransitionInputs, TransitionParams, Tx, DestinationAsset, FiatGeo, FiatNextRequest } from './types';
|
|
31
|
+
import type { BlockedReason, CryptoAmount, FailureReason, FeeLine, FiatAmount, FiatEndpoint, FiatHandoffPath, FiatProvider, FiatAuthRecipientRequest, FiatAuthRecipientResponse, FiatAuthRefreshRequest, FiatAuthRefreshResponse, FiatAuthRevokeRequest, FiatAuthStartRequest, FiatAuthVerifyRequest, FiatSession, FiatStepResponse, FieldSpec, FlowState, FormDescriptor, FormField, FormFieldType, InstructionField, Instructions, Instrument, JsonValue, KYCProvider, KycReviewDuration, OrderRef, OrderStatus, OrderSummary, PollSpec, PreparedPayment, PaymentSurface, Quote, QuoteLimitRange, QuoteLimits, Recovery, Refund, ReportSpec, SelectOption, StatusHistoryEntry, Surface, PreferredIdentityDocument, KycFieldId, ClientExecutedDelivery, KycSdkResultReport, SurfaceKind, SurfaceProvider, TermsAcceptance, Transition, TransitionInputs, TransitionParams, Tx, DestinationAsset, FiatGeo, FiatNextRequest } from './types';
|
|
32
32
|
import type { FiatTermsErrorBody, FiatTermsRequest, FiatTermsResponse, TermsDocument, TermsDocumentAcceptance } from './terms';
|
|
33
33
|
import type { FiatRoutingQuoteErrorBody, FiatRoutingQuoteRequest, FiatRoutingQuoteTerms, FiatRoutingTableErrorBody, FiatRoutingTableRequest, FiatRoutingTableResponse } from './routing';
|
|
34
34
|
export declare const JsonSchema: z.ZodType<JsonValue>;
|
|
@@ -38,6 +38,7 @@ export declare const ENDPOINT_PATTERN: RegExp;
|
|
|
38
38
|
export declare const FiatEndpointSchema: z.ZodType<FiatEndpoint>;
|
|
39
39
|
export declare const UsStateCodeSchema: z.ZodType<UsStateCode>;
|
|
40
40
|
export declare const FiatProviderSchema: z.ZodType<FiatProvider>;
|
|
41
|
+
export declare const FiatHandoffPathSchema: z.ZodType<FiatHandoffPath>;
|
|
41
42
|
export declare const KYCProviderSchema: z.ZodType<KYCProvider>;
|
|
42
43
|
export declare const SurfaceProviderSchema: z.ZodType<SurfaceProvider>;
|
|
43
44
|
export declare const OrderStatusSchema: z.ZodType<OrderStatus>;
|
|
@@ -128,5 +129,7 @@ export declare const FiatAuthVerifyRequestSchema: z.ZodType<FiatAuthVerifyReques
|
|
|
128
129
|
export declare const FiatAuthRefreshRequestSchema: z.ZodType<FiatAuthRefreshRequest>;
|
|
129
130
|
export declare const FiatAuthRefreshResponseSchema: z.ZodType<FiatAuthRefreshResponse>;
|
|
130
131
|
export declare const FiatAuthRevokeRequestSchema: z.ZodType<FiatAuthRevokeRequest>;
|
|
132
|
+
export declare const FiatAuthRecipientRequestSchema: z.ZodType<FiatAuthRecipientRequest>;
|
|
133
|
+
export declare const FiatAuthRecipientResponseSchema: z.ZodType<FiatAuthRecipientResponse>;
|
|
131
134
|
export declare const FiatStepResponseSchema: z.ZodType<FiatStepResponse>;
|
|
132
135
|
export {};
|
package/dist/table.d.ts
CHANGED
|
@@ -97,7 +97,7 @@ export declare const STATE_KEYS: StateKey[];
|
|
|
97
97
|
* session-minting call for that rail. The `/fiat/auth/*` routes come from the Fun identity design
|
|
98
98
|
* that specifies `FUN_AUTH`.
|
|
99
99
|
*/
|
|
100
|
-
export declare const DOCUMENTED_ENDPOINTS: readonly ["GET /fiat/payment-methods", "POST /fiat/quote", "POST /fiat/auth", "POST /fiat/auth/verify", "POST /fiat/auth/refresh", "POST /fiat/auth/revoke", "POST /fiat/payment-session", "POST /fiat/session", "POST /fiat/session/verify", "GET /fiat/quotes/:quoteRef", "POST /fiat/kyc/form", "POST /fiat/kyc/capture", "POST /fiat/kyc/sdk-token", "POST /fiat/kyc/document", "POST /fiat/instruments", "POST /fiat/orders", "GET /fiat/orders/:id", "GET /fiat/delivery/:deliveryId", "GET /fiat/orders/:id/instructions", "POST /fiat/orders/:id/confirm-payment", "POST /fiat/orders/:id/reference", "POST /fiat/orders/:id/cancel", "POST /fiat/orders/:id/surface-result"];
|
|
100
|
+
export declare const DOCUMENTED_ENDPOINTS: readonly ["GET /fiat/payment-methods", "POST /fiat/quote", "POST /fiat/auth", "POST /fiat/auth/verify", "POST /fiat/auth/refresh", "POST /fiat/auth/revoke", "POST /fiat/auth/recipient", "POST /fiat/payment-session", "POST /fiat/session", "POST /fiat/session/verify", "GET /fiat/quotes/:quoteRef", "POST /fiat/kyc/form", "POST /fiat/kyc/capture", "POST /fiat/kyc/sdk-token", "POST /fiat/kyc/document", "POST /fiat/instruments", "POST /fiat/orders", "GET /fiat/orders/:id", "GET /fiat/delivery/:deliveryId", "GET /fiat/orders/:id/instructions", "POST /fiat/orders/:id/confirm-payment", "POST /fiat/orders/:id/reference", "POST /fiat/orders/:id/cancel", "POST /fiat/orders/:id/surface-result"];
|
|
101
101
|
/**
|
|
102
102
|
* Documented endpoints no flow state offers, and why. Declared so an endpoint nothing can reach is
|
|
103
103
|
* visible instead of silent — the table test asserts the unoffered set equals exactly these.
|
package/dist/table.js
CHANGED
|
@@ -37,7 +37,7 @@ __export(table_exports, {
|
|
|
37
37
|
module.exports = __toCommonJS(table_exports);
|
|
38
38
|
|
|
39
39
|
// package.json
|
|
40
|
-
var version = "0.
|
|
40
|
+
var version = "0.44.0";
|
|
41
41
|
|
|
42
42
|
// src/table.ts
|
|
43
43
|
var TABLE_VERSION = version;
|
|
@@ -150,7 +150,7 @@ var TRANSITION_TABLE = {
|
|
|
150
150
|
"Not in the FE doc, so no screen number: the client renders it on its contact and OTP screens.",
|
|
151
151
|
"Every FUN_AUTH error is category USER_ERROR with a code from FUN_AUTH_ERROR_CODES. A wrong code re-enters CODE with BAD_CODE and a lower attemptsRemaining; TOO_MANY_ATTEMPTS and CODE_EXPIRED drop the challenge and offer resend; OTP_DISPATCH_THROTTLED re-enters with resendAvailableAtMs set.",
|
|
152
152
|
"resend carries the verificationRef the client holds, even one the server has dropped (expired, too many attempts); the server starts a fresh challenge for the same email while it still remembers the challenge (its code expiry plus a short grace); once it is forgotten the answer is IDENTIFIER with CODE_EXPIRED.",
|
|
153
|
-
"POST /fiat/auth/refresh and /
|
|
153
|
+
"POST /fiat/auth/refresh, /revoke and /recipient are called by the SDK session store, never offered as transitions."
|
|
154
154
|
]
|
|
155
155
|
},
|
|
156
156
|
SESSION_AUTH: {
|
|
@@ -516,6 +516,7 @@ var DOCUMENTED_ENDPOINTS = [
|
|
|
516
516
|
"POST /fiat/auth/verify",
|
|
517
517
|
"POST /fiat/auth/refresh",
|
|
518
518
|
"POST /fiat/auth/revoke",
|
|
519
|
+
"POST /fiat/auth/recipient",
|
|
519
520
|
"POST /fiat/payment-session",
|
|
520
521
|
"POST /fiat/session",
|
|
521
522
|
"POST /fiat/session/verify",
|
|
@@ -547,6 +548,10 @@ var UNOFFERED_ENDPOINTS = [
|
|
|
547
548
|
endpoint: "POST /fiat/auth/revoke",
|
|
548
549
|
reason: "SDK session store, not a transition."
|
|
549
550
|
},
|
|
551
|
+
{
|
|
552
|
+
endpoint: "POST /fiat/auth/recipient",
|
|
553
|
+
reason: "SDK session store at beginDeposit, not a transition."
|
|
554
|
+
},
|
|
550
555
|
{
|
|
551
556
|
endpoint: "POST /fiat/kyc/document",
|
|
552
557
|
reason: "FILE fields use it for a direct provider/vendor upload handshake and completion report; the harness owns that auxiliary path and it is not a transition (see KYC/INPUT_REQUIRED notes)."
|
package/dist/table.mjs
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -56,7 +56,7 @@ export type HttpVerb = 'GET' | 'POST';
|
|
|
56
56
|
* cannot express "no slash", so `GET /fiat/orders/${string}` also admits sub-paths. Precision at
|
|
57
57
|
* that level is the table's job (`allowedTransitions` + `endpointMatches`), not the type's.
|
|
58
58
|
*/
|
|
59
|
-
export type FiatEndpoint = 'GET /fiat/payment-methods' | 'POST /fiat/quote' | 'POST /fiat/auth' | 'POST /fiat/auth/verify' | 'POST /fiat/auth/refresh' | 'POST /fiat/auth/revoke' | 'POST /fiat/payment-session' | 'POST /fiat/session' | 'POST /fiat/session/verify' | `GET /fiat/quotes/${string}` | 'POST /fiat/kyc/form' | 'POST /fiat/kyc/capture' | 'POST /fiat/kyc/sdk-token' | 'POST /fiat/kyc/document' | 'POST /fiat/instruments' | 'POST /fiat/orders' | `GET /fiat/orders/${string}` | `GET /fiat/delivery/${string}` | `GET /fiat/orders/${string}/instructions` | `POST /fiat/orders/${string}/confirm-payment` | `POST /fiat/orders/${string}/reference` | `POST /fiat/orders/${string}/cancel` | `POST /fiat/orders/${string}/surface-result`;
|
|
59
|
+
export type FiatEndpoint = 'GET /fiat/payment-methods' | 'POST /fiat/quote' | 'POST /fiat/auth' | 'POST /fiat/auth/verify' | 'POST /fiat/auth/refresh' | 'POST /fiat/auth/revoke' | 'POST /fiat/auth/recipient' | 'POST /fiat/payment-session' | 'POST /fiat/session' | 'POST /fiat/session/verify' | `GET /fiat/quotes/${string}` | 'POST /fiat/kyc/form' | 'POST /fiat/kyc/capture' | 'POST /fiat/kyc/sdk-token' | 'POST /fiat/kyc/document' | 'POST /fiat/instruments' | 'POST /fiat/orders' | `GET /fiat/orders/${string}` | `GET /fiat/delivery/${string}` | `GET /fiat/orders/${string}/instructions` | `POST /fiat/orders/${string}/confirm-payment` | `POST /fiat/orders/${string}/reference` | `POST /fiat/orders/${string}/cancel` | `POST /fiat/orders/${string}/surface-result`;
|
|
60
60
|
/**
|
|
61
61
|
* Routing metadata, not sequencing policy. Reserved values may be emitted only after their adapter
|
|
62
62
|
* and conformance fixture land.
|
|
@@ -587,6 +587,45 @@ export type FiatAuthRefreshResponse = {
|
|
|
587
587
|
export type FiatAuthRevokeRequest = {
|
|
588
588
|
refreshHandle: string;
|
|
589
589
|
};
|
|
590
|
+
/**
|
|
591
|
+
* Body of `POST /fiat/auth/recipient`, sent with `Authorization: Bearer <accessToken>`. Binds the
|
|
592
|
+
* recipient of the deposit in progress for the partner the API key names. The backend records the
|
|
593
|
+
* binding for this login session; the session and its handle are unchanged. `refreshHandle` is the
|
|
594
|
+
* write credential, not a rotation: it must belong to the same login as the Bearer. The SDK calls it
|
|
595
|
+
* at `beginDeposit`, once a session is held, and may bind a new address for every deposit.
|
|
596
|
+
*
|
|
597
|
+
* Split by VM, as `DestinationAsset` is. The recipient is a destination-side value, so the backend
|
|
598
|
+
* checks the binding against the chain the delivery lands on: the quote's `destinationAsset` when
|
|
599
|
+
* there is one, else the rail. Solana carries no chain id for the same reason `DestinationAsset` does
|
|
600
|
+
* not: the backend maps each VM to its own chain ids in one place. `depositAddress` must be a wallet
|
|
601
|
+
* on that chain, and the chain must be a destination registered for the partner.
|
|
602
|
+
*
|
|
603
|
+
* Address form. EVM: any case accepted; a mixed-case address must pass its EIP-55 checksum, and the
|
|
604
|
+
* backend stores and reports the checksummed form. Solana: base58 as given.
|
|
605
|
+
*
|
|
606
|
+
* Errors: 401 when the bearer is expired or not a Fun session, or the handle is not this login's or
|
|
607
|
+
* has ended. The SDK refreshes once and retries; a 401 on the refresh itself means sign in again.
|
|
608
|
+
* 400 with `CHAIN_NOT_SERVED` or `RECIPIENT_NOT_A_WALLET`.
|
|
609
|
+
*/
|
|
610
|
+
export type FiatAuthRecipientRequest = {
|
|
611
|
+
refreshHandle: string;
|
|
612
|
+
} & ({
|
|
613
|
+
vm: 'EVM';
|
|
614
|
+
chainId: number;
|
|
615
|
+
depositAddress: `0x${string}`;
|
|
616
|
+
} | {
|
|
617
|
+
vm: 'SOLANA';
|
|
618
|
+
depositAddress: string;
|
|
619
|
+
});
|
|
620
|
+
/**
|
|
621
|
+
* 200 body of `POST /fiat/auth/recipient`. The session and its handle are unchanged. `expiresAtMs`
|
|
622
|
+
* (server clock, ms) is when the binding stops being honoured, 24 h after `boundAtMs`; the SDK binds
|
|
623
|
+
* again after that, or on a `NO_WALLET` or `RECIPIENT_CHAIN_MISMATCH` refusal.
|
|
624
|
+
*/
|
|
625
|
+
export type FiatAuthRecipientResponse = {
|
|
626
|
+
boundAtMs: number;
|
|
627
|
+
expiresAtMs: number;
|
|
628
|
+
};
|
|
590
629
|
/**
|
|
591
630
|
* The expected length of a provider's KYC review. `BRIEF`: the client stays on its current screen,
|
|
592
631
|
* polling, for up to `holdMs` (at most 600000), then shows the in-review screen. `EXTENDED`: the
|
|
@@ -831,12 +870,22 @@ export type FiatStepResponse = (FiatStepResponseBase & {
|
|
|
831
870
|
/**
|
|
832
871
|
* The provider runs its own flow from here (`POST /fiat/next`). Present
|
|
833
872
|
* only on a `QUOTE`, when the request's `handoffs` named this provider; the response then
|
|
834
|
-
* carries no transitions.
|
|
873
|
+
* carries no transitions. `path` names a provider path the request offered in `handoffPaths`
|
|
874
|
+
* (`guest_checkout` for `MOONPAY/guest_checkout`); the client sends it on every `/fiat/next` request.
|
|
835
875
|
*/
|
|
836
876
|
handoff?: {
|
|
837
877
|
provider: FiatProvider;
|
|
878
|
+
path?: FiatHandoffPathName;
|
|
838
879
|
};
|
|
839
880
|
});
|
|
881
|
+
/**
|
|
882
|
+
* A provider path the client can run, offered on the quote request in `handoffPaths`. Routing considers
|
|
883
|
+
* a path listed here only when the request offers it, so leaving it out of a requote excludes that path
|
|
884
|
+
* alone and keeps its provider's other paths.
|
|
885
|
+
*/
|
|
886
|
+
export type FiatHandoffPath = 'MOONPAY/guest_checkout';
|
|
887
|
+
/** The path part of a `FiatHandoffPath`, as `handoff.path` names it. */
|
|
888
|
+
export type FiatHandoffPathName = FiatHandoffPath extends `${string}/${infer Path}` ? Path : never;
|
|
840
889
|
/**
|
|
841
890
|
* The asset the user receives at the end of the purchase. The client always sends it. The backend
|
|
842
891
|
* compares it with the partner's configured asset and adds a conversion only when they differ,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fun-xyz/fiat-contract",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.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": {
|