@fun-xyz/fiat-contract 0.45.0 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/dist/{chunk-FXHH22VB.mjs → chunk-JMJ45E27.mjs} +1 -1
- package/dist/chunk-LTJWGDSA.mjs +0 -0
- package/dist/{chunk-2CCO7UIS.mjs → chunk-TIQALG7X.mjs} +2 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +142 -66
- package/dist/index.mjs +142 -66
- package/dist/providers/coinbase.d.ts +7 -2
- package/dist/providers/moonpay-guest.d.ts +12 -0
- package/dist/providers/moonpay-guest.js +18 -0
- package/dist/providers/moonpay-guest.mjs +1 -0
- package/dist/providers/moonpay-guest.schemas.d.ts +36 -0
- package/dist/providers/moonpay.d.ts +54 -20
- package/dist/providers/moonpay.schemas.d.ts +5 -2
- package/dist/routing.d.ts +16 -6
- package/dist/schemas.d.ts +1 -2
- package/dist/table.js +1 -1
- package/dist/table.mjs +1 -1
- package/dist/terms.js +2 -1
- package/dist/terms.mjs +1 -1
- package/dist/types.d.ts +15 -17
- package/package.json +10 -2
|
@@ -8,14 +8,13 @@
|
|
|
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
|
|
12
|
-
*
|
|
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.
|
|
11
|
+
* Guest checkout uses provider `MOONPAY_GUEST` and its separate contract in `./moonpay-guest`.
|
|
12
|
+
* The phone and pay primitives below are shared MoonPay wire types, outside this provider's request and response unions.
|
|
15
13
|
*
|
|
16
|
-
* The body is `MoonPayNextRequest`: `provider`, the shared `geo`,
|
|
17
|
-
* `credentials` after `connect`), and the action's result. Identity
|
|
18
|
-
*
|
|
14
|
+
* The body is `MoonPayNextRequest`: `provider`, the shared `geo`, a mode-2 client's `depositAddress`,
|
|
15
|
+
* the context (`checkout`, and `credentials` after `connect`), and the action's result. Identity comes
|
|
16
|
+
* from the verified partner assertion or the Fun session; the deposit wallet from the assertion or,
|
|
17
|
+
* for a mode-2 partner, from `depositAddress` (see `FiatNextRequest`).
|
|
19
18
|
*
|
|
20
19
|
* A retry sends the same request. Each write is idempotent on data the request carries, and every
|
|
21
20
|
* call, a retry too, returns the current response.
|
|
@@ -31,7 +30,7 @@ import type { FiatAmount, DestinationAsset, FiatGeo, FiatStepResponse, FormField
|
|
|
31
30
|
export declare const MOONPAY_ENDPOINTS: {
|
|
32
31
|
readonly next: "POST /fiat/next";
|
|
33
32
|
};
|
|
34
|
-
export type MoonPayAction = 'observe' | 'consent' | 'session' | 'connect' | 'pay' | 'decline' | 'kyc' | 'prepareCapture' | 'capture' | 'wait' | 'order';
|
|
33
|
+
export type MoonPayAction = 'observe' | 'consent' | 'session' | 'connect' | 'phone' | 'phoneCode' | 'pay' | 'decline' | 'kyc' | 'prepareCapture' | 'capture' | 'wait' | 'order';
|
|
35
34
|
/** The checkout terms. The client holds them and sends them on every request. */
|
|
36
35
|
export interface MoonPayCheckout {
|
|
37
36
|
amount: FiatAmount;
|
|
@@ -50,17 +49,13 @@ export interface MoonPaySdkCredentials {
|
|
|
50
49
|
/**
|
|
51
50
|
* On every request, not part of the result. `credentials` is present after `connect`.
|
|
52
51
|
* `destinationAsset` is the asset the user receives at the end; `checkout.destination` stays the quote's
|
|
53
|
-
* asset, which MoonPay delivers.
|
|
54
|
-
* normal flow.
|
|
52
|
+
* asset, which MoonPay delivers.
|
|
55
53
|
*/
|
|
56
54
|
export type MoonPayRequestContext = {
|
|
57
55
|
checkout: MoonPayCheckout;
|
|
58
56
|
credentials?: MoonPaySdkCredentials;
|
|
59
57
|
destinationAsset?: DestinationAsset;
|
|
60
|
-
path?: MoonPayPath;
|
|
61
58
|
};
|
|
62
|
-
/** A MoonPay routing path other than the normal flow, named by the quote's `handoff.path`. */
|
|
63
|
-
export type MoonPayPath = 'guest_checkout';
|
|
64
59
|
/**
|
|
65
60
|
* The parameters for the device `client.getQuote`, not a quote. The backend builds them because the
|
|
66
61
|
* wallet must be the verified one and MoonPay's currency codes differ by environment.
|
|
@@ -126,6 +121,41 @@ export type MoonPayConnectRequest = {
|
|
|
126
121
|
customerId: string;
|
|
127
122
|
accessToken: string;
|
|
128
123
|
};
|
|
124
|
+
/**
|
|
125
|
+
* The guest path asks for the buyer's phone before `session`. `CODE_EXPIRED`: the last code's time ran out, or five
|
|
126
|
+
* wrong codes ended it. The same shape as Coinbase's `session` next action.
|
|
127
|
+
*/
|
|
128
|
+
export type MoonPayPhoneNextAction = {
|
|
129
|
+
next: 'phone';
|
|
130
|
+
error: 'CODE_EXPIRED' | null;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Text a code to `phoneNumber` (E.164), or send a new code to the phone of the live challenge `resend` names. Spends
|
|
134
|
+
* one unit of the per-login code budget only when a code is sent. The same shapes as Coinbase's `session` request.
|
|
135
|
+
*/
|
|
136
|
+
export type MoonPayPhoneRequest = {
|
|
137
|
+
action: 'phone';
|
|
138
|
+
phoneNumber: string;
|
|
139
|
+
} | {
|
|
140
|
+
action: 'phone';
|
|
141
|
+
resend: string;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Ask for the code just texted. `expiresAt` is ISO-8601. `CODE_INVALID`: the last code sent was wrong. The same
|
|
145
|
+
* shape as Coinbase's `otp` next action.
|
|
146
|
+
*/
|
|
147
|
+
export type MoonPayPhoneCodeNextAction = {
|
|
148
|
+
next: 'phoneCode';
|
|
149
|
+
verificationRef: string;
|
|
150
|
+
expiresAt: string;
|
|
151
|
+
error: 'CODE_INVALID' | null;
|
|
152
|
+
};
|
|
153
|
+
/** `otpCode` is six digits. Named so request logs redact it. A correct code answers `session`. */
|
|
154
|
+
export type MoonPayPhoneCodeRequest = {
|
|
155
|
+
action: 'phoneCode';
|
|
156
|
+
verificationRef: string;
|
|
157
|
+
otpCode: string;
|
|
158
|
+
};
|
|
129
159
|
/**
|
|
130
160
|
* The guest path's answer to `session`. Run the hidden connection check with `sessionToken`. When it returns
|
|
131
161
|
* `connectionRequired` with `capabilities.guestCheckout` and no `mismatch`, get the device quote from
|
|
@@ -266,11 +296,15 @@ export type MoonPayOrderPendingNextAction = {
|
|
|
266
296
|
retryAfterMs: number;
|
|
267
297
|
order: FiatStepResponse | null;
|
|
268
298
|
};
|
|
269
|
-
export type MoonPayRequest = MoonPayRequestContext & (MoonPayObserveRequest | MoonPayConsentRequest | MoonPaySessionRequest | MoonPayConnectRequest |
|
|
270
|
-
/**
|
|
299
|
+
export type MoonPayRequest = MoonPayRequestContext & (MoonPayObserveRequest | MoonPayConsentRequest | MoonPaySessionRequest | MoonPayConnectRequest | MoonPayKycRequest | MoonPayPrepareCaptureRequest | MoonPayCaptureRequest | MoonPayOrderRequest);
|
|
300
|
+
/**
|
|
301
|
+
* The wire body. The orchestrator reads `provider`, `geo` and `depositAddress` (as on every
|
|
302
|
+
* `FiatNextRequest`); MoonPay's action schemas read the rest.
|
|
303
|
+
*/
|
|
271
304
|
export type MoonPayNextRequest = {
|
|
272
305
|
provider: 'MOONPAY';
|
|
273
306
|
geo: FiatGeo;
|
|
307
|
+
depositAddress?: string;
|
|
274
308
|
} & MoonPayRequest;
|
|
275
309
|
/**
|
|
276
310
|
* Read `recovery`, never derive it from the reason. `NOT_ELIGIBLE` and `DOCUMENTS_REQUIRED` carry
|
|
@@ -284,7 +318,7 @@ export type MoonPayStepRefusal = 'NOT_ELIGIBLE' | 'DOCUMENTS_REQUIRED' | 'FINAL_
|
|
|
284
318
|
* assertion's. `UNRECORDABLE`: a charge no retry can record, held for refund review.
|
|
285
319
|
*/
|
|
286
320
|
export type MoonPayOrderRefusal = 'CUSTOMER_MISMATCH' | 'WALLET_MISMATCH' | 'UNRECORDABLE';
|
|
287
|
-
export type MoonPayNextAction = MoonPayConsentNextAction | MoonPaySessionNextAction | MoonPayConnectNextAction |
|
|
321
|
+
export type MoonPayNextAction = MoonPayConsentNextAction | MoonPaySessionNextAction | MoonPayConnectNextAction | MoonPayKycNextAction | MoonPayPrepareCaptureNextAction | MoonPayCaptureNextAction | MoonPayWaitNextAction | MoonPayOrderNextAction;
|
|
288
322
|
/**
|
|
289
323
|
* The order is terminal. `order` is its body, which the shared order screen renders. Nothing is left to
|
|
290
324
|
* send to `/fiat/next`. A converted order's `SETTLED` body offers the `delivery` transition: follow it.
|
|
@@ -299,7 +333,7 @@ export type MoonPayRefused<R, V> = {
|
|
|
299
333
|
reason: R;
|
|
300
334
|
recovery: V;
|
|
301
335
|
};
|
|
302
|
-
/** The answer to `observe`, `consent`, `session`, `connect`, `decline`, `kyc`, `prepareCapture` and `capture`. */
|
|
336
|
+
/** The answer to `observe`, `consent`, `session`, `connect`, `phone`, `phoneCode`, `decline`, `kyc`, `prepareCapture` and `capture`. */
|
|
303
337
|
export type MoonPayStepResponse = MoonPayNextAction | MoonPayRefused<MoonPayStepRefusal, 'REQUOTE' | 'NONE'>;
|
|
304
338
|
/**
|
|
305
339
|
* The answer to `order`. `done` once the order is terminal. A failed charge is recorded too: `done` with
|
|
@@ -316,7 +350,6 @@ export type MoonPayResponseFor = {
|
|
|
316
350
|
consent: MoonPayStepResponse;
|
|
317
351
|
session: MoonPayStepResponse;
|
|
318
352
|
connect: MoonPayStepResponse;
|
|
319
|
-
decline: MoonPayStepResponse;
|
|
320
353
|
kyc: MoonPayStepResponse;
|
|
321
354
|
prepareCapture: MoonPayStepResponse;
|
|
322
355
|
capture: MoonPayStepResponse;
|
|
@@ -325,8 +358,9 @@ export type MoonPayResponseFor = {
|
|
|
325
358
|
/** `RETRY` sends the same request again. `REQUOTE` goes back to routing. `NONE` ends the flow. */
|
|
326
359
|
export type MoonPayRecovery = 'RETRY' | 'REQUOTE' | 'NONE';
|
|
327
360
|
/**
|
|
328
|
-
* `SESSION_BUDGET_SPENT`: the per-login SDK session mint budget that `session` spends
|
|
329
|
-
* `
|
|
361
|
+
* `SESSION_BUDGET_SPENT`: the per-login SDK session mint budget that `session` spends, or the per-login code budget
|
|
362
|
+
* that `phone` spends (429).
|
|
363
|
+
* `RATE_LIMITED`: the action's request budget (429). `PROVIDER_UNAVAILABLE`: MoonPay, or the phone code sender, is down (503).
|
|
330
364
|
* `KYC_PROVIDER_UNAVAILABLE`: the KYC provider (Sumsub) is down (503). `SERVICE_UNAVAILABLE`: one of
|
|
331
365
|
* Fun's own stores is down (503). `INVALID_REQUEST`: a bad body (400).
|
|
332
366
|
*/
|
|
@@ -3,10 +3,9 @@
|
|
|
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, MoonPayDeclineRequest, MoonPayDone, MoonPayErrorBody, MoonPayFault, MoonPayGuestDeclineReason, MoonPayKycNextAction, MoonPayKycRequest, MoonPayNextRequest, MoonPayObserveRequest, MoonPayOrderNextAction, MoonPayOrderPendingNextAction, MoonPayOrderRequest, MoonPayOrderResponse,
|
|
6
|
+
import type { MoonPayCaptureDocument, MoonPayCaptureNextAction, MoonPayCaptureRequest, MoonPayCheckout, MoonPayConnectNextAction, MoonPayConnectRequest, MoonPayConsentNextAction, MoonPayConsentRequest, MoonPayDeclineRequest, MoonPayDone, MoonPayErrorBody, MoonPayFault, MoonPayGuestDeclineReason, MoonPayKycNextAction, MoonPayKycRequest, MoonPayNextRequest, MoonPayObserveRequest, MoonPayOrderNextAction, MoonPayOrderPendingNextAction, MoonPayOrderRequest, MoonPayOrderResponse, MoonPayPayNextAction, MoonPayPhoneCodeNextAction, MoonPayPhoneCodeRequest, MoonPayPhoneNextAction, MoonPayPhoneRequest, 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>;
|
|
10
9
|
export declare const MoonPayRequestContextSchema: z.ZodType<MoonPayRequestContext>;
|
|
11
10
|
export declare const MoonPayQuoteInputSchema: z.ZodType<MoonPayQuoteInput>;
|
|
12
11
|
export declare const MoonPayGuestDeclineReasonSchema: z.ZodType<MoonPayGuestDeclineReason>;
|
|
@@ -14,6 +13,8 @@ export declare const MoonPayObserveRequestSchema: z.ZodType<MoonPayRequestContex
|
|
|
14
13
|
export declare const MoonPayConsentRequestSchema: z.ZodType<MoonPayRequestContext & MoonPayConsentRequest>;
|
|
15
14
|
export declare const MoonPaySessionRequestSchema: z.ZodType<MoonPayRequestContext & MoonPaySessionRequest>;
|
|
16
15
|
export declare const MoonPayConnectRequestSchema: z.ZodType<MoonPayRequestContext & MoonPayConnectRequest>;
|
|
16
|
+
export declare const MoonPayPhoneRequestSchema: z.ZodType<MoonPayRequestContext & MoonPayPhoneRequest>;
|
|
17
|
+
export declare const MoonPayPhoneCodeRequestSchema: z.ZodType<MoonPayRequestContext & MoonPayPhoneCodeRequest>;
|
|
17
18
|
export declare const MoonPayDeclineRequestSchema: z.ZodType<MoonPayRequestContext & MoonPayDeclineRequest>;
|
|
18
19
|
export declare const MoonPayKycRequestSchema: z.ZodType<MoonPayRequestContext & MoonPayKycRequest>;
|
|
19
20
|
export declare const MoonPayPrepareCaptureRequestSchema: z.ZodType<MoonPayRequestContext & MoonPayPrepareCaptureRequest>;
|
|
@@ -24,6 +25,8 @@ export declare const MoonPayNextRequestSchema: z.ZodType<MoonPayNextRequest>;
|
|
|
24
25
|
export declare const MoonPayConsentNextActionSchema: z.ZodType<MoonPayConsentNextAction>;
|
|
25
26
|
export declare const MoonPaySessionNextActionSchema: z.ZodType<MoonPaySessionNextAction>;
|
|
26
27
|
export declare const MoonPayConnectNextActionSchema: z.ZodType<MoonPayConnectNextAction>;
|
|
28
|
+
export declare const MoonPayPhoneNextActionSchema: z.ZodType<MoonPayPhoneNextAction>;
|
|
29
|
+
export declare const MoonPayPhoneCodeNextActionSchema: z.ZodType<MoonPayPhoneCodeNextAction>;
|
|
27
30
|
export declare const MoonPayPayNextActionSchema: z.ZodType<MoonPayPayNextAction>;
|
|
28
31
|
export declare const MoonPayKycNextActionSchema: z.ZodType<MoonPayKycNextAction>;
|
|
29
32
|
export declare const MoonPayPrepareCaptureNextActionSchema: z.ZodType<MoonPayPrepareCaptureNextAction>;
|
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,
|
|
24
|
+
import type { FiatAmount, DestinationAsset, 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. */
|
|
@@ -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';
|
|
@@ -73,7 +81,7 @@ export type RoutingVisibility = 'COMPLETE' | 'PARTIAL' | 'AUTH_GATED';
|
|
|
73
81
|
*/
|
|
74
82
|
export type RoutingUnavailableReason = 'USER_LIMIT' | 'KYC_REJECTED' | 'PROVIDER_OUTAGE' | 'NOT_SERVED';
|
|
75
83
|
/** The providers the backend can route and take an order through. */
|
|
76
|
-
export type RoutingProvider = Extract<FiatProvider, 'TRANSAK' | 'BANXA' | 'MOONPAY' | 'STRIPE' | 'COINBASE'>;
|
|
84
|
+
export type RoutingProvider = Extract<FiatProvider, 'TRANSAK' | 'BANXA' | 'MOONPAY' | 'MOONPAY_GUEST' | 'STRIPE' | 'COINBASE'>;
|
|
77
85
|
export interface RoutingTableProvider {
|
|
78
86
|
provider: RoutingProvider;
|
|
79
87
|
next: RoutingNextStep;
|
|
@@ -147,11 +155,13 @@ export interface FiatRoutingQuoteTerms {
|
|
|
147
155
|
*/
|
|
148
156
|
destinationAsset?: DestinationAsset;
|
|
149
157
|
/**
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
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.
|
|
153
163
|
*/
|
|
154
|
-
|
|
164
|
+
depositAddress?: string;
|
|
155
165
|
}
|
|
156
166
|
/**
|
|
157
167
|
* `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,
|
|
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';
|
|
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,7 +38,6 @@ 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>;
|
|
42
41
|
export declare const KYCProviderSchema: z.ZodType<KYCProvider>;
|
|
43
42
|
export declare const SurfaceProviderSchema: z.ZodType<SurfaceProvider>;
|
|
44
43
|
export declare const OrderStatusSchema: z.ZodType<OrderStatus>;
|
package/dist/table.js
CHANGED
package/dist/table.mjs
CHANGED
package/dist/terms.js
CHANGED
|
@@ -60,7 +60,8 @@ var MOONPAY_KYC_SHARING = {
|
|
|
60
60
|
links: [{ label: "Persona Privacy Policy", url: "https://withpersona.com/legal/privacy-policy" }]
|
|
61
61
|
};
|
|
62
62
|
var PROVIDER_CHECKOUT_DOCUMENTS = {
|
|
63
|
-
MOONPAY: [MOONPAY_TERMS]
|
|
63
|
+
MOONPAY: [MOONPAY_TERMS],
|
|
64
|
+
MOONPAY_GUEST: [MOONPAY_TERMS]
|
|
64
65
|
};
|
|
65
66
|
var PROVIDER_KYC_DOCUMENTS = {
|
|
66
67
|
MOONPAY: [MOONPAY_KYC_SHARING]
|
package/dist/terms.mjs
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -61,7 +61,7 @@ export type FiatEndpoint = 'GET /fiat/payment-methods' | 'POST /fiat/quote' | 'P
|
|
|
61
61
|
* Routing metadata, not sequencing policy. Reserved values may be emitted only after their adapter
|
|
62
62
|
* and conformance fixture land.
|
|
63
63
|
*/
|
|
64
|
-
export type FiatProvider = 'TRANSAK' | 'SWAPPED' | 'BANXA' | 'MOONPAY' | 'STRIPE' | 'COINBASE' | 'CROSSMINT';
|
|
64
|
+
export type FiatProvider = 'TRANSAK' | 'SWAPPED' | 'BANXA' | 'MOONPAY' | 'MOONPAY_GUEST' | 'STRIPE' | 'COINBASE' | 'CROSSMINT';
|
|
65
65
|
/**
|
|
66
66
|
* The order status vocabulary. Monotonic ranks, no backwards moves. Terminal outcomes are
|
|
67
67
|
* OrderStatus, never FlowState kinds.
|
|
@@ -830,30 +830,21 @@ export type FiatStepResponse = (FiatStepResponseBase & {
|
|
|
830
830
|
preparedPayment?: PreparedPayment;
|
|
831
831
|
/**
|
|
832
832
|
* The provider runs its own flow from here (`POST /fiat/next`). Present
|
|
833
|
-
* only on a `QUOTE
|
|
834
|
-
* carries no transitions.
|
|
835
|
-
* (`guest_checkout` for `MOONPAY/guest_checkout`); the client sends it on every `/fiat/next` request.
|
|
833
|
+
* only on a `QUOTE` selected for a provider-owned checkout flow; the response then
|
|
834
|
+
* carries no transitions. The selected provider owns the flow on `/fiat/next`.
|
|
836
835
|
*/
|
|
837
836
|
handoff?: {
|
|
838
837
|
provider: FiatProvider;
|
|
839
|
-
path?: FiatHandoffPathName;
|
|
840
838
|
};
|
|
841
839
|
});
|
|
842
|
-
/**
|
|
843
|
-
* A provider path the client can run, offered on the quote request in `handoffPaths`. Routing considers
|
|
844
|
-
* a path listed here only when the request offers it, so leaving it out of a requote excludes that path
|
|
845
|
-
* alone and keeps its provider's other paths.
|
|
846
|
-
*/
|
|
847
|
-
export type FiatHandoffPath = 'MOONPAY/guest_checkout';
|
|
848
|
-
/** The path part of a `FiatHandoffPath`, as `handoff.path` names it. */
|
|
849
|
-
export type FiatHandoffPathName = FiatHandoffPath extends `${string}/${infer Path}` ? Path : never;
|
|
850
840
|
/**
|
|
851
841
|
* The asset the user receives at the end of the purchase. The client always sends it. The backend
|
|
852
842
|
* compares it with the partner's configured asset and adds a conversion only when they differ,
|
|
853
843
|
* so its presence never turns a conversion on. Every request field that carries it is named
|
|
854
844
|
* `destinationAsset`, optional only so a client that predates it still parses; a missing
|
|
855
845
|
* `destinationAsset` means the partner's configured asset. The recipient always comes from the
|
|
856
|
-
* verified partner assertion,
|
|
846
|
+
* verified partner assertion or, for a mode-2 partner, from the request's `depositAddress`, never from
|
|
847
|
+
* this field.
|
|
857
848
|
*
|
|
858
849
|
* Split by VM, then by asset kind. Solana carries no chain id: the backend maps each VM to its own
|
|
859
850
|
* chain ids in one place. `NON_FUNGIBLE` is reserved: the backend does not serve it yet and answers
|
|
@@ -900,14 +891,21 @@ export type FiatGeo = {
|
|
|
900
891
|
ip?: string;
|
|
901
892
|
};
|
|
902
893
|
/**
|
|
903
|
-
* The body of every `POST /fiat/next`: `provider`, `geo`, the `destinationAsset`,
|
|
904
|
-
* provider's own request, which names its `action`. Each provider defines
|
|
905
|
-
* fields (`./moonpay`).
|
|
894
|
+
* The body of every `POST /fiat/next`: `provider`, `geo`, the `destinationAsset`, a mode-2 client's
|
|
895
|
+
* `depositAddress`, and the provider's own request, which names its `action`. Each provider defines
|
|
896
|
+
* its actions and their fields (`./moonpay`).
|
|
906
897
|
*/
|
|
907
898
|
export type FiatNextRequest = {
|
|
908
899
|
provider: FiatProvider;
|
|
909
900
|
action: string;
|
|
910
901
|
geo: FiatGeo;
|
|
911
902
|
destinationAsset?: DestinationAsset;
|
|
903
|
+
/**
|
|
904
|
+
* The wallet that receives the purchased crypto, on the delivery chain the backend derives from
|
|
905
|
+
* the quote. A mode-2 (`FUN_OTP`) partner's client sends it on every `/fiat/next` request; the
|
|
906
|
+
* backend treats it as the recipient. A mode-1 client omits it; if sent, it must equal the
|
|
907
|
+
* asserted recipient. Carries no chain id.
|
|
908
|
+
*/
|
|
909
|
+
depositAddress?: string;
|
|
912
910
|
} & Record<string, unknown>;
|
|
913
911
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fun-xyz/fiat-contract",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.47.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": {
|
|
@@ -48,7 +48,12 @@
|
|
|
48
48
|
"import": "./dist/routing.mjs",
|
|
49
49
|
"require": "./dist/routing.js"
|
|
50
50
|
},
|
|
51
|
-
"./package.json": "./package.json"
|
|
51
|
+
"./package.json": "./package.json",
|
|
52
|
+
"./moonpay-guest": {
|
|
53
|
+
"types": "./dist/providers/moonpay-guest.d.ts",
|
|
54
|
+
"import": "./dist/providers/moonpay-guest.mjs",
|
|
55
|
+
"require": "./dist/providers/moonpay-guest.js"
|
|
56
|
+
}
|
|
52
57
|
},
|
|
53
58
|
"files": [
|
|
54
59
|
"dist",
|
|
@@ -113,6 +118,9 @@
|
|
|
113
118
|
],
|
|
114
119
|
"routing": [
|
|
115
120
|
"./dist/routing.d.ts"
|
|
121
|
+
],
|
|
122
|
+
"moonpay-guest": [
|
|
123
|
+
"./dist/providers/moonpay-guest.d.ts"
|
|
116
124
|
]
|
|
117
125
|
}
|
|
118
126
|
}
|