@fun-xyz/fiat-contract 0.50.0 → 0.51.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-BK2XD3JT.mjs → chunk-ICIHTCZN.mjs} +1 -1
- package/dist/index.js +29 -7
- package/dist/index.mjs +29 -7
- package/dist/providers/coinbase.d.ts +2 -1
- package/dist/providers/moonpay.d.ts +2 -1
- package/dist/providers/stripe.d.ts +2 -1
- package/dist/schemas.d.ts +12 -1
- package/dist/table.js +1 -1
- package/dist/table.mjs +1 -1
- package/dist/types.d.ts +14 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -172,6 +172,7 @@ __export(index_exports, {
|
|
|
172
172
|
MoonPayWaitNextActionSchema: () => MoonPayWaitNextActionSchema,
|
|
173
173
|
OrderAwaitingConfirmationStateSchema: () => OrderAwaitingConfirmationStateSchema,
|
|
174
174
|
OrderCreatedStateSchema: () => OrderCreatedStateSchema,
|
|
175
|
+
OrderPollSchema: () => OrderPollSchema,
|
|
175
176
|
OrderRefSchema: () => OrderRefSchema,
|
|
176
177
|
OrderStatusSchema: () => OrderStatusSchema,
|
|
177
178
|
OrderSummarySchema: () => OrderSummarySchema,
|
|
@@ -260,6 +261,7 @@ __export(index_exports, {
|
|
|
260
261
|
assertLegalEmission: () => assertLegalEmission,
|
|
261
262
|
assertLegalReturn: () => assertLegalReturn,
|
|
262
263
|
checkLegalEmission: () => checkLegalEmission,
|
|
264
|
+
checkOrderPendingPoll: () => checkOrderPendingPoll,
|
|
263
265
|
endpointMatches: () => endpointMatches,
|
|
264
266
|
fixtureMeta: () => fixtureMeta,
|
|
265
267
|
isEeaCountry: () => isEeaCountry,
|
|
@@ -989,6 +991,21 @@ var $pollSpec = obj({
|
|
|
989
991
|
}
|
|
990
992
|
});
|
|
991
993
|
var PollSpecSchema = $pollSpec;
|
|
994
|
+
var OrderPollSchema = obj({
|
|
995
|
+
backoffFactor: import_zod.z.number().finite().min(1).max(4),
|
|
996
|
+
maxIntervalMs: import_zod.z.number().int().min(MIN_INTERVAL_MS).max(6e4),
|
|
997
|
+
giveUpAfterMs: import_zod.z.number().int().positive().max(60 * 60 * 1e3)
|
|
998
|
+
});
|
|
999
|
+
function checkOrderPendingPoll(response, context2) {
|
|
1000
|
+
const { poll, retryAfterMs: retryAfterMs2 } = response;
|
|
1001
|
+
if (response.next !== "orderPending" || poll === void 0 || retryAfterMs2 === void 0) return;
|
|
1002
|
+
if (retryAfterMs2 < MIN_INTERVAL_MS) {
|
|
1003
|
+
context2.addIssue({ code: "custom", path: ["retryAfterMs"], message: `retryAfterMs must be at least ${MIN_INTERVAL_MS} with a poll` });
|
|
1004
|
+
}
|
|
1005
|
+
if (poll.maxIntervalMs < retryAfterMs2) {
|
|
1006
|
+
context2.addIssue({ code: "custom", path: ["poll", "maxIntervalMs"], message: "maxIntervalMs must be at least retryAfterMs" });
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
992
1009
|
var $reportSpec = obj({
|
|
993
1010
|
endpoint: $endpoint,
|
|
994
1011
|
params: $params.optional(),
|
|
@@ -1473,7 +1490,7 @@ var $stepResponse = import_zod.z.union([$providerBoundStepResponse, $funAuthStep
|
|
|
1473
1490
|
var FiatStepResponseSchema = $stepResponse;
|
|
1474
1491
|
|
|
1475
1492
|
// package.json
|
|
1476
|
-
var version = "0.
|
|
1493
|
+
var version = "0.51.0";
|
|
1477
1494
|
|
|
1478
1495
|
// src/table.ts
|
|
1479
1496
|
var TABLE_VERSION = version;
|
|
@@ -3605,6 +3622,7 @@ var $orderPendingNextAction = obj2({
|
|
|
3605
3622
|
next: import_zod2.z.literal("orderPending"),
|
|
3606
3623
|
orderId: $nonEmpty,
|
|
3607
3624
|
retryAfterMs: import_zod2.z.number().int().positive().max(6e4),
|
|
3625
|
+
poll: OrderPollSchema.optional(),
|
|
3608
3626
|
order: FiatStepResponseSchema.nullable()
|
|
3609
3627
|
});
|
|
3610
3628
|
var checkConsent = (nextAction, context2) => {
|
|
@@ -3648,7 +3666,7 @@ var MoonPayReaskSchema = $reask;
|
|
|
3648
3666
|
var MoonPayCaptureNextActionSchema = $captureShape.superRefine(checkCapture);
|
|
3649
3667
|
var MoonPayWaitNextActionSchema = $waitNextAction;
|
|
3650
3668
|
var MoonPayOrderNextActionSchema = $orderNextAction;
|
|
3651
|
-
var MoonPayOrderPendingNextActionSchema = $orderPendingNextAction;
|
|
3669
|
+
var MoonPayOrderPendingNextActionSchema = $orderPendingNextAction.superRefine(checkOrderPendingPoll);
|
|
3652
3670
|
var checkNextAction = (response, context2) => {
|
|
3653
3671
|
if (response.next === "consent") checkConsent(response, context2);
|
|
3654
3672
|
if (response.next === "kyc") checkKyc(response, context2);
|
|
@@ -3680,7 +3698,7 @@ var $orderRefused = obj2({
|
|
|
3680
3698
|
});
|
|
3681
3699
|
var $stepResponse2 = import_zod2.z.discriminatedUnion("next", [...$nextActionOptions, $stepRefused]).superRefine(checkNextAction);
|
|
3682
3700
|
var MoonPayStepResponseSchema = $stepResponse2;
|
|
3683
|
-
var $orderResponse = import_zod2.z.discriminatedUnion("next", [$done, $orderNextAction, $orderPendingNextAction, $orderRefused]);
|
|
3701
|
+
var $orderResponse = import_zod2.z.discriminatedUnion("next", [$done, $orderNextAction, $orderPendingNextAction, $orderRefused]).superRefine(checkOrderPendingPoll);
|
|
3684
3702
|
var MoonPayOrderResponseSchema = $orderResponse;
|
|
3685
3703
|
var MoonPayResponseSchemaFor = {
|
|
3686
3704
|
observe: MoonPayStepResponseSchema,
|
|
@@ -3818,6 +3836,7 @@ var $orderPendingNextAction2 = obj3({
|
|
|
3818
3836
|
next: import_zod3.z.literal("orderPending"),
|
|
3819
3837
|
orderId: $nonEmpty2,
|
|
3820
3838
|
retryAfterMs: $retryAfterMs,
|
|
3839
|
+
poll: OrderPollSchema.optional(),
|
|
3821
3840
|
order: FiatStepResponseSchema.nullable()
|
|
3822
3841
|
});
|
|
3823
3842
|
var checkConsent2 = (nextAction, context2) => {
|
|
@@ -3844,8 +3863,9 @@ var CoinbaseKycNextActionSchema = $kycShape2.superRefine(checkKyc2);
|
|
|
3844
3863
|
var CoinbaseWaitNextActionSchema = $waitNextAction2;
|
|
3845
3864
|
var CoinbasePlaceOrderNextActionSchema = $placeOrderNextAction;
|
|
3846
3865
|
var CoinbasePayNextActionSchema = $payNextAction2;
|
|
3847
|
-
var CoinbaseOrderPendingNextActionSchema = $orderPendingNextAction2;
|
|
3866
|
+
var CoinbaseOrderPendingNextActionSchema = $orderPendingNextAction2.superRefine(checkOrderPendingPoll);
|
|
3848
3867
|
var checkNextAction2 = (response, context2) => {
|
|
3868
|
+
checkOrderPendingPoll(response, context2);
|
|
3849
3869
|
if (response.next === "consent") checkConsent2(response, context2);
|
|
3850
3870
|
if (response.next === "kyc") checkKyc2(response, context2);
|
|
3851
3871
|
};
|
|
@@ -3879,7 +3899,7 @@ var $refused = import_zod3.z.union([
|
|
|
3879
3899
|
var CoinbaseRefusedSchema = $refused;
|
|
3880
3900
|
var $stepResponse3 = import_zod3.z.union([import_zod3.z.discriminatedUnion("next", [...$nextActionOptions2, $done2]), $refused]).superRefine(checkNextAction2);
|
|
3881
3901
|
var CoinbaseStepResponseSchema = $stepResponse3;
|
|
3882
|
-
var $orderResponse2 = import_zod3.z.discriminatedUnion("next", [$done2, $orderPendingNextAction2]);
|
|
3902
|
+
var $orderResponse2 = import_zod3.z.discriminatedUnion("next", [$done2, $orderPendingNextAction2]).superRefine(checkOrderPendingPoll);
|
|
3883
3903
|
var CoinbaseOrderResponseSchema = $orderResponse2;
|
|
3884
3904
|
var CoinbaseResponseSchemaFor = {
|
|
3885
3905
|
observe: CoinbaseStepResponseSchema,
|
|
@@ -4034,6 +4054,7 @@ var orderPendingNextAction = obj4({
|
|
|
4034
4054
|
next: import_zod4.z.literal("orderPending"),
|
|
4035
4055
|
orderId: mintedOrderId,
|
|
4036
4056
|
retryAfterMs,
|
|
4057
|
+
poll: OrderPollSchema.optional(),
|
|
4037
4058
|
order: FiatStepResponseSchema.nullable()
|
|
4038
4059
|
});
|
|
4039
4060
|
var checkConsent3 = (nextAction, context2) => {
|
|
@@ -4078,8 +4099,9 @@ var StripeWaitNextActionSchema = waitNextAction;
|
|
|
4078
4099
|
var StripePlaceOrderNextActionSchema = placeOrderNextAction.superRefine(checkPlaceOrder);
|
|
4079
4100
|
var StripePayNextActionSchema = payNextAction;
|
|
4080
4101
|
var StripeCheckoutSecretNextActionSchema = checkoutSecretNextAction;
|
|
4081
|
-
var StripeOrderPendingNextActionSchema = orderPendingNextAction;
|
|
4102
|
+
var StripeOrderPendingNextActionSchema = orderPendingNextAction.superRefine(checkOrderPendingPoll);
|
|
4082
4103
|
var checkNextAction3 = (response, context2) => {
|
|
4104
|
+
checkOrderPendingPoll(response, context2);
|
|
4083
4105
|
if (response.next === "consent") checkConsent3(response, context2);
|
|
4084
4106
|
if (response.next === "kyc") checkKyc3(response, context2);
|
|
4085
4107
|
if (response.next === "placeOrder") checkPlaceOrder(response, context2);
|
|
@@ -4119,7 +4141,7 @@ var stepResponse = import_zod4.z.union([import_zod4.z.discriminatedUnion("next",
|
|
|
4119
4141
|
var StripeStepResponseSchema = stepResponse;
|
|
4120
4142
|
var checkoutResponse = import_zod4.z.union([import_zod4.z.discriminatedUnion("next", [...nextActionOptions, done, checkoutSecretNextAction]), refused]).superRefine(checkNextAction3);
|
|
4121
4143
|
var StripeCheckoutResponseSchema = checkoutResponse;
|
|
4122
|
-
var orderResponse = import_zod4.z.discriminatedUnion("next", [done, orderPendingNextAction]);
|
|
4144
|
+
var orderResponse = import_zod4.z.discriminatedUnion("next", [done, orderPendingNextAction]).superRefine(checkOrderPendingPoll);
|
|
4123
4145
|
var StripeOrderResponseSchema = orderResponse;
|
|
4124
4146
|
var StripeResponseSchemaFor = {
|
|
4125
4147
|
observe: StripeStepResponseSchema,
|
package/dist/index.mjs
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
tableEntry,
|
|
17
17
|
unofferedEndpoints,
|
|
18
18
|
unreachableStates
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-ICIHTCZN.mjs";
|
|
20
20
|
import {
|
|
21
21
|
MOONPAY_ENDPOINTS
|
|
22
22
|
} from "./chunk-TIEGTTFY.mjs";
|
|
@@ -749,6 +749,21 @@ var $pollSpec = obj({
|
|
|
749
749
|
}
|
|
750
750
|
});
|
|
751
751
|
var PollSpecSchema = $pollSpec;
|
|
752
|
+
var OrderPollSchema = obj({
|
|
753
|
+
backoffFactor: z.number().finite().min(1).max(4),
|
|
754
|
+
maxIntervalMs: z.number().int().min(MIN_INTERVAL_MS).max(6e4),
|
|
755
|
+
giveUpAfterMs: z.number().int().positive().max(60 * 60 * 1e3)
|
|
756
|
+
});
|
|
757
|
+
function checkOrderPendingPoll(response, context2) {
|
|
758
|
+
const { poll, retryAfterMs: retryAfterMs2 } = response;
|
|
759
|
+
if (response.next !== "orderPending" || poll === void 0 || retryAfterMs2 === void 0) return;
|
|
760
|
+
if (retryAfterMs2 < MIN_INTERVAL_MS) {
|
|
761
|
+
context2.addIssue({ code: "custom", path: ["retryAfterMs"], message: `retryAfterMs must be at least ${MIN_INTERVAL_MS} with a poll` });
|
|
762
|
+
}
|
|
763
|
+
if (poll.maxIntervalMs < retryAfterMs2) {
|
|
764
|
+
context2.addIssue({ code: "custom", path: ["poll", "maxIntervalMs"], message: "maxIntervalMs must be at least retryAfterMs" });
|
|
765
|
+
}
|
|
766
|
+
}
|
|
752
767
|
var $reportSpec = obj({
|
|
753
768
|
endpoint: $endpoint,
|
|
754
769
|
params: $params.optional(),
|
|
@@ -2696,6 +2711,7 @@ var $orderPendingNextAction = obj2({
|
|
|
2696
2711
|
next: z2.literal("orderPending"),
|
|
2697
2712
|
orderId: $nonEmpty,
|
|
2698
2713
|
retryAfterMs: z2.number().int().positive().max(6e4),
|
|
2714
|
+
poll: OrderPollSchema.optional(),
|
|
2699
2715
|
order: FiatStepResponseSchema.nullable()
|
|
2700
2716
|
});
|
|
2701
2717
|
var checkConsent = (nextAction, context2) => {
|
|
@@ -2739,7 +2755,7 @@ var MoonPayReaskSchema = $reask;
|
|
|
2739
2755
|
var MoonPayCaptureNextActionSchema = $captureShape.superRefine(checkCapture);
|
|
2740
2756
|
var MoonPayWaitNextActionSchema = $waitNextAction;
|
|
2741
2757
|
var MoonPayOrderNextActionSchema = $orderNextAction;
|
|
2742
|
-
var MoonPayOrderPendingNextActionSchema = $orderPendingNextAction;
|
|
2758
|
+
var MoonPayOrderPendingNextActionSchema = $orderPendingNextAction.superRefine(checkOrderPendingPoll);
|
|
2743
2759
|
var checkNextAction = (response, context2) => {
|
|
2744
2760
|
if (response.next === "consent") checkConsent(response, context2);
|
|
2745
2761
|
if (response.next === "kyc") checkKyc(response, context2);
|
|
@@ -2771,7 +2787,7 @@ var $orderRefused = obj2({
|
|
|
2771
2787
|
});
|
|
2772
2788
|
var $stepResponse2 = z2.discriminatedUnion("next", [...$nextActionOptions, $stepRefused]).superRefine(checkNextAction);
|
|
2773
2789
|
var MoonPayStepResponseSchema = $stepResponse2;
|
|
2774
|
-
var $orderResponse = z2.discriminatedUnion("next", [$done, $orderNextAction, $orderPendingNextAction, $orderRefused]);
|
|
2790
|
+
var $orderResponse = z2.discriminatedUnion("next", [$done, $orderNextAction, $orderPendingNextAction, $orderRefused]).superRefine(checkOrderPendingPoll);
|
|
2775
2791
|
var MoonPayOrderResponseSchema = $orderResponse;
|
|
2776
2792
|
var MoonPayResponseSchemaFor = {
|
|
2777
2793
|
observe: MoonPayStepResponseSchema,
|
|
@@ -2896,6 +2912,7 @@ var $orderPendingNextAction2 = obj3({
|
|
|
2896
2912
|
next: z3.literal("orderPending"),
|
|
2897
2913
|
orderId: $nonEmpty2,
|
|
2898
2914
|
retryAfterMs: $retryAfterMs,
|
|
2915
|
+
poll: OrderPollSchema.optional(),
|
|
2899
2916
|
order: FiatStepResponseSchema.nullable()
|
|
2900
2917
|
});
|
|
2901
2918
|
var checkConsent2 = (nextAction, context2) => {
|
|
@@ -2922,8 +2939,9 @@ var CoinbaseKycNextActionSchema = $kycShape2.superRefine(checkKyc2);
|
|
|
2922
2939
|
var CoinbaseWaitNextActionSchema = $waitNextAction2;
|
|
2923
2940
|
var CoinbasePlaceOrderNextActionSchema = $placeOrderNextAction;
|
|
2924
2941
|
var CoinbasePayNextActionSchema = $payNextAction2;
|
|
2925
|
-
var CoinbaseOrderPendingNextActionSchema = $orderPendingNextAction2;
|
|
2942
|
+
var CoinbaseOrderPendingNextActionSchema = $orderPendingNextAction2.superRefine(checkOrderPendingPoll);
|
|
2926
2943
|
var checkNextAction2 = (response, context2) => {
|
|
2944
|
+
checkOrderPendingPoll(response, context2);
|
|
2927
2945
|
if (response.next === "consent") checkConsent2(response, context2);
|
|
2928
2946
|
if (response.next === "kyc") checkKyc2(response, context2);
|
|
2929
2947
|
};
|
|
@@ -2957,7 +2975,7 @@ var $refused = z3.union([
|
|
|
2957
2975
|
var CoinbaseRefusedSchema = $refused;
|
|
2958
2976
|
var $stepResponse3 = z3.union([z3.discriminatedUnion("next", [...$nextActionOptions2, $done2]), $refused]).superRefine(checkNextAction2);
|
|
2959
2977
|
var CoinbaseStepResponseSchema = $stepResponse3;
|
|
2960
|
-
var $orderResponse2 = z3.discriminatedUnion("next", [$done2, $orderPendingNextAction2]);
|
|
2978
|
+
var $orderResponse2 = z3.discriminatedUnion("next", [$done2, $orderPendingNextAction2]).superRefine(checkOrderPendingPoll);
|
|
2961
2979
|
var CoinbaseOrderResponseSchema = $orderResponse2;
|
|
2962
2980
|
var CoinbaseResponseSchemaFor = {
|
|
2963
2981
|
observe: CoinbaseStepResponseSchema,
|
|
@@ -3107,6 +3125,7 @@ var orderPendingNextAction = obj4({
|
|
|
3107
3125
|
next: z4.literal("orderPending"),
|
|
3108
3126
|
orderId: mintedOrderId,
|
|
3109
3127
|
retryAfterMs,
|
|
3128
|
+
poll: OrderPollSchema.optional(),
|
|
3110
3129
|
order: FiatStepResponseSchema.nullable()
|
|
3111
3130
|
});
|
|
3112
3131
|
var checkConsent3 = (nextAction, context2) => {
|
|
@@ -3151,8 +3170,9 @@ var StripeWaitNextActionSchema = waitNextAction;
|
|
|
3151
3170
|
var StripePlaceOrderNextActionSchema = placeOrderNextAction.superRefine(checkPlaceOrder);
|
|
3152
3171
|
var StripePayNextActionSchema = payNextAction;
|
|
3153
3172
|
var StripeCheckoutSecretNextActionSchema = checkoutSecretNextAction;
|
|
3154
|
-
var StripeOrderPendingNextActionSchema = orderPendingNextAction;
|
|
3173
|
+
var StripeOrderPendingNextActionSchema = orderPendingNextAction.superRefine(checkOrderPendingPoll);
|
|
3155
3174
|
var checkNextAction3 = (response, context2) => {
|
|
3175
|
+
checkOrderPendingPoll(response, context2);
|
|
3156
3176
|
if (response.next === "consent") checkConsent3(response, context2);
|
|
3157
3177
|
if (response.next === "kyc") checkKyc3(response, context2);
|
|
3158
3178
|
if (response.next === "placeOrder") checkPlaceOrder(response, context2);
|
|
@@ -3192,7 +3212,7 @@ var stepResponse = z4.union([z4.discriminatedUnion("next", [...nextActionOptions
|
|
|
3192
3212
|
var StripeStepResponseSchema = stepResponse;
|
|
3193
3213
|
var checkoutResponse = z4.union([z4.discriminatedUnion("next", [...nextActionOptions, done, checkoutSecretNextAction]), refused]).superRefine(checkNextAction3);
|
|
3194
3214
|
var StripeCheckoutResponseSchema = checkoutResponse;
|
|
3195
|
-
var orderResponse = z4.discriminatedUnion("next", [done, orderPendingNextAction]);
|
|
3215
|
+
var orderResponse = z4.discriminatedUnion("next", [done, orderPendingNextAction]).superRefine(checkOrderPendingPoll);
|
|
3196
3216
|
var StripeOrderResponseSchema = orderResponse;
|
|
3197
3217
|
var StripeResponseSchemaFor = {
|
|
3198
3218
|
observe: StripeStepResponseSchema,
|
|
@@ -3425,6 +3445,7 @@ export {
|
|
|
3425
3445
|
MoonPayWaitNextActionSchema,
|
|
3426
3446
|
OrderAwaitingConfirmationStateSchema,
|
|
3427
3447
|
OrderCreatedStateSchema,
|
|
3448
|
+
OrderPollSchema,
|
|
3428
3449
|
OrderRefSchema,
|
|
3429
3450
|
OrderStatusSchema,
|
|
3430
3451
|
OrderSummarySchema,
|
|
@@ -3513,6 +3534,7 @@ export {
|
|
|
3513
3534
|
assertLegalEmission,
|
|
3514
3535
|
assertLegalReturn,
|
|
3515
3536
|
checkLegalEmission,
|
|
3537
|
+
checkOrderPendingPoll,
|
|
3516
3538
|
endpointMatches,
|
|
3517
3539
|
fixtureMeta,
|
|
3518
3540
|
isEeaCountry,
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* `./coinbase.schemas`, exported from the package root only.
|
|
14
14
|
*/
|
|
15
15
|
import type { FiatTermsRequest, TermsDocument } from '../terms';
|
|
16
|
-
import type { DestinationAsset, FeeLine, FiatAmount, FiatGeo, FiatStepResponse, FormField, KycFieldId } from '../types';
|
|
16
|
+
import type { DestinationAsset, FeeLine, FiatAmount, FiatGeo, FiatStepResponse, FormField, KycFieldId, OrderPoll } from '../types';
|
|
17
17
|
export declare const COINBASE_ENDPOINTS: {
|
|
18
18
|
readonly next: "POST /fiat/next";
|
|
19
19
|
};
|
|
@@ -155,6 +155,7 @@ export type CoinbaseOrderPendingNextAction = {
|
|
|
155
155
|
next: 'orderPending';
|
|
156
156
|
orderId: string;
|
|
157
157
|
retryAfterMs: number;
|
|
158
|
+
poll?: OrderPoll;
|
|
158
159
|
order: FiatStepResponse | null;
|
|
159
160
|
};
|
|
160
161
|
export type CoinbaseRequest = CoinbaseRequestContext & (CoinbaseObserveRequest | CoinbaseConsentRequest | CoinbaseSessionRequest | CoinbaseOtpRequest | CoinbaseKycRequest | CoinbasePlaceOrderRequest | CoinbaseOrderRequest);
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
*/
|
|
27
27
|
import type { FiatCurrencyCode } from '../codes';
|
|
28
28
|
import type { FiatTermsRequest, TermsDocument } from '../terms';
|
|
29
|
-
import type { FiatAmount, DestinationAsset, FiatGeo, FiatStepResponse, FormField, KYCProvider, KycFieldId, KycSdkResultReport } from '../types';
|
|
29
|
+
import type { FiatAmount, DestinationAsset, FiatGeo, FiatStepResponse, FormField, KYCProvider, KycFieldId, KycSdkResultReport, OrderPoll } from '../types';
|
|
30
30
|
export declare const MOONPAY_ENDPOINTS: {
|
|
31
31
|
readonly next: "POST /fiat/next";
|
|
32
32
|
};
|
|
@@ -294,6 +294,7 @@ export type MoonPayOrderPendingNextAction = {
|
|
|
294
294
|
next: 'orderPending';
|
|
295
295
|
orderId: string;
|
|
296
296
|
retryAfterMs: number;
|
|
297
|
+
poll?: OrderPoll;
|
|
297
298
|
order: FiatStepResponse | null;
|
|
298
299
|
};
|
|
299
300
|
export type MoonPayRequest = MoonPayRequestContext & (MoonPayObserveRequest | MoonPayConsentRequest | MoonPaySessionRequest | MoonPayConnectRequest | MoonPayKycRequest | MoonPayPrepareCaptureRequest | MoonPayCaptureRequest | MoonPayOrderRequest);
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import type { CountryCode } from '../codes';
|
|
16
16
|
import type { FiatTermsRequest, TermsDocument } from '../terms';
|
|
17
|
-
import type { FeeLine, FiatAmount, FiatGeo, FiatStepResponse, FormField, KycFieldId } from '../types';
|
|
17
|
+
import type { FeeLine, FiatAmount, FiatGeo, FiatStepResponse, FormField, KycFieldId, OrderPoll } from '../types';
|
|
18
18
|
export declare const STRIPE_ENDPOINTS: {
|
|
19
19
|
readonly next: "POST /fiat/next";
|
|
20
20
|
};
|
|
@@ -230,6 +230,7 @@ export type StripeOrderPendingNextAction = {
|
|
|
230
230
|
next: 'orderPending';
|
|
231
231
|
orderId: string;
|
|
232
232
|
retryAfterMs: number;
|
|
233
|
+
poll?: OrderPoll;
|
|
233
234
|
order: FiatStepResponse | null;
|
|
234
235
|
};
|
|
235
236
|
export type StripeRequest = StripeRequestContext & (StripeObserveRequest | StripeConsentRequest | StripeSessionRequest | StripeAuthorizeRequest | StripeKycRequest | StripePlaceOrderRequest | StripeCheckoutRequest | StripeOrderRequest);
|
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, FiatProvider, FiatAuthRefreshRequest, FiatAuthRefreshResponse, FiatAuthRevokeRequest, FiatAuthStartRequest, FiatAuthVerifyRequest, FiatSession, FiatStepResponse, FieldSpec, FlowState, FormDescriptor, FormField, FormFieldType, InstructionField, Instructions, Instrument, JsonValue, KYCProvider, KycReviewDuration, OrderPoll, 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>;
|
|
@@ -81,6 +81,17 @@ export declare const looksLikeFieldSpec: (value: unknown) => boolean;
|
|
|
81
81
|
export declare const TransitionParamsSchema: z.ZodType<TransitionParams>;
|
|
82
82
|
export declare const TransitionInputsSchema: z.ZodType<TransitionInputs>;
|
|
83
83
|
export declare const PollSpecSchema: z.ZodType<PollSpec>;
|
|
84
|
+
/** A `/fiat/next` provider's order poll on `orderPending`; see {@link OrderPoll}. */
|
|
85
|
+
export declare const OrderPollSchema: z.ZodType<OrderPoll>;
|
|
86
|
+
/**
|
|
87
|
+
* `orderPending`'s cross-field rules, as {@link PollSpec}'s: with a `poll`, `retryAfterMs` is at least
|
|
88
|
+
* 500 and `maxIntervalMs` at least `retryAfterMs`, so no wait drops below the first one.
|
|
89
|
+
*/
|
|
90
|
+
export declare function checkOrderPendingPoll(response: {
|
|
91
|
+
next: string;
|
|
92
|
+
retryAfterMs?: number;
|
|
93
|
+
poll?: OrderPoll;
|
|
94
|
+
}, context: z.RefinementCtx): void;
|
|
84
95
|
export declare const ReportSpecSchema: z.ZodType<ReportSpec>;
|
|
85
96
|
export declare const KycSdkResultReportSchema: z.ZodType<KycSdkResultReport>;
|
|
86
97
|
export declare const TransitionSchema: z.ZodType<Transition>;
|
package/dist/table.js
CHANGED
package/dist/table.mjs
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -800,6 +800,20 @@ type FiatStepResponseBase = {
|
|
|
800
800
|
*/
|
|
801
801
|
refreshLimits?: true;
|
|
802
802
|
};
|
|
803
|
+
/**
|
|
804
|
+
* How the client re-sends `order` while a `/fiat/next` provider answers `orderPending`: wait the
|
|
805
|
+
* answer's `retryAfterMs`, grow each later wait by `backoffFactor` up to `maxIntervalMs`, and stop
|
|
806
|
+
* reading once the waits add up to `giveUpAfterMs`. The window starts at the first `orderPending`
|
|
807
|
+
* for that `orderId`; a later answer does not restart it. Each provider's backend names its own.
|
|
808
|
+
* Bounds follow {@link PollSpec}: `backoffFactor` `1 … 4`; `maxIntervalMs` an integer `500 … 60000`
|
|
809
|
+
* and at least the answer's `retryAfterMs`, which is then at least 500; `giveUpAfterMs` an integer
|
|
810
|
+
* `1 … 3600000`.
|
|
811
|
+
*/
|
|
812
|
+
export type OrderPoll = {
|
|
813
|
+
backoffFactor: number;
|
|
814
|
+
maxIntervalMs: number;
|
|
815
|
+
giveUpAfterMs: number;
|
|
816
|
+
};
|
|
803
817
|
/**
|
|
804
818
|
* Provider is absent only when routing ended before a provider could be selected. A BLOCKED response
|
|
805
819
|
* may still name a provider for compatibility with provider-specific terminal decisions. `FUN_AUTH`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fun-xyz/fiat-contract",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.51.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": {
|