@fun-xyz/fiat-contract 0.44.0 → 0.46.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-XENZL32Y.mjs → chunk-IAKK466V.mjs} +2 -7
- package/dist/index.js +14 -23
- package/dist/index.mjs +13 -17
- package/dist/providers/coinbase.d.ts +7 -2
- package/dist/providers/moonpay.d.ts +9 -4
- package/dist/routing.d.ts +16 -0
- package/dist/schemas.d.ts +1 -3
- package/dist/table.d.ts +1 -1
- package/dist/table.js +2 -7
- package/dist/table.mjs +1 -1
- package/dist/types.d.ts +13 -44
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// package.json
|
|
2
|
-
var version = "0.
|
|
2
|
+
var version = "0.46.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
|
|
115
|
+
"POST /fiat/auth/refresh and /revoke are called by the SDK session store, never offered as transitions."
|
|
116
116
|
]
|
|
117
117
|
},
|
|
118
118
|
SESSION_AUTH: {
|
|
@@ -478,7 +478,6 @@ 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",
|
|
482
481
|
"POST /fiat/payment-session",
|
|
483
482
|
"POST /fiat/session",
|
|
484
483
|
"POST /fiat/session/verify",
|
|
@@ -510,10 +509,6 @@ var UNOFFERED_ENDPOINTS = [
|
|
|
510
509
|
endpoint: "POST /fiat/auth/revoke",
|
|
511
510
|
reason: "SDK session store, not a transition."
|
|
512
511
|
},
|
|
513
|
-
{
|
|
514
|
-
endpoint: "POST /fiat/auth/recipient",
|
|
515
|
-
reason: "SDK session store at beginDeposit, not a transition."
|
|
516
|
-
},
|
|
517
512
|
{
|
|
518
513
|
endpoint: "POST /fiat/kyc/document",
|
|
519
514
|
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,8 +73,6 @@ __export(index_exports, {
|
|
|
73
73
|
FailureReasonSchema: () => FailureReasonSchema,
|
|
74
74
|
FeeLineSchema: () => FeeLineSchema,
|
|
75
75
|
FiatAmountSchema: () => FiatAmountSchema,
|
|
76
|
-
FiatAuthRecipientRequestSchema: () => FiatAuthRecipientRequestSchema,
|
|
77
|
-
FiatAuthRecipientResponseSchema: () => FiatAuthRecipientResponseSchema,
|
|
78
76
|
FiatAuthRefreshRequestSchema: () => FiatAuthRefreshRequestSchema,
|
|
79
77
|
FiatAuthRefreshResponseSchema: () => FiatAuthRefreshResponseSchema,
|
|
80
78
|
FiatAuthRevokeRequestSchema: () => FiatAuthRevokeRequestSchema,
|
|
@@ -1183,7 +1181,8 @@ var $routingTableRequest = obj({
|
|
|
1183
1181
|
// Duplicates are allowed; the response lists each method once.
|
|
1184
1182
|
methods: import_zod.z.array(import_zod.z.enum(PAYMENT_METHOD_CATEGORIES)).min(1),
|
|
1185
1183
|
providers: $routingTableProviderInputs.optional(),
|
|
1186
|
-
destinationAsset: $destinationAsset.optional()
|
|
1184
|
+
destinationAsset: $destinationAsset.optional(),
|
|
1185
|
+
depositAddress: $nonBlank.optional()
|
|
1187
1186
|
}).refine((request) => hasUsRegion(request.country, request.region), { message: US_REGION_REQUIRED, path: ["region"] });
|
|
1188
1187
|
var FiatRoutingTableRequestSchema = $routingTableRequest;
|
|
1189
1188
|
var $routingTableProvider = obj({
|
|
@@ -1231,6 +1230,7 @@ var $routingQuoteTermsShape = {
|
|
|
1231
1230
|
prepareSessionAuth: import_zod.z.boolean().optional(),
|
|
1232
1231
|
routingOverrides: obj({ providers: import_zod.z.array($routingProvider) }).optional(),
|
|
1233
1232
|
destinationAsset: $destinationAsset.optional(),
|
|
1233
|
+
depositAddress: $nonBlank.optional(),
|
|
1234
1234
|
handoffPaths: import_zod.z.array($handoffPath).refine(hasUniqueIds, "each handoff path is listed once").optional()
|
|
1235
1235
|
};
|
|
1236
1236
|
var $routingQuoteTerms = obj($routingQuoteTermsShape);
|
|
@@ -1287,7 +1287,13 @@ var $routingQuoteErrorBody = import_zod.z.union([$routingNoRouteErrorBody, $rout
|
|
|
1287
1287
|
var FiatRoutingQuoteErrorBodySchema = $routingQuoteErrorBody;
|
|
1288
1288
|
var $fiatGeo = obj({ alpha2: import_zod.z.string().regex(/^[A-Z]{2}$/), region: $nonBlank.optional(), ip: $nonBlank.optional() });
|
|
1289
1289
|
var FiatGeoSchema = $fiatGeo;
|
|
1290
|
-
var $nextRequest = import_zod.z.object({
|
|
1290
|
+
var $nextRequest = import_zod.z.object({
|
|
1291
|
+
provider: $provider,
|
|
1292
|
+
action: $nonBlank,
|
|
1293
|
+
geo: $fiatGeo,
|
|
1294
|
+
destinationAsset: $destinationAsset.optional(),
|
|
1295
|
+
depositAddress: $nonBlank.optional()
|
|
1296
|
+
}).catchall(import_zod.z.unknown());
|
|
1291
1297
|
var FiatNextRequestSchema = $nextRequest;
|
|
1292
1298
|
var $authStartRequest = import_zod.z.union([obj({ email: $nonBlank }), obj({ verificationRef: $nonBlank })]);
|
|
1293
1299
|
var FiatAuthStartRequestSchema = $authStartRequest;
|
|
@@ -1299,16 +1305,6 @@ var $authRefreshResponse = obj({ session: $fiatSession });
|
|
|
1299
1305
|
var FiatAuthRefreshResponseSchema = $authRefreshResponse;
|
|
1300
1306
|
var $authRevokeRequest = obj({ refreshHandle: $nonBlank });
|
|
1301
1307
|
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;
|
|
1312
1308
|
var $stepResponseBase = {
|
|
1313
1309
|
transitions: import_zod.z.array($transition),
|
|
1314
1310
|
routingSessionRef: import_zod.z.string().optional(),
|
|
@@ -1397,7 +1393,7 @@ var $stepResponse = import_zod.z.union([$providerBoundStepResponse, $funAuthStep
|
|
|
1397
1393
|
var FiatStepResponseSchema = $stepResponse;
|
|
1398
1394
|
|
|
1399
1395
|
// package.json
|
|
1400
|
-
var version = "0.
|
|
1396
|
+
var version = "0.46.0";
|
|
1401
1397
|
|
|
1402
1398
|
// src/table.ts
|
|
1403
1399
|
var TABLE_VERSION = version;
|
|
@@ -1510,7 +1506,7 @@ var TRANSITION_TABLE = {
|
|
|
1510
1506
|
"Not in the FE doc, so no screen number: the client renders it on its contact and OTP screens.",
|
|
1511
1507
|
"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.",
|
|
1512
1508
|
"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.",
|
|
1513
|
-
"POST /fiat/auth/refresh
|
|
1509
|
+
"POST /fiat/auth/refresh and /revoke are called by the SDK session store, never offered as transitions."
|
|
1514
1510
|
]
|
|
1515
1511
|
},
|
|
1516
1512
|
SESSION_AUTH: {
|
|
@@ -1876,7 +1872,6 @@ var DOCUMENTED_ENDPOINTS = [
|
|
|
1876
1872
|
"POST /fiat/auth/verify",
|
|
1877
1873
|
"POST /fiat/auth/refresh",
|
|
1878
1874
|
"POST /fiat/auth/revoke",
|
|
1879
|
-
"POST /fiat/auth/recipient",
|
|
1880
1875
|
"POST /fiat/payment-session",
|
|
1881
1876
|
"POST /fiat/session",
|
|
1882
1877
|
"POST /fiat/session/verify",
|
|
@@ -1908,10 +1903,6 @@ var UNOFFERED_ENDPOINTS = [
|
|
|
1908
1903
|
endpoint: "POST /fiat/auth/revoke",
|
|
1909
1904
|
reason: "SDK session store, not a transition."
|
|
1910
1905
|
},
|
|
1911
|
-
{
|
|
1912
|
-
endpoint: "POST /fiat/auth/recipient",
|
|
1913
|
-
reason: "SDK session store at beginDeposit, not a transition."
|
|
1914
|
-
},
|
|
1915
1906
|
{
|
|
1916
1907
|
endpoint: "POST /fiat/kyc/document",
|
|
1917
1908
|
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)."
|
|
@@ -3472,7 +3463,7 @@ var $request = import_zod2.z.discriminatedUnion("action", [
|
|
|
3472
3463
|
$orderRequest
|
|
3473
3464
|
]);
|
|
3474
3465
|
var MoonPayRequestSchema = $request;
|
|
3475
|
-
var $envelope = { provider: import_zod2.z.literal("MOONPAY"), geo: FiatGeoSchema, ...$context };
|
|
3466
|
+
var $envelope = { provider: import_zod2.z.literal("MOONPAY"), geo: FiatGeoSchema, depositAddress: $nonEmpty.optional(), ...$context };
|
|
3476
3467
|
var $nextRequest2 = import_zod2.z.discriminatedUnion("action", [
|
|
3477
3468
|
obj2({ ...$envelope, ...$observeFields }),
|
|
3478
3469
|
obj2({ ...$envelope, ...$consentFields }),
|
|
@@ -3685,7 +3676,7 @@ var CoinbasePlaceOrderRequestSchema = $placeOrderRequest;
|
|
|
3685
3676
|
var CoinbaseOrderRequestSchema = $orderRequest2;
|
|
3686
3677
|
var $request2 = import_zod3.z.union([$observeRequest2, $consentRequest2, $sessionRequest2, $otpRequest, $kycRequest2, $placeOrderRequest, $orderRequest2]);
|
|
3687
3678
|
var CoinbaseRequestSchema = $request2;
|
|
3688
|
-
var envelope = { provider: import_zod3.z.literal("COINBASE"), geo: FiatGeoSchema, ...contextFields };
|
|
3679
|
+
var envelope = { provider: import_zod3.z.literal("COINBASE"), geo: FiatGeoSchema, depositAddress: $nonEmpty2.optional(), ...contextFields };
|
|
3689
3680
|
var $nextRequest3 = import_zod3.z.union([
|
|
3690
3681
|
obj3({ ...envelope, ...observeFields }),
|
|
3691
3682
|
obj3({ ...envelope, ...consentFields }),
|
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-IAKK466V.mjs";
|
|
17
17
|
import {
|
|
18
18
|
MOONPAY_ENDPOINTS
|
|
19
19
|
} from "./chunk-TIEGTTFY.mjs";
|
|
@@ -994,7 +994,8 @@ var $routingTableRequest = obj({
|
|
|
994
994
|
// Duplicates are allowed; the response lists each method once.
|
|
995
995
|
methods: z.array(z.enum(PAYMENT_METHOD_CATEGORIES)).min(1),
|
|
996
996
|
providers: $routingTableProviderInputs.optional(),
|
|
997
|
-
destinationAsset: $destinationAsset.optional()
|
|
997
|
+
destinationAsset: $destinationAsset.optional(),
|
|
998
|
+
depositAddress: $nonBlank.optional()
|
|
998
999
|
}).refine((request) => hasUsRegion(request.country, request.region), { message: US_REGION_REQUIRED, path: ["region"] });
|
|
999
1000
|
var FiatRoutingTableRequestSchema = $routingTableRequest;
|
|
1000
1001
|
var $routingTableProvider = obj({
|
|
@@ -1042,6 +1043,7 @@ var $routingQuoteTermsShape = {
|
|
|
1042
1043
|
prepareSessionAuth: z.boolean().optional(),
|
|
1043
1044
|
routingOverrides: obj({ providers: z.array($routingProvider) }).optional(),
|
|
1044
1045
|
destinationAsset: $destinationAsset.optional(),
|
|
1046
|
+
depositAddress: $nonBlank.optional(),
|
|
1045
1047
|
handoffPaths: z.array($handoffPath).refine(hasUniqueIds, "each handoff path is listed once").optional()
|
|
1046
1048
|
};
|
|
1047
1049
|
var $routingQuoteTerms = obj($routingQuoteTermsShape);
|
|
@@ -1098,7 +1100,13 @@ var $routingQuoteErrorBody = z.union([$routingNoRouteErrorBody, $routingAmountEr
|
|
|
1098
1100
|
var FiatRoutingQuoteErrorBodySchema = $routingQuoteErrorBody;
|
|
1099
1101
|
var $fiatGeo = obj({ alpha2: z.string().regex(/^[A-Z]{2}$/), region: $nonBlank.optional(), ip: $nonBlank.optional() });
|
|
1100
1102
|
var FiatGeoSchema = $fiatGeo;
|
|
1101
|
-
var $nextRequest = z.object({
|
|
1103
|
+
var $nextRequest = z.object({
|
|
1104
|
+
provider: $provider,
|
|
1105
|
+
action: $nonBlank,
|
|
1106
|
+
geo: $fiatGeo,
|
|
1107
|
+
destinationAsset: $destinationAsset.optional(),
|
|
1108
|
+
depositAddress: $nonBlank.optional()
|
|
1109
|
+
}).catchall(z.unknown());
|
|
1102
1110
|
var FiatNextRequestSchema = $nextRequest;
|
|
1103
1111
|
var $authStartRequest = z.union([obj({ email: $nonBlank }), obj({ verificationRef: $nonBlank })]);
|
|
1104
1112
|
var FiatAuthStartRequestSchema = $authStartRequest;
|
|
@@ -1110,16 +1118,6 @@ var $authRefreshResponse = obj({ session: $fiatSession });
|
|
|
1110
1118
|
var FiatAuthRefreshResponseSchema = $authRefreshResponse;
|
|
1111
1119
|
var $authRevokeRequest = obj({ refreshHandle: $nonBlank });
|
|
1112
1120
|
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;
|
|
1123
1121
|
var $stepResponseBase = {
|
|
1124
1122
|
transitions: z.array($transition),
|
|
1125
1123
|
routingSessionRef: z.string().optional(),
|
|
@@ -2610,7 +2608,7 @@ var $request = z2.discriminatedUnion("action", [
|
|
|
2610
2608
|
$orderRequest
|
|
2611
2609
|
]);
|
|
2612
2610
|
var MoonPayRequestSchema = $request;
|
|
2613
|
-
var $envelope = { provider: z2.literal("MOONPAY"), geo: FiatGeoSchema, ...$context };
|
|
2611
|
+
var $envelope = { provider: z2.literal("MOONPAY"), geo: FiatGeoSchema, depositAddress: $nonEmpty.optional(), ...$context };
|
|
2614
2612
|
var $nextRequest2 = z2.discriminatedUnion("action", [
|
|
2615
2613
|
obj2({ ...$envelope, ...$observeFields }),
|
|
2616
2614
|
obj2({ ...$envelope, ...$consentFields }),
|
|
@@ -2810,7 +2808,7 @@ var CoinbasePlaceOrderRequestSchema = $placeOrderRequest;
|
|
|
2810
2808
|
var CoinbaseOrderRequestSchema = $orderRequest2;
|
|
2811
2809
|
var $request2 = z3.union([$observeRequest2, $consentRequest2, $sessionRequest2, $otpRequest, $kycRequest2, $placeOrderRequest, $orderRequest2]);
|
|
2812
2810
|
var CoinbaseRequestSchema = $request2;
|
|
2813
|
-
var envelope = { provider: z3.literal("COINBASE"), geo: FiatGeoSchema, ...contextFields };
|
|
2811
|
+
var envelope = { provider: z3.literal("COINBASE"), geo: FiatGeoSchema, depositAddress: $nonEmpty2.optional(), ...contextFields };
|
|
2814
2812
|
var $nextRequest3 = z3.union([
|
|
2815
2813
|
obj3({ ...envelope, ...observeFields }),
|
|
2816
2814
|
obj3({ ...envelope, ...consentFields }),
|
|
@@ -2997,8 +2995,6 @@ export {
|
|
|
2997
2995
|
FailureReasonSchema,
|
|
2998
2996
|
FeeLineSchema,
|
|
2999
2997
|
FiatAmountSchema,
|
|
3000
|
-
FiatAuthRecipientRequestSchema,
|
|
3001
|
-
FiatAuthRecipientResponseSchema,
|
|
3002
2998
|
FiatAuthRefreshRequestSchema,
|
|
3003
2999
|
FiatAuthRefreshResponseSchema,
|
|
3004
3000
|
FiatAuthRevokeRequestSchema,
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* A response names the next action in `next`; the client's request names it in `action`. `observe` answers the
|
|
5
5
|
* current next action. `wait` has no request: send `observe` after it. `pay` and `orderPending` are answered by `order`.
|
|
6
|
-
* Identity
|
|
6
|
+
* Identity comes from the verified partner assertion or the Fun session; the deposit wallet from the assertion or,
|
|
7
|
+
* for a mode-2 partner, from the body's `depositAddress` (see `FiatNextRequest`).
|
|
7
8
|
*
|
|
8
9
|
* A retry sends the same request and gets the current response. A fault is a 4xx/5xx whose body is
|
|
9
10
|
* `CoinbaseErrorBody`; anything the buyer can act on is a 200.
|
|
@@ -157,10 +158,14 @@ export type CoinbaseRequest = CoinbaseRequestContext & (CoinbaseObserveRequest |
|
|
|
157
158
|
* `wait` is a next action the client answers by sending `observe` again, never a request action.
|
|
158
159
|
*/
|
|
159
160
|
export type CoinbaseAction = CoinbaseRequest['action'];
|
|
160
|
-
/**
|
|
161
|
+
/**
|
|
162
|
+
* The wire body. The orchestrator reads `provider`, `geo` and `depositAddress` (as on every
|
|
163
|
+
* `FiatNextRequest`); Coinbase's action schemas read the rest.
|
|
164
|
+
*/
|
|
161
165
|
export type CoinbaseNextRequest = {
|
|
162
166
|
provider: 'COINBASE';
|
|
163
167
|
geo: FiatGeo;
|
|
168
|
+
depositAddress?: string;
|
|
164
169
|
} & CoinbaseRequest;
|
|
165
170
|
export type CoinbaseNextAction = CoinbaseConsentNextAction | CoinbaseSessionNextAction | CoinbaseOtpNextAction | CoinbaseKycNextAction | CoinbaseWaitNextAction | CoinbasePlaceOrderNextAction | CoinbasePayNextAction | CoinbaseOrderPendingNextAction;
|
|
166
171
|
/** The order is terminal. `order` is its body, which the shared order screen renders. */
|
|
@@ -13,9 +13,10 @@
|
|
|
13
13
|
* client sends `order`, or `decline` when the device cannot pay as a guest. `decline` is request-only, like
|
|
14
14
|
* `observe`, and is answered `refused NOT_ELIGIBLE / REQUOTE`; the requote then leaves the guest path out.
|
|
15
15
|
*
|
|
16
|
-
* The body is `MoonPayNextRequest`: `provider`, the shared `geo`,
|
|
17
|
-
* `credentials` after `connect`), and the action's result. Identity
|
|
18
|
-
*
|
|
16
|
+
* The body is `MoonPayNextRequest`: `provider`, the shared `geo`, a mode-2 client's `depositAddress`,
|
|
17
|
+
* the context (`checkout`, and `credentials` after `connect`), and the action's result. Identity comes
|
|
18
|
+
* from the verified partner assertion or the Fun session; the deposit wallet from the assertion or,
|
|
19
|
+
* for a mode-2 partner, from `depositAddress` (see `FiatNextRequest`).
|
|
19
20
|
*
|
|
20
21
|
* A retry sends the same request. Each write is idempotent on data the request carries, and every
|
|
21
22
|
* call, a retry too, returns the current response.
|
|
@@ -267,10 +268,14 @@ export type MoonPayOrderPendingNextAction = {
|
|
|
267
268
|
order: FiatStepResponse | null;
|
|
268
269
|
};
|
|
269
270
|
export type MoonPayRequest = MoonPayRequestContext & (MoonPayObserveRequest | MoonPayConsentRequest | MoonPaySessionRequest | MoonPayConnectRequest | MoonPayDeclineRequest | MoonPayKycRequest | MoonPayPrepareCaptureRequest | MoonPayCaptureRequest | MoonPayOrderRequest);
|
|
270
|
-
/**
|
|
271
|
+
/**
|
|
272
|
+
* The wire body. The orchestrator reads `provider`, `geo` and `depositAddress` (as on every
|
|
273
|
+
* `FiatNextRequest`); MoonPay's action schemas read the rest.
|
|
274
|
+
*/
|
|
271
275
|
export type MoonPayNextRequest = {
|
|
272
276
|
provider: 'MOONPAY';
|
|
273
277
|
geo: FiatGeo;
|
|
278
|
+
depositAddress?: string;
|
|
274
279
|
} & MoonPayRequest;
|
|
275
280
|
/**
|
|
276
281
|
* Read `recovery`, never derive it from the reason. `NOT_ELIGIBLE` and `DOCUMENTS_REQUIRED` carry
|
package/dist/routing.d.ts
CHANGED
|
@@ -60,6 +60,14 @@ export interface FiatRoutingTableRequest {
|
|
|
60
60
|
* from the partner's configured asset. Optional so an older client still parses.
|
|
61
61
|
*/
|
|
62
62
|
destinationAsset?: DestinationAsset;
|
|
63
|
+
/**
|
|
64
|
+
* The wallet that receives the purchased crypto, on the delivery chain the backend derives from
|
|
65
|
+
* the quote. A mode-2 (`FUN_OTP`) partner's client sends it on every routing-table request; the
|
|
66
|
+
* backend treats it as the recipient. A mode-1 client omits it; if sent, it must equal the
|
|
67
|
+
* asserted recipient. Carries no chain id. It may arrive before sign-in and only shapes the table
|
|
68
|
+
* (conversion routes, fee subsidy); placing an order still requires a Fun session.
|
|
69
|
+
*/
|
|
70
|
+
depositAddress?: string;
|
|
63
71
|
}
|
|
64
72
|
/** What a provider needs from this buyer before it can take the payment. */
|
|
65
73
|
export type RoutingNextStep = 'READY' | 'AUTH' | 'DECLARATIVE_KYC' | 'DOCUMENTARY_KYC' | 'PENDING_REVIEW';
|
|
@@ -146,6 +154,14 @@ export interface FiatRoutingQuoteTerms {
|
|
|
146
154
|
* from the partner's configured asset. Optional so an older client still parses.
|
|
147
155
|
*/
|
|
148
156
|
destinationAsset?: DestinationAsset;
|
|
157
|
+
/**
|
|
158
|
+
* The wallet that receives the purchased crypto, on the delivery chain the backend derives from
|
|
159
|
+
* the quote. A mode-2 (`FUN_OTP`) partner's client sends it on every quote request; the backend
|
|
160
|
+
* treats it as the recipient. A mode-1 client omits it; if sent, it must equal the asserted
|
|
161
|
+
* recipient. Carries no chain id. It may arrive before sign-in and only shapes the quote
|
|
162
|
+
* (conversion routes, fee subsidy); placing an order still requires a Fun session.
|
|
163
|
+
*/
|
|
164
|
+
depositAddress?: string;
|
|
149
165
|
/**
|
|
150
166
|
* Provider paths this client can run, each at most once. Routing considers such a path only when it is
|
|
151
167
|
* listed, and a quote that picks one carries `handoff.path`. Leave a path out of the requote after its
|
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, FiatHandoffPath, FiatProvider,
|
|
31
|
+
import type { BlockedReason, CryptoAmount, FailureReason, FeeLine, FiatAmount, FiatEndpoint, FiatHandoffPath, 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';
|
|
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>;
|
|
@@ -129,7 +129,5 @@ export declare const FiatAuthVerifyRequestSchema: z.ZodType<FiatAuthVerifyReques
|
|
|
129
129
|
export declare const FiatAuthRefreshRequestSchema: z.ZodType<FiatAuthRefreshRequest>;
|
|
130
130
|
export declare const FiatAuthRefreshResponseSchema: z.ZodType<FiatAuthRefreshResponse>;
|
|
131
131
|
export declare const FiatAuthRevokeRequestSchema: z.ZodType<FiatAuthRevokeRequest>;
|
|
132
|
-
export declare const FiatAuthRecipientRequestSchema: z.ZodType<FiatAuthRecipientRequest>;
|
|
133
|
-
export declare const FiatAuthRecipientResponseSchema: z.ZodType<FiatAuthRecipientResponse>;
|
|
134
132
|
export declare const FiatStepResponseSchema: z.ZodType<FiatStepResponse>;
|
|
135
133
|
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/
|
|
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"];
|
|
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.46.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
|
|
153
|
+
"POST /fiat/auth/refresh and /revoke are called by the SDK session store, never offered as transitions."
|
|
154
154
|
]
|
|
155
155
|
},
|
|
156
156
|
SESSION_AUTH: {
|
|
@@ -516,7 +516,6 @@ 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",
|
|
520
519
|
"POST /fiat/payment-session",
|
|
521
520
|
"POST /fiat/session",
|
|
522
521
|
"POST /fiat/session/verify",
|
|
@@ -548,10 +547,6 @@ var UNOFFERED_ENDPOINTS = [
|
|
|
548
547
|
endpoint: "POST /fiat/auth/revoke",
|
|
549
548
|
reason: "SDK session store, not a transition."
|
|
550
549
|
},
|
|
551
|
-
{
|
|
552
|
-
endpoint: "POST /fiat/auth/recipient",
|
|
553
|
-
reason: "SDK session store at beginDeposit, not a transition."
|
|
554
|
-
},
|
|
555
550
|
{
|
|
556
551
|
endpoint: "POST /fiat/kyc/document",
|
|
557
552
|
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/
|
|
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`;
|
|
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,45 +587,6 @@ 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
|
-
};
|
|
629
590
|
/**
|
|
630
591
|
* The expected length of a provider's KYC review. `BRIEF`: the client stays on its current screen,
|
|
631
592
|
* polling, for up to `holdMs` (at most 600000), then shows the in-review screen. `EXTENDED`: the
|
|
@@ -892,7 +853,8 @@ export type FiatHandoffPathName = FiatHandoffPath extends `${string}/${infer Pat
|
|
|
892
853
|
* so its presence never turns a conversion on. Every request field that carries it is named
|
|
893
854
|
* `destinationAsset`, optional only so a client that predates it still parses; a missing
|
|
894
855
|
* `destinationAsset` means the partner's configured asset. The recipient always comes from the
|
|
895
|
-
* verified partner assertion,
|
|
856
|
+
* verified partner assertion or, for a mode-2 partner, from the request's `depositAddress`, never from
|
|
857
|
+
* this field.
|
|
896
858
|
*
|
|
897
859
|
* Split by VM, then by asset kind. Solana carries no chain id: the backend maps each VM to its own
|
|
898
860
|
* chain ids in one place. `NON_FUNGIBLE` is reserved: the backend does not serve it yet and answers
|
|
@@ -939,14 +901,21 @@ export type FiatGeo = {
|
|
|
939
901
|
ip?: string;
|
|
940
902
|
};
|
|
941
903
|
/**
|
|
942
|
-
* The body of every `POST /fiat/next`: `provider`, `geo`, the `destinationAsset`,
|
|
943
|
-
* provider's own request, which names its `action`. Each provider defines
|
|
944
|
-
* fields (`./moonpay`).
|
|
904
|
+
* The body of every `POST /fiat/next`: `provider`, `geo`, the `destinationAsset`, a mode-2 client's
|
|
905
|
+
* `depositAddress`, and the provider's own request, which names its `action`. Each provider defines
|
|
906
|
+
* its actions and their fields (`./moonpay`).
|
|
945
907
|
*/
|
|
946
908
|
export type FiatNextRequest = {
|
|
947
909
|
provider: FiatProvider;
|
|
948
910
|
action: string;
|
|
949
911
|
geo: FiatGeo;
|
|
950
912
|
destinationAsset?: DestinationAsset;
|
|
913
|
+
/**
|
|
914
|
+
* The wallet that receives the purchased crypto, on the delivery chain the backend derives from
|
|
915
|
+
* the quote. A mode-2 (`FUN_OTP`) partner's client sends it on every `/fiat/next` request; the
|
|
916
|
+
* backend treats it as the recipient. A mode-1 client omits it; if sent, it must equal the
|
|
917
|
+
* asserted recipient. Carries no chain id.
|
|
918
|
+
*/
|
|
919
|
+
depositAddress?: string;
|
|
951
920
|
} & Record<string, unknown>;
|
|
952
921
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fun-xyz/fiat-contract",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.46.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": {
|