@fun-xyz/fiat-contract 0.56.0 → 0.58.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.
@@ -0,0 +1 @@
1
+ export * from './dist/flows/bank-transfer';
@@ -0,0 +1,2 @@
1
+ // Compat stub — see table.js. Metro before RN 0.79 resolves `@fun-xyz/fiat-contract/bank-transfer` by path.
2
+ module.exports = require('./dist/flows/bank-transfer.js');
@@ -0,0 +1,10 @@
1
+ // src/flows/bank-transfer.ts
2
+ var BANK_TRANSFER_ENDPOINTS = {
3
+ next: "POST /fiat/next"
4
+ };
5
+ var BANK_TRANSFER_MAX_LISTED_ORDERS = 20;
6
+
7
+ export {
8
+ BANK_TRANSFER_ENDPOINTS,
9
+ BANK_TRANSFER_MAX_LISTED_ORDERS
10
+ };
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "0.56.0";
2
+ var version = "0.58.0";
3
3
 
4
4
  // src/table.ts
5
5
  var TABLE_VERSION = version;
@@ -0,0 +1,183 @@
1
+ /**
2
+ * The bank transfer flow on `POST /fiat/next`, shared by every provider that serves `bank_transfer` (a push from the
3
+ * buyer's bank to account details Fun shows: SEPA, FPS, FAST, a wire). The client runs it the same way for each one:
4
+ * a new bank provider ships from the backend alone.
5
+ *
6
+ * The buyer gets persistent account details, not a checkout: no amount, no quote, no order before money arrives. Fun
7
+ * creates the order when the provider reports a deposit, so the client learns of orders from `bankDetails.orders` and
8
+ * reads one with `order`. `wait` has no request: send `observe` after it. Identity and the deposit wallet come from the
9
+ * verified partner assertion, never from a request body.
10
+ *
11
+ * A retry sends the same request and gets the current response. A fault is a 4xx/5xx whose body is
12
+ * `BankTransferErrorBody`; anything the buyer can act on is a 200.
13
+ *
14
+ * Zero runtime dependencies. The zod schemas are in `./bank-transfer.schemas`, exported from the package root only.
15
+ */
16
+ import type { FiatTermsRequest, TermsDocument } from '../terms';
17
+ import type { FiatCurrencyCode } from '../codes';
18
+ import type { FiatGeo, FiatProvider, FiatStepResponse, InstructionField, KYCProvider, KycSdkResultReport, OrderPoll } from '../types';
19
+ export declare const BANK_TRANSFER_ENDPOINTS: {
20
+ readonly next: "POST /fiat/next";
21
+ };
22
+ /** The most orders one `bankDetails` lists. */
23
+ export declare const BANK_TRANSFER_MAX_LISTED_ORDERS = 20;
24
+ /** What the deposits buy, sent on every request. No amount: the provider converts whatever arrives. */
25
+ export interface BankTransferCheckout {
26
+ /** The currency the buyer sends. With the buyer's country it picks the rail and the provider. */
27
+ currency: FiatCurrencyCode;
28
+ /** The asset and its network, as the routing table named them. */
29
+ destination: {
30
+ asset: string;
31
+ network: string;
32
+ };
33
+ paymentMethod: 'bank_transfer';
34
+ }
35
+ export type BankTransferRequestContext = {
36
+ checkout: BankTransferCheckout;
37
+ };
38
+ /** No next action of its own: the answer is the current next action. Writes nothing. */
39
+ export type BankTransferObserveRequest = {
40
+ action: 'observe';
41
+ };
42
+ /** Fun's KYC consent and the provider's terms, if the buyer has not accepted them. */
43
+ export type BankTransferConsentNextAction = {
44
+ next: 'consent';
45
+ documents: TermsDocument[];
46
+ };
47
+ /** The `POST /fiat/terms` items, recorded under the same rules. */
48
+ export type BankTransferConsentRequest = {
49
+ action: 'consent';
50
+ acceptances: FiatTermsRequest['acceptances'];
51
+ };
52
+ /**
53
+ * The provider needs something the shared KYC did not give it (a document, a selfie, a check). Open the SDK
54
+ * `kycProvider` names with `accessToken`, then send `capture`. To refresh an expired token, send `observe`.
55
+ */
56
+ export type BankTransferCaptureNextAction = {
57
+ next: 'capture';
58
+ kycProvider: KYCProvider;
59
+ accessToken: string;
60
+ /** ISO-8601. */
61
+ expiresAt: string;
62
+ };
63
+ /** When the SDK closes. A report only: the backend reads the provider itself. */
64
+ export type BankTransferCaptureRequest = {
65
+ action: 'capture';
66
+ result: KycSdkResultReport;
67
+ };
68
+ /** The provider is reviewing, or the account details are being opened. No request: send `observe` after the delay. */
69
+ export type BankTransferWaitNextAction = {
70
+ next: 'wait';
71
+ retryAfterMs: number;
72
+ };
73
+ /**
74
+ * Show `wallet` and `attestationText`; the buyer confirms the wallet is theirs. Then send `openDepositInstructions`.
75
+ * Every deposit from then on goes to this wallet, replacing any earlier one. `observe` answers this again whenever the
76
+ * asserted wallet is not the one deposits go to.
77
+ */
78
+ export type BankTransferOpenDepositInstructionsNextAction = {
79
+ next: 'openDepositInstructions';
80
+ wallet: {
81
+ address: string;
82
+ network: string;
83
+ asset: string;
84
+ };
85
+ attestationText: string;
86
+ };
87
+ /**
88
+ * Registers the wallet with the provider under the buyer's confirmation and answers `bankDetails`. `walletAddress` is
89
+ * the `wallet.address` the buyer confirmed: a value that is not the asserted wallet registers nothing and answers the
90
+ * current next action.
91
+ */
92
+ export type BankTransferOpenDepositInstructionsRequest = {
93
+ action: 'openDepositInstructions';
94
+ walletConfirmed: true;
95
+ walletAddress: string;
96
+ };
97
+ /**
98
+ * Where the buyer sends money and where deposits go. `instructions.fields` are the rail's own details (an IBAN and BIC,
99
+ * a sort code and account number, a SWIFT code, a reference): show each with its `labelFallback` and a copy button,
100
+ * never by `id`. `orders` are the orders made from deposits since these details were first shown, newest first, at
101
+ * most `BANK_TRANSFER_MAX_LISTED_ORDERS`. Send `observe` after `retryAfterMs` to refresh them; send `order` for one.
102
+ */
103
+ export type BankTransferBankDetailsNextAction = {
104
+ next: 'bankDetails';
105
+ instructions: {
106
+ kind: 'BANK_FIELDS';
107
+ fields: InstructionField[];
108
+ };
109
+ wallet: {
110
+ address: string;
111
+ network: string;
112
+ asset: string;
113
+ };
114
+ orders: FiatStepResponse[];
115
+ retryAfterMs: number;
116
+ };
117
+ /** Reads the provider and moves the order `orderId` forward. `orderId` is one `bankDetails` listed. */
118
+ export type BankTransferOrderRequest = {
119
+ action: 'order';
120
+ orderId: string;
121
+ };
122
+ /** The order is not terminal. After `retryAfterMs`, send `order`. */
123
+ export type BankTransferOrderPendingNextAction = {
124
+ next: 'orderPending';
125
+ orderId: string;
126
+ retryAfterMs: number;
127
+ poll?: OrderPoll;
128
+ order: FiatStepResponse;
129
+ };
130
+ export type BankTransferRequest = BankTransferRequestContext & (BankTransferObserveRequest | BankTransferConsentRequest | BankTransferCaptureRequest | BankTransferOpenDepositInstructionsRequest | BankTransferOrderRequest);
131
+ export type BankTransferAction = BankTransferRequest['action'];
132
+ /**
133
+ * The wire body. `provider` is the one the routing table named for this corridor: the client passes it through and
134
+ * never branches on it. The backend refuses a provider that does not serve `bank_transfer`.
135
+ */
136
+ export type BankTransferNextRequest = {
137
+ provider: FiatProvider;
138
+ geo: FiatGeo;
139
+ } & BankTransferRequest;
140
+ export type BankTransferNextAction = BankTransferConsentNextAction | BankTransferCaptureNextAction | BankTransferWaitNextAction | BankTransferOpenDepositInstructionsNextAction | BankTransferBankDetailsNextAction | BankTransferOrderPendingNextAction;
141
+ /** The order is terminal. `order` is its body, which the shared order screen renders. */
142
+ export type BankTransferDone = {
143
+ next: 'done';
144
+ order: FiatStepResponse;
145
+ };
146
+ /** Read `recovery`, never derive it from the reason. `NONE` ends the flow. */
147
+ export type BankTransferStepRefusal = 'NOT_ELIGIBLE' | 'KYC_REJECTED';
148
+ export type BankTransferRefused = {
149
+ next: 'refused';
150
+ reason: BankTransferStepRefusal;
151
+ recovery: 'NONE';
152
+ };
153
+ /** Every action but `order`. */
154
+ export type BankTransferStepResponse = Exclude<BankTransferNextAction, BankTransferOrderPendingNextAction> | BankTransferRefused;
155
+ /** `order` never refuses: the buyer has already paid. */
156
+ export type BankTransferOrderResponse = BankTransferDone | BankTransferOrderPendingNextAction;
157
+ export type BankTransferResponse = BankTransferStepResponse | BankTransferOrderResponse;
158
+ export type BankTransferResponseFor = {
159
+ observe: BankTransferStepResponse;
160
+ consent: BankTransferStepResponse;
161
+ capture: BankTransferStepResponse;
162
+ openDepositInstructions: BankTransferStepResponse;
163
+ order: BankTransferOrderResponse;
164
+ };
165
+ /** `RETRY` sends the same request again. `NONE` ends the flow. */
166
+ export type BankTransferRecovery = 'RETRY' | 'NONE';
167
+ /**
168
+ * `RATE_LIMITED`: the action's request budget (429). `PROVIDER_UNAVAILABLE`: the bank provider is down (503).
169
+ * `KYC_PROVIDER_UNAVAILABLE`: the KYC provider sharing the buyer's verification is down (503).
170
+ * `SERVICE_UNAVAILABLE`: one of Fun's own stores is down (503). `INVALID_REQUEST`: a bad body, or a provider that does
171
+ * not serve `bank_transfer` (400).
172
+ */
173
+ export type BankTransferFaultReason = 'RATE_LIMITED' | 'PROVIDER_UNAVAILABLE' | 'KYC_PROVIDER_UNAVAILABLE' | 'SERVICE_UNAVAILABLE' | 'INVALID_REQUEST';
174
+ export interface BankTransferFault {
175
+ reason: BankTransferFaultReason;
176
+ recovery: BankTransferRecovery;
177
+ }
178
+ export type BankTransferErrorBody = BankTransferFault & {
179
+ errorCode: string;
180
+ errorMsg: string;
181
+ reqId?: string;
182
+ retryAfterSeconds?: number;
183
+ };
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/flows/bank-transfer.ts
21
+ var bank_transfer_exports = {};
22
+ __export(bank_transfer_exports, {
23
+ BANK_TRANSFER_ENDPOINTS: () => BANK_TRANSFER_ENDPOINTS,
24
+ BANK_TRANSFER_MAX_LISTED_ORDERS: () => BANK_TRANSFER_MAX_LISTED_ORDERS
25
+ });
26
+ module.exports = __toCommonJS(bank_transfer_exports);
27
+ var BANK_TRANSFER_ENDPOINTS = {
28
+ next: "POST /fiat/next"
29
+ };
30
+ var BANK_TRANSFER_MAX_LISTED_ORDERS = 20;
@@ -0,0 +1,8 @@
1
+ import {
2
+ BANK_TRANSFER_ENDPOINTS,
3
+ BANK_TRANSFER_MAX_LISTED_ORDERS
4
+ } from "../chunk-MEL2ZOQ5.mjs";
5
+ export {
6
+ BANK_TRANSFER_ENDPOINTS,
7
+ BANK_TRANSFER_MAX_LISTED_ORDERS
8
+ };
@@ -0,0 +1,32 @@
1
+ /**
2
+ * zod schemas for the bank transfer flow on `POST /fiat/next`. Test-time and backend-boundary only:
3
+ * exported from the package root, never from `./bank-transfer`, so the production entry stays free of zod.
4
+ */
5
+ import { z } from 'zod';
6
+ import type { BankTransferBankDetailsNextAction, BankTransferCaptureNextAction, BankTransferCaptureRequest, BankTransferCheckout, BankTransferConsentNextAction, BankTransferConsentRequest, BankTransferDone, BankTransferErrorBody, BankTransferFault, BankTransferNextAction, BankTransferNextRequest, BankTransferObserveRequest, BankTransferOpenDepositInstructionsNextAction, BankTransferOpenDepositInstructionsRequest, BankTransferOrderPendingNextAction, BankTransferOrderRequest, BankTransferOrderResponse, BankTransferRefused, BankTransferRequest, BankTransferRequestContext, BankTransferResponseFor, BankTransferStepResponse, BankTransferWaitNextAction } from './bank-transfer';
7
+ export declare const BankTransferCheckoutSchema: z.ZodType<BankTransferCheckout>;
8
+ export declare const BankTransferRequestContextSchema: z.ZodType<BankTransferRequestContext>;
9
+ export declare const BankTransferObserveRequestSchema: z.ZodType<BankTransferRequestContext & BankTransferObserveRequest>;
10
+ export declare const BankTransferConsentRequestSchema: z.ZodType<BankTransferRequestContext & BankTransferConsentRequest>;
11
+ export declare const BankTransferCaptureRequestSchema: z.ZodType<BankTransferRequestContext & BankTransferCaptureRequest>;
12
+ export declare const BankTransferOpenDepositInstructionsRequestSchema: z.ZodType<BankTransferRequestContext & BankTransferOpenDepositInstructionsRequest>;
13
+ export declare const BankTransferOrderRequestSchema: z.ZodType<BankTransferRequestContext & BankTransferOrderRequest>;
14
+ export declare const BankTransferRequestSchema: z.ZodType<BankTransferRequest>;
15
+ export declare const BankTransferNextRequestSchema: z.ZodType<BankTransferNextRequest>;
16
+ export declare const BankTransferConsentNextActionSchema: z.ZodType<BankTransferConsentNextAction>;
17
+ export declare const BankTransferCaptureNextActionSchema: z.ZodType<BankTransferCaptureNextAction>;
18
+ export declare const BankTransferWaitNextActionSchema: z.ZodType<BankTransferWaitNextAction>;
19
+ export declare const BankTransferOpenDepositInstructionsNextActionSchema: z.ZodType<BankTransferOpenDepositInstructionsNextAction>;
20
+ export declare const BankTransferBankDetailsNextActionSchema: z.ZodType<BankTransferBankDetailsNextAction>;
21
+ export declare const BankTransferOrderPendingNextActionSchema: z.ZodType<BankTransferOrderPendingNextAction>;
22
+ export declare const BankTransferNextActionSchema: z.ZodType<BankTransferNextAction>;
23
+ export declare const BankTransferDoneSchema: z.ZodType<BankTransferDone>;
24
+ export declare const BankTransferRefusedSchema: z.ZodType<BankTransferRefused>;
25
+ export declare const BankTransferStepResponseSchema: z.ZodType<BankTransferStepResponse>;
26
+ export declare const BankTransferOrderResponseSchema: z.ZodType<BankTransferOrderResponse>;
27
+ /** The response schema for each request action, as `BankTransferResponseFor` types it. */
28
+ export declare const BankTransferResponseSchemaFor: {
29
+ readonly [A in keyof BankTransferResponseFor]: z.ZodType<BankTransferResponseFor[A]>;
30
+ };
31
+ export declare const BankTransferFaultSchema: z.ZodType<BankTransferFault>;
32
+ export declare const BankTransferErrorBodySchema: z.ZodType<BankTransferErrorBody>;
package/dist/index.d.ts CHANGED
@@ -18,6 +18,8 @@ export * from './providers/coinbase';
18
18
  export * from './providers/coinbase.schemas';
19
19
  export * from './providers/stripe';
20
20
  export * from './providers/stripe.schemas';
21
+ export * from './flows/bank-transfer';
22
+ export * from './flows/bank-transfer.schemas';
21
23
  export { FIXTURES, FIXTURE_COVERAGE_GAPS, fixtureMeta, loadFixture, loadFixtures, type FixtureMeta, type FixtureSource, type LoadedFixture, } from './fixtures/index';
22
24
  export * from './providers/moonpay-guest';
23
25
  export * from './providers/moonpay-guest.schemas';
package/dist/index.js CHANGED
@@ -20,6 +20,31 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ BANK_TRANSFER_ENDPOINTS: () => BANK_TRANSFER_ENDPOINTS,
24
+ BANK_TRANSFER_MAX_LISTED_ORDERS: () => BANK_TRANSFER_MAX_LISTED_ORDERS,
25
+ BankTransferBankDetailsNextActionSchema: () => BankTransferBankDetailsNextActionSchema,
26
+ BankTransferCaptureNextActionSchema: () => BankTransferCaptureNextActionSchema,
27
+ BankTransferCaptureRequestSchema: () => BankTransferCaptureRequestSchema,
28
+ BankTransferCheckoutSchema: () => BankTransferCheckoutSchema,
29
+ BankTransferConsentNextActionSchema: () => BankTransferConsentNextActionSchema,
30
+ BankTransferConsentRequestSchema: () => BankTransferConsentRequestSchema,
31
+ BankTransferDoneSchema: () => BankTransferDoneSchema,
32
+ BankTransferErrorBodySchema: () => BankTransferErrorBodySchema,
33
+ BankTransferFaultSchema: () => BankTransferFaultSchema,
34
+ BankTransferNextActionSchema: () => BankTransferNextActionSchema,
35
+ BankTransferNextRequestSchema: () => BankTransferNextRequestSchema,
36
+ BankTransferObserveRequestSchema: () => BankTransferObserveRequestSchema,
37
+ BankTransferOpenDepositInstructionsNextActionSchema: () => BankTransferOpenDepositInstructionsNextActionSchema,
38
+ BankTransferOpenDepositInstructionsRequestSchema: () => BankTransferOpenDepositInstructionsRequestSchema,
39
+ BankTransferOrderPendingNextActionSchema: () => BankTransferOrderPendingNextActionSchema,
40
+ BankTransferOrderRequestSchema: () => BankTransferOrderRequestSchema,
41
+ BankTransferOrderResponseSchema: () => BankTransferOrderResponseSchema,
42
+ BankTransferRefusedSchema: () => BankTransferRefusedSchema,
43
+ BankTransferRequestContextSchema: () => BankTransferRequestContextSchema,
44
+ BankTransferRequestSchema: () => BankTransferRequestSchema,
45
+ BankTransferResponseSchemaFor: () => BankTransferResponseSchemaFor,
46
+ BankTransferStepResponseSchema: () => BankTransferStepResponseSchema,
47
+ BankTransferWaitNextActionSchema: () => BankTransferWaitNextActionSchema,
23
48
  BlockedReasonSchema: () => BlockedReasonSchema,
24
49
  BlockedStateSchema: () => BlockedStateSchema,
25
50
  COINBASE_ENDPOINTS: () => COINBASE_ENDPOINTS,
@@ -998,12 +1023,12 @@ var OrderPollSchema = obj({
998
1023
  giveUpAfterMs: import_zod.z.number().int().positive().max(60 * 60 * 1e3)
999
1024
  });
1000
1025
  function checkOrderPendingPoll(response, context2) {
1001
- const { poll, retryAfterMs: retryAfterMs2 } = response;
1002
- if (response.next !== "orderPending" || poll === void 0 || retryAfterMs2 === void 0) return;
1003
- if (retryAfterMs2 < MIN_INTERVAL_MS) {
1026
+ const { poll, retryAfterMs: retryAfterMs3 } = response;
1027
+ if (response.next !== "orderPending" || poll === void 0 || retryAfterMs3 === void 0) return;
1028
+ if (retryAfterMs3 < MIN_INTERVAL_MS) {
1004
1029
  context2.addIssue({ code: "custom", path: ["retryAfterMs"], message: `retryAfterMs must be at least ${MIN_INTERVAL_MS} with a poll` });
1005
1030
  }
1006
- if (poll.maxIntervalMs < retryAfterMs2) {
1031
+ if (poll.maxIntervalMs < retryAfterMs3) {
1007
1032
  context2.addIssue({ code: "custom", path: ["poll", "maxIntervalMs"], message: "maxIntervalMs must be at least retryAfterMs" });
1008
1033
  }
1009
1034
  }
@@ -1289,7 +1314,7 @@ var $routingTableRequest = obj({
1289
1314
  providers: $routingTableProviderInputs.optional(),
1290
1315
  destinationAsset: $destinationAsset.optional(),
1291
1316
  depositAddress: $nonBlank.optional()
1292
- }).refine((request2) => hasUsRegion(request2.country, request2.region), { message: US_REGION_REQUIRED, path: ["region"] });
1317
+ }).refine((request3) => hasUsRegion(request3.country, request3.region), { message: US_REGION_REQUIRED, path: ["region"] });
1293
1318
  var FiatRoutingTableRequestSchema = $routingTableRequest;
1294
1319
  var $routingTableProvider = obj({
1295
1320
  provider: $routingProvider,
@@ -1347,9 +1372,9 @@ var $routingQuoteRequest = import_zod.z.union([
1347
1372
  }),
1348
1373
  obj({ ...$routingQuoteTermsShape, provider: $routingProvider })
1349
1374
  ]).refine(
1350
- (request2) => {
1351
- const allowed = request2.routingOverrides?.providers;
1352
- const selected = "providers" in request2 ? request2.providers : [request2.provider];
1375
+ (request3) => {
1376
+ const allowed = request3.routingOverrides?.providers;
1377
+ const selected = "providers" in request3 ? request3.providers : [request3.provider];
1353
1378
  return allowed === void 0 || selected.every((provider) => allowed.includes(provider));
1354
1379
  },
1355
1380
  { message: "requested providers must be allowed by routingOverrides", path: ["routingOverrides"] }
@@ -1491,7 +1516,7 @@ var $stepResponse = import_zod.z.union([$providerBoundStepResponse, $funAuthStep
1491
1516
  var FiatStepResponseSchema = $stepResponse;
1492
1517
 
1493
1518
  // package.json
1494
- var version = "0.56.0";
1519
+ var version = "0.58.0";
1495
1520
 
1496
1521
  // src/table.ts
1497
1522
  var TABLE_VERSION = version;
@@ -3392,14 +3417,14 @@ function walkTable(fn) {
3392
3417
  function assertFixture(id) {
3393
3418
  const meta = fixtureMeta(id);
3394
3419
  const json = loadFixture(id);
3395
- const stepResponse2 = assertFiatStepResponse(json);
3396
- if (stateKey(stepResponse2.state) !== meta.stateKey) {
3420
+ const stepResponse3 = assertFiatStepResponse(json);
3421
+ if (stateKey(stepResponse3.state) !== meta.stateKey) {
3397
3422
  throw new ContractViolation(
3398
- `fixture ${id}: manifest says ${meta.stateKey}, step response carries ${stateKey(stepResponse2.state)}`
3423
+ `fixture ${id}: manifest says ${meta.stateKey}, step response carries ${stateKey(stepResponse3.state)}`
3399
3424
  );
3400
3425
  }
3401
- assertLegalEmission(stepResponse2.state, stepResponse2.transitions);
3402
- return { meta, stepResponse: stepResponse2 };
3426
+ assertLegalEmission(stepResponse3.state, stepResponse3.transitions);
3427
+ return { meta, stepResponse: stepResponse3 };
3403
3428
  }
3404
3429
  function assertAllFixtures() {
3405
3430
  return FIXTURES.map((meta) => assertFixture(meta.id));
@@ -4037,7 +4062,8 @@ var kycShape = obj4({
4037
4062
  verifiedEmail: nonEmpty.nullable(),
4038
4063
  linkAuthToken: linkAuthToken.nullable(),
4039
4064
  fieldErrors: import_zod4.z.array(obj4({ fieldId: nonEmpty, message: nonEmpty })).min(1).optional(),
4040
- reask: reask.nullable()
4065
+ reask: reask.nullable(),
4066
+ paymentSheetFirst: import_zod4.z.boolean()
4041
4067
  });
4042
4068
  var identifiersNextAction = obj4({ next: import_zod4.z.literal("identifiers"), linkAuthToken: linkAuthToken.nullable() });
4043
4069
  var attestationNextAction = obj4({ next: import_zod4.z.literal("attestation"), linkAuthToken: linkAuthToken.nullable() });
@@ -4087,6 +4113,10 @@ var checkKyc3 = (nextAction, context2) => {
4087
4113
  if (nextAction.tier === "l2" && nextAction.round !== "IDENTITY") {
4088
4114
  context2.addIssue({ code: "custom", path: ["tier"], message: "l2 is an identity round" });
4089
4115
  }
4116
+ const firstAsk = nextAction.tier === "l0" && nextAction.correctionRound === 0 && nextAction.reask === null && !nextAction.fieldErrors;
4117
+ if (nextAction.paymentSheetFirst && !firstAsk) {
4118
+ context2.addIssue({ code: "custom", path: ["paymentSheetFirst"], message: "only a first ask at l0 opens the payment sheet first" });
4119
+ }
4090
4120
  };
4091
4121
  var checkPlaceOrder = (nextAction, context2) => {
4092
4122
  if (nextAction.paySheet.amount !== nextAction.price.total.amount) {
@@ -4176,31 +4206,161 @@ var errorBody = obj4({
4176
4206
  });
4177
4207
  var StripeErrorBodySchema = errorBody;
4178
4208
 
4179
- // src/providers/moonpay-guest.schemas.ts
4209
+ // src/flows/bank-transfer.ts
4210
+ var BANK_TRANSFER_ENDPOINTS = {
4211
+ next: "POST /fiat/next"
4212
+ };
4213
+ var BANK_TRANSFER_MAX_LISTED_ORDERS = 20;
4214
+
4215
+ // src/flows/bank-transfer.schemas.ts
4180
4216
  var import_zod5 = require("zod");
4181
- var context = { checkout: MoonPayCheckoutSchema, destinationAsset: DestinationAssetSchema.optional() };
4182
4217
  var obj5 = (shape) => import_zod5.z.object(shape).strict();
4183
4218
  var nonEmpty2 = import_zod5.z.string().refine((value) => value.trim().length > 0, "must not be blank");
4219
+ var hasUniqueIds5 = (ids) => new Set(ids).size === ids.length;
4220
+ var retryAfterMs2 = import_zod5.z.number().int().positive().max(6e4);
4221
+ var instant2 = import_zod5.z.string().datetime({ offset: true });
4222
+ var orderId = import_zod5.z.string().regex(/^bto_[A-Za-z0-9_-]{22}$/, "must be an order id bankDetails listed");
4223
+ var fiatCurrency = import_zod5.z.enum(Object.keys(FIAT_CURRENCY_NAMES));
4224
+ var checkout2 = obj5({
4225
+ currency: fiatCurrency,
4226
+ destination: obj5({ asset: nonEmpty2, network: nonEmpty2 }),
4227
+ paymentMethod: import_zod5.z.literal("bank_transfer")
4228
+ });
4229
+ var BankTransferCheckoutSchema = checkout2;
4230
+ var contextFields3 = { checkout: checkout2 };
4231
+ var requestContext2 = obj5(contextFields3);
4232
+ var BankTransferRequestContextSchema = requestContext2;
4233
+ var observeFields3 = { action: import_zod5.z.literal("observe") };
4234
+ var consentFields3 = {
4235
+ action: import_zod5.z.literal("consent"),
4236
+ acceptances: import_zod5.z.array(TermsDocumentAcceptanceSchema).min(1).refine((acceptances) => hasUniqueIds5(acceptances.map((acceptance) => acceptance.documentId)), "each document is accepted once")
4237
+ };
4238
+ var captureFields = { action: import_zod5.z.literal("capture"), result: KycSdkResultReportSchema };
4239
+ var openDepositInstructionsFields = { action: import_zod5.z.literal("openDepositInstructions"), walletConfirmed: import_zod5.z.literal(true), walletAddress: nonEmpty2 };
4240
+ var orderFields3 = { action: import_zod5.z.literal("order"), orderId };
4241
+ var observeRequest2 = obj5({ ...contextFields3, ...observeFields3 });
4242
+ var consentRequest2 = obj5({ ...contextFields3, ...consentFields3 });
4243
+ var captureRequest = obj5({ ...contextFields3, ...captureFields });
4244
+ var openDepositInstructionsRequest = obj5({ ...contextFields3, ...openDepositInstructionsFields });
4245
+ var orderRequest2 = obj5({ ...contextFields3, ...orderFields3 });
4246
+ var BankTransferObserveRequestSchema = observeRequest2;
4247
+ var BankTransferConsentRequestSchema = consentRequest2;
4248
+ var BankTransferCaptureRequestSchema = captureRequest;
4249
+ var BankTransferOpenDepositInstructionsRequestSchema = openDepositInstructionsRequest;
4250
+ var BankTransferOrderRequestSchema = orderRequest2;
4251
+ var request2 = import_zod5.z.discriminatedUnion("action", [observeRequest2, consentRequest2, captureRequest, openDepositInstructionsRequest, orderRequest2]);
4252
+ var BankTransferRequestSchema = request2;
4253
+ var envelope3 = { provider: FiatProviderSchema, geo: FiatGeoSchema, ...contextFields3 };
4254
+ var nextRequest2 = import_zod5.z.discriminatedUnion("action", [
4255
+ obj5({ ...envelope3, ...observeFields3 }),
4256
+ obj5({ ...envelope3, ...consentFields3 }),
4257
+ obj5({ ...envelope3, ...captureFields }),
4258
+ obj5({ ...envelope3, ...openDepositInstructionsFields }),
4259
+ obj5({ ...envelope3, ...orderFields3 })
4260
+ ]);
4261
+ var BankTransferNextRequestSchema = nextRequest2;
4262
+ var wallet = obj5({ address: nonEmpty2, network: nonEmpty2, asset: nonEmpty2 });
4263
+ var consentShape2 = obj5({ next: import_zod5.z.literal("consent"), documents: import_zod5.z.array(TermsDocumentSchema).min(1) });
4264
+ var captureNextAction = obj5({ next: import_zod5.z.literal("capture"), kycProvider: KYCProviderSchema, accessToken: nonEmpty2, expiresAt: instant2 });
4265
+ var waitNextAction2 = obj5({ next: import_zod5.z.literal("wait"), retryAfterMs: retryAfterMs2 });
4266
+ var openDepositInstructionsNextAction = obj5({ next: import_zod5.z.literal("openDepositInstructions"), wallet, attestationText: nonEmpty2 });
4267
+ var bankDetailsShape = obj5({
4268
+ next: import_zod5.z.literal("bankDetails"),
4269
+ instructions: obj5({ kind: import_zod5.z.literal("BANK_FIELDS"), fields: import_zod5.z.array(InstructionFieldSchema).min(1) }),
4270
+ wallet,
4271
+ orders: import_zod5.z.array(FiatStepResponseSchema).max(BANK_TRANSFER_MAX_LISTED_ORDERS),
4272
+ retryAfterMs: retryAfterMs2
4273
+ });
4274
+ var orderPendingNextAction2 = obj5({
4275
+ next: import_zod5.z.literal("orderPending"),
4276
+ orderId,
4277
+ retryAfterMs: retryAfterMs2,
4278
+ poll: OrderPollSchema.optional(),
4279
+ order: FiatStepResponseSchema
4280
+ });
4281
+ var checkConsent4 = (nextAction, context2) => {
4282
+ if (!hasUniqueIds5(nextAction.documents.map((document) => document.id))) {
4283
+ context2.addIssue({ code: "custom", path: ["documents"], message: "document ids must be unique" });
4284
+ }
4285
+ };
4286
+ var checkBankDetails = (nextAction, context2) => {
4287
+ if (!hasUniqueIds5(nextAction.instructions.fields.map((field) => field.id))) {
4288
+ context2.addIssue({ code: "custom", path: ["instructions", "fields"], message: "field ids must be unique" });
4289
+ }
4290
+ };
4291
+ var BankTransferConsentNextActionSchema = consentShape2.superRefine(checkConsent4);
4292
+ var BankTransferCaptureNextActionSchema = captureNextAction;
4293
+ var BankTransferWaitNextActionSchema = waitNextAction2;
4294
+ var BankTransferOpenDepositInstructionsNextActionSchema = openDepositInstructionsNextAction;
4295
+ var BankTransferBankDetailsNextActionSchema = bankDetailsShape.superRefine(checkBankDetails);
4296
+ var BankTransferOrderPendingNextActionSchema = orderPendingNextAction2.superRefine(checkOrderPendingPoll);
4297
+ var checkNextAction4 = (response, context2) => {
4298
+ checkOrderPendingPoll(response, context2);
4299
+ if (response.next === "consent") checkConsent4(response, context2);
4300
+ if (response.next === "bankDetails") checkBankDetails(response, context2);
4301
+ };
4302
+ var stepNextActions = [consentShape2, captureNextAction, waitNextAction2, openDepositInstructionsNextAction, bankDetailsShape];
4303
+ var anyNextAction2 = import_zod5.z.discriminatedUnion("next", [...stepNextActions, orderPendingNextAction2]).superRefine(checkNextAction4);
4304
+ var BankTransferNextActionSchema = anyNextAction2;
4305
+ var done2 = obj5({ next: import_zod5.z.literal("done"), order: FiatStepResponseSchema });
4306
+ var BankTransferDoneSchema = done2;
4307
+ var refused2 = obj5({
4308
+ next: import_zod5.z.literal("refused"),
4309
+ reason: import_zod5.z.enum(["NOT_ELIGIBLE", "KYC_REJECTED"]),
4310
+ recovery: import_zod5.z.literal("NONE")
4311
+ });
4312
+ var BankTransferRefusedSchema = refused2;
4313
+ var stepResponse2 = import_zod5.z.discriminatedUnion("next", [...stepNextActions, refused2]).superRefine(checkNextAction4);
4314
+ var BankTransferStepResponseSchema = stepResponse2;
4315
+ var orderResponse2 = import_zod5.z.discriminatedUnion("next", [done2, orderPendingNextAction2]).superRefine(checkOrderPendingPoll);
4316
+ var BankTransferOrderResponseSchema = orderResponse2;
4317
+ var BankTransferResponseSchemaFor = {
4318
+ observe: BankTransferStepResponseSchema,
4319
+ consent: BankTransferStepResponseSchema,
4320
+ capture: BankTransferStepResponseSchema,
4321
+ openDepositInstructions: BankTransferStepResponseSchema,
4322
+ order: BankTransferOrderResponseSchema
4323
+ };
4324
+ var faultFields3 = {
4325
+ reason: import_zod5.z.enum(["RATE_LIMITED", "PROVIDER_UNAVAILABLE", "KYC_PROVIDER_UNAVAILABLE", "SERVICE_UNAVAILABLE", "INVALID_REQUEST"]),
4326
+ recovery: import_zod5.z.enum(["RETRY", "NONE"])
4327
+ };
4328
+ var fault2 = obj5(faultFields3);
4329
+ var BankTransferFaultSchema = fault2;
4330
+ var errorBody2 = obj5({
4331
+ ...faultFields3,
4332
+ errorCode: nonEmpty2,
4333
+ errorMsg: import_zod5.z.string(),
4334
+ reqId: import_zod5.z.string().optional(),
4335
+ retryAfterSeconds: import_zod5.z.number().int().nonnegative().optional()
4336
+ });
4337
+ var BankTransferErrorBodySchema = errorBody2;
4338
+
4339
+ // src/providers/moonpay-guest.schemas.ts
4340
+ var import_zod6 = require("zod");
4341
+ var context = { checkout: MoonPayCheckoutSchema, destinationAsset: DestinationAssetSchema.optional() };
4342
+ var obj6 = (shape) => import_zod6.z.object(shape).strict();
4343
+ var nonEmpty3 = import_zod6.z.string().refine((value) => value.trim().length > 0, "must not be blank");
4184
4344
  var actions = [
4185
- { action: import_zod5.z.literal("observe") },
4186
- { action: import_zod5.z.literal("session") },
4187
- { action: import_zod5.z.literal("consent"), acceptances: import_zod5.z.array(TermsDocumentAcceptanceSchema).min(1).refine((values) => new Set(values.map((v) => v.documentId)).size === values.length, "each document is accepted once") },
4188
- { action: import_zod5.z.literal("order"), orderId: nonEmpty2, quotedAmount: FiatAmountSchema, transactionId: nonEmpty2.optional() },
4189
- { action: import_zod5.z.literal("phone"), phoneNumber: import_zod5.z.string().regex(/^\+[1-9]\d{1,14}$/) },
4190
- { action: import_zod5.z.literal("phone"), resend: nonEmpty2 },
4191
- { action: import_zod5.z.literal("phoneCode"), verificationRef: nonEmpty2, otpCode: import_zod5.z.string().regex(/^\d{6}$/) },
4192
- { action: import_zod5.z.literal("decline"), reason: MoonPayGuestDeclineReasonSchema }
4345
+ { action: import_zod6.z.literal("observe") },
4346
+ { action: import_zod6.z.literal("session") },
4347
+ { action: import_zod6.z.literal("consent"), acceptances: import_zod6.z.array(TermsDocumentAcceptanceSchema).min(1).refine((values) => new Set(values.map((v) => v.documentId)).size === values.length, "each document is accepted once") },
4348
+ { action: import_zod6.z.literal("order"), orderId: nonEmpty3, quotedAmount: FiatAmountSchema, transactionId: nonEmpty3.optional() },
4349
+ { action: import_zod6.z.literal("phone"), phoneNumber: import_zod6.z.string().regex(/^\+[1-9]\d{1,14}$/) },
4350
+ { action: import_zod6.z.literal("phone"), resend: nonEmpty3 },
4351
+ { action: import_zod6.z.literal("phoneCode"), verificationRef: nonEmpty3, otpCode: import_zod6.z.string().regex(/^\d{6}$/) },
4352
+ { action: import_zod6.z.literal("decline"), reason: MoonPayGuestDeclineReasonSchema }
4193
4353
  ];
4194
- var MoonPayGuestObserveRequestSchema = obj5({ ...context, ...actions[0] });
4195
- var MoonPayGuestSessionRequestSchema = obj5({ ...context, ...actions[1] });
4196
- var MoonPayGuestConsentRequestSchema = obj5({ ...context, ...actions[2] });
4197
- var MoonPayGuestOrderRequestSchema = obj5({ ...context, ...actions[3] });
4198
- var MoonPayGuestPhoneNumberRequestSchema = obj5({ ...context, ...actions[4] });
4199
- var MoonPayGuestPhoneResendRequestSchema = obj5({ ...context, ...actions[5] });
4200
- var MoonPayGuestPhoneCodeRequestSchema = obj5({ ...context, ...actions[6] });
4201
- var MoonPayGuestDeclineRequestSchema = obj5({ ...context, ...actions[7] });
4202
- var MoonPayGuestPhoneRequestSchema = import_zod5.z.union([MoonPayGuestPhoneNumberRequestSchema, MoonPayGuestPhoneResendRequestSchema]);
4203
- var MoonPayGuestRequestSchema = import_zod5.z.union([
4354
+ var MoonPayGuestObserveRequestSchema = obj6({ ...context, ...actions[0] });
4355
+ var MoonPayGuestSessionRequestSchema = obj6({ ...context, ...actions[1] });
4356
+ var MoonPayGuestConsentRequestSchema = obj6({ ...context, ...actions[2] });
4357
+ var MoonPayGuestOrderRequestSchema = obj6({ ...context, ...actions[3] });
4358
+ var MoonPayGuestPhoneNumberRequestSchema = obj6({ ...context, ...actions[4] });
4359
+ var MoonPayGuestPhoneResendRequestSchema = obj6({ ...context, ...actions[5] });
4360
+ var MoonPayGuestPhoneCodeRequestSchema = obj6({ ...context, ...actions[6] });
4361
+ var MoonPayGuestDeclineRequestSchema = obj6({ ...context, ...actions[7] });
4362
+ var MoonPayGuestPhoneRequestSchema = import_zod6.z.union([MoonPayGuestPhoneNumberRequestSchema, MoonPayGuestPhoneResendRequestSchema]);
4363
+ var MoonPayGuestRequestSchema = import_zod6.z.union([
4204
4364
  MoonPayGuestObserveRequestSchema,
4205
4365
  MoonPayGuestSessionRequestSchema,
4206
4366
  MoonPayGuestConsentRequestSchema,
@@ -4210,22 +4370,22 @@ var MoonPayGuestRequestSchema = import_zod5.z.union([
4210
4370
  MoonPayGuestPhoneCodeRequestSchema,
4211
4371
  MoonPayGuestDeclineRequestSchema
4212
4372
  ]);
4213
- var MoonPayGuestNextRequestSchema = import_zod5.z.union([
4214
- obj5({ provider: import_zod5.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[0] }),
4215
- obj5({ provider: import_zod5.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[1] }),
4216
- obj5({ provider: import_zod5.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[2] }),
4217
- obj5({ provider: import_zod5.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[3] }),
4218
- obj5({ provider: import_zod5.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[4] }),
4219
- obj5({ provider: import_zod5.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[5] }),
4220
- obj5({ provider: import_zod5.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[6] }),
4221
- obj5({ provider: import_zod5.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[7] })
4373
+ var MoonPayGuestNextRequestSchema = import_zod6.z.union([
4374
+ obj6({ provider: import_zod6.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty3.optional(), ...context, ...actions[0] }),
4375
+ obj6({ provider: import_zod6.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty3.optional(), ...context, ...actions[1] }),
4376
+ obj6({ provider: import_zod6.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty3.optional(), ...context, ...actions[2] }),
4377
+ obj6({ provider: import_zod6.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty3.optional(), ...context, ...actions[3] }),
4378
+ obj6({ provider: import_zod6.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty3.optional(), ...context, ...actions[4] }),
4379
+ obj6({ provider: import_zod6.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty3.optional(), ...context, ...actions[5] }),
4380
+ obj6({ provider: import_zod6.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty3.optional(), ...context, ...actions[6] }),
4381
+ obj6({ provider: import_zod6.z.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty3.optional(), ...context, ...actions[7] })
4222
4382
  ]);
4223
- var MoonPayGuestStepResponseSchema = import_zod5.z.union([
4383
+ var MoonPayGuestStepResponseSchema = import_zod6.z.union([
4224
4384
  MoonPayConsentNextActionSchema,
4225
4385
  MoonPaySessionNextActionSchema,
4226
4386
  MoonPayPhoneNextActionSchema,
4227
4387
  MoonPayPhoneCodeNextActionSchema,
4228
4388
  MoonPayPayNextActionSchema,
4229
- obj5({ next: import_zod5.z.literal("refused"), reason: import_zod5.z.enum(["NOT_ELIGIBLE", "FINAL_REJECTION"]), recovery: import_zod5.z.enum(["REQUOTE", "NONE"]) })
4389
+ obj6({ next: import_zod6.z.literal("refused"), reason: import_zod6.z.enum(["NOT_ELIGIBLE", "FINAL_REJECTION"]), recovery: import_zod6.z.enum(["REQUOTE", "NONE"]) })
4230
4390
  ]);
4231
- var MoonPayGuestResponseSchema = import_zod5.z.union([MoonPayGuestStepResponseSchema, MoonPayOrderResponseSchema]);
4391
+ var MoonPayGuestResponseSchema = import_zod6.z.union([MoonPayGuestStepResponseSchema, MoonPayOrderResponseSchema]);
package/dist/index.mjs CHANGED
@@ -1,3 +1,10 @@
1
+ import {
2
+ FIAT_TERMS_ENDPOINT,
3
+ FUN_KYC_CONSENT_DOCUMENTS,
4
+ PROVIDER_CHECKOUT_DOCUMENTS,
5
+ PROVIDER_KYC_DOCUMENTS,
6
+ PUBLISHED_TERMS_DOCUMENTS
7
+ } from "./chunk-TIQALG7X.mjs";
1
8
  import {
2
9
  ROUTING_ENDPOINTS
3
10
  } from "./chunk-2NZSOZHV.mjs";
@@ -16,7 +23,7 @@ import {
16
23
  tableEntry,
17
24
  unofferedEndpoints,
18
25
  unreachableStates
19
- } from "./chunk-T45SRB5E.mjs";
26
+ } from "./chunk-X5HMCOMZ.mjs";
20
27
  import {
21
28
  MOONPAY_ENDPOINTS
22
29
  } from "./chunk-TIEGTTFY.mjs";
@@ -29,12 +36,9 @@ import {
29
36
  STRIPE_ENDPOINTS
30
37
  } from "./chunk-KLAXY6H7.mjs";
31
38
  import {
32
- FIAT_TERMS_ENDPOINT,
33
- FUN_KYC_CONSENT_DOCUMENTS,
34
- PROVIDER_CHECKOUT_DOCUMENTS,
35
- PROVIDER_KYC_DOCUMENTS,
36
- PUBLISHED_TERMS_DOCUMENTS
37
- } from "./chunk-TIQALG7X.mjs";
39
+ BANK_TRANSFER_ENDPOINTS,
40
+ BANK_TRANSFER_MAX_LISTED_ORDERS
41
+ } from "./chunk-MEL2ZOQ5.mjs";
38
42
 
39
43
  // src/codes.ts
40
44
  var US_STATE_CODES = [
@@ -755,12 +759,12 @@ var OrderPollSchema = obj({
755
759
  giveUpAfterMs: z.number().int().positive().max(60 * 60 * 1e3)
756
760
  });
757
761
  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) {
762
+ const { poll, retryAfterMs: retryAfterMs3 } = response;
763
+ if (response.next !== "orderPending" || poll === void 0 || retryAfterMs3 === void 0) return;
764
+ if (retryAfterMs3 < MIN_INTERVAL_MS) {
761
765
  context2.addIssue({ code: "custom", path: ["retryAfterMs"], message: `retryAfterMs must be at least ${MIN_INTERVAL_MS} with a poll` });
762
766
  }
763
- if (poll.maxIntervalMs < retryAfterMs2) {
767
+ if (poll.maxIntervalMs < retryAfterMs3) {
764
768
  context2.addIssue({ code: "custom", path: ["poll", "maxIntervalMs"], message: "maxIntervalMs must be at least retryAfterMs" });
765
769
  }
766
770
  }
@@ -1046,7 +1050,7 @@ var $routingTableRequest = obj({
1046
1050
  providers: $routingTableProviderInputs.optional(),
1047
1051
  destinationAsset: $destinationAsset.optional(),
1048
1052
  depositAddress: $nonBlank.optional()
1049
- }).refine((request2) => hasUsRegion(request2.country, request2.region), { message: US_REGION_REQUIRED, path: ["region"] });
1053
+ }).refine((request3) => hasUsRegion(request3.country, request3.region), { message: US_REGION_REQUIRED, path: ["region"] });
1050
1054
  var FiatRoutingTableRequestSchema = $routingTableRequest;
1051
1055
  var $routingTableProvider = obj({
1052
1056
  provider: $routingProvider,
@@ -1104,9 +1108,9 @@ var $routingQuoteRequest = z.union([
1104
1108
  }),
1105
1109
  obj({ ...$routingQuoteTermsShape, provider: $routingProvider })
1106
1110
  ]).refine(
1107
- (request2) => {
1108
- const allowed = request2.routingOverrides?.providers;
1109
- const selected = "providers" in request2 ? request2.providers : [request2.provider];
1111
+ (request3) => {
1112
+ const allowed = request3.routingOverrides?.providers;
1113
+ const selected = "providers" in request3 ? request3.providers : [request3.provider];
1110
1114
  return allowed === void 0 || selected.every((provider) => allowed.includes(provider));
1111
1115
  },
1112
1116
  { message: "requested providers must be allowed by routingOverrides", path: ["routingOverrides"] }
@@ -2557,14 +2561,14 @@ function walkTable(fn) {
2557
2561
  function assertFixture(id) {
2558
2562
  const meta = fixtureMeta(id);
2559
2563
  const json = loadFixture(id);
2560
- const stepResponse2 = assertFiatStepResponse(json);
2561
- if (stateKey(stepResponse2.state) !== meta.stateKey) {
2564
+ const stepResponse3 = assertFiatStepResponse(json);
2565
+ if (stateKey(stepResponse3.state) !== meta.stateKey) {
2562
2566
  throw new ContractViolation(
2563
- `fixture ${id}: manifest says ${meta.stateKey}, step response carries ${stateKey(stepResponse2.state)}`
2567
+ `fixture ${id}: manifest says ${meta.stateKey}, step response carries ${stateKey(stepResponse3.state)}`
2564
2568
  );
2565
2569
  }
2566
- assertLegalEmission(stepResponse2.state, stepResponse2.transitions);
2567
- return { meta, stepResponse: stepResponse2 };
2570
+ assertLegalEmission(stepResponse3.state, stepResponse3.transitions);
2571
+ return { meta, stepResponse: stepResponse3 };
2568
2572
  }
2569
2573
  function assertAllFixtures() {
2570
2574
  return FIXTURES.map((meta) => assertFixture(meta.id));
@@ -3107,7 +3111,8 @@ var kycShape = obj4({
3107
3111
  verifiedEmail: nonEmpty.nullable(),
3108
3112
  linkAuthToken: linkAuthToken.nullable(),
3109
3113
  fieldErrors: z4.array(obj4({ fieldId: nonEmpty, message: nonEmpty })).min(1).optional(),
3110
- reask: reask.nullable()
3114
+ reask: reask.nullable(),
3115
+ paymentSheetFirst: z4.boolean()
3111
3116
  });
3112
3117
  var identifiersNextAction = obj4({ next: z4.literal("identifiers"), linkAuthToken: linkAuthToken.nullable() });
3113
3118
  var attestationNextAction = obj4({ next: z4.literal("attestation"), linkAuthToken: linkAuthToken.nullable() });
@@ -3157,6 +3162,10 @@ var checkKyc3 = (nextAction, context2) => {
3157
3162
  if (nextAction.tier === "l2" && nextAction.round !== "IDENTITY") {
3158
3163
  context2.addIssue({ code: "custom", path: ["tier"], message: "l2 is an identity round" });
3159
3164
  }
3165
+ const firstAsk = nextAction.tier === "l0" && nextAction.correctionRound === 0 && nextAction.reask === null && !nextAction.fieldErrors;
3166
+ if (nextAction.paymentSheetFirst && !firstAsk) {
3167
+ context2.addIssue({ code: "custom", path: ["paymentSheetFirst"], message: "only a first ask at l0 opens the payment sheet first" });
3168
+ }
3160
3169
  };
3161
3170
  var checkPlaceOrder = (nextAction, context2) => {
3162
3171
  if (nextAction.paySheet.amount !== nextAction.price.total.amount) {
@@ -3246,31 +3255,155 @@ var errorBody = obj4({
3246
3255
  });
3247
3256
  var StripeErrorBodySchema = errorBody;
3248
3257
 
3249
- // src/providers/moonpay-guest.schemas.ts
3258
+ // src/flows/bank-transfer.schemas.ts
3250
3259
  import { z as z5 } from "zod";
3251
- var context = { checkout: MoonPayCheckoutSchema, destinationAsset: DestinationAssetSchema.optional() };
3252
3260
  var obj5 = (shape) => z5.object(shape).strict();
3253
3261
  var nonEmpty2 = z5.string().refine((value) => value.trim().length > 0, "must not be blank");
3262
+ var hasUniqueIds5 = (ids) => new Set(ids).size === ids.length;
3263
+ var retryAfterMs2 = z5.number().int().positive().max(6e4);
3264
+ var instant2 = z5.string().datetime({ offset: true });
3265
+ var orderId = z5.string().regex(/^bto_[A-Za-z0-9_-]{22}$/, "must be an order id bankDetails listed");
3266
+ var fiatCurrency = z5.enum(Object.keys(FIAT_CURRENCY_NAMES));
3267
+ var checkout2 = obj5({
3268
+ currency: fiatCurrency,
3269
+ destination: obj5({ asset: nonEmpty2, network: nonEmpty2 }),
3270
+ paymentMethod: z5.literal("bank_transfer")
3271
+ });
3272
+ var BankTransferCheckoutSchema = checkout2;
3273
+ var contextFields3 = { checkout: checkout2 };
3274
+ var requestContext2 = obj5(contextFields3);
3275
+ var BankTransferRequestContextSchema = requestContext2;
3276
+ var observeFields3 = { action: z5.literal("observe") };
3277
+ var consentFields3 = {
3278
+ action: z5.literal("consent"),
3279
+ acceptances: z5.array(TermsDocumentAcceptanceSchema).min(1).refine((acceptances) => hasUniqueIds5(acceptances.map((acceptance) => acceptance.documentId)), "each document is accepted once")
3280
+ };
3281
+ var captureFields = { action: z5.literal("capture"), result: KycSdkResultReportSchema };
3282
+ var openDepositInstructionsFields = { action: z5.literal("openDepositInstructions"), walletConfirmed: z5.literal(true), walletAddress: nonEmpty2 };
3283
+ var orderFields3 = { action: z5.literal("order"), orderId };
3284
+ var observeRequest2 = obj5({ ...contextFields3, ...observeFields3 });
3285
+ var consentRequest2 = obj5({ ...contextFields3, ...consentFields3 });
3286
+ var captureRequest = obj5({ ...contextFields3, ...captureFields });
3287
+ var openDepositInstructionsRequest = obj5({ ...contextFields3, ...openDepositInstructionsFields });
3288
+ var orderRequest2 = obj5({ ...contextFields3, ...orderFields3 });
3289
+ var BankTransferObserveRequestSchema = observeRequest2;
3290
+ var BankTransferConsentRequestSchema = consentRequest2;
3291
+ var BankTransferCaptureRequestSchema = captureRequest;
3292
+ var BankTransferOpenDepositInstructionsRequestSchema = openDepositInstructionsRequest;
3293
+ var BankTransferOrderRequestSchema = orderRequest2;
3294
+ var request2 = z5.discriminatedUnion("action", [observeRequest2, consentRequest2, captureRequest, openDepositInstructionsRequest, orderRequest2]);
3295
+ var BankTransferRequestSchema = request2;
3296
+ var envelope3 = { provider: FiatProviderSchema, geo: FiatGeoSchema, ...contextFields3 };
3297
+ var nextRequest2 = z5.discriminatedUnion("action", [
3298
+ obj5({ ...envelope3, ...observeFields3 }),
3299
+ obj5({ ...envelope3, ...consentFields3 }),
3300
+ obj5({ ...envelope3, ...captureFields }),
3301
+ obj5({ ...envelope3, ...openDepositInstructionsFields }),
3302
+ obj5({ ...envelope3, ...orderFields3 })
3303
+ ]);
3304
+ var BankTransferNextRequestSchema = nextRequest2;
3305
+ var wallet = obj5({ address: nonEmpty2, network: nonEmpty2, asset: nonEmpty2 });
3306
+ var consentShape2 = obj5({ next: z5.literal("consent"), documents: z5.array(TermsDocumentSchema).min(1) });
3307
+ var captureNextAction = obj5({ next: z5.literal("capture"), kycProvider: KYCProviderSchema, accessToken: nonEmpty2, expiresAt: instant2 });
3308
+ var waitNextAction2 = obj5({ next: z5.literal("wait"), retryAfterMs: retryAfterMs2 });
3309
+ var openDepositInstructionsNextAction = obj5({ next: z5.literal("openDepositInstructions"), wallet, attestationText: nonEmpty2 });
3310
+ var bankDetailsShape = obj5({
3311
+ next: z5.literal("bankDetails"),
3312
+ instructions: obj5({ kind: z5.literal("BANK_FIELDS"), fields: z5.array(InstructionFieldSchema).min(1) }),
3313
+ wallet,
3314
+ orders: z5.array(FiatStepResponseSchema).max(BANK_TRANSFER_MAX_LISTED_ORDERS),
3315
+ retryAfterMs: retryAfterMs2
3316
+ });
3317
+ var orderPendingNextAction2 = obj5({
3318
+ next: z5.literal("orderPending"),
3319
+ orderId,
3320
+ retryAfterMs: retryAfterMs2,
3321
+ poll: OrderPollSchema.optional(),
3322
+ order: FiatStepResponseSchema
3323
+ });
3324
+ var checkConsent4 = (nextAction, context2) => {
3325
+ if (!hasUniqueIds5(nextAction.documents.map((document) => document.id))) {
3326
+ context2.addIssue({ code: "custom", path: ["documents"], message: "document ids must be unique" });
3327
+ }
3328
+ };
3329
+ var checkBankDetails = (nextAction, context2) => {
3330
+ if (!hasUniqueIds5(nextAction.instructions.fields.map((field) => field.id))) {
3331
+ context2.addIssue({ code: "custom", path: ["instructions", "fields"], message: "field ids must be unique" });
3332
+ }
3333
+ };
3334
+ var BankTransferConsentNextActionSchema = consentShape2.superRefine(checkConsent4);
3335
+ var BankTransferCaptureNextActionSchema = captureNextAction;
3336
+ var BankTransferWaitNextActionSchema = waitNextAction2;
3337
+ var BankTransferOpenDepositInstructionsNextActionSchema = openDepositInstructionsNextAction;
3338
+ var BankTransferBankDetailsNextActionSchema = bankDetailsShape.superRefine(checkBankDetails);
3339
+ var BankTransferOrderPendingNextActionSchema = orderPendingNextAction2.superRefine(checkOrderPendingPoll);
3340
+ var checkNextAction4 = (response, context2) => {
3341
+ checkOrderPendingPoll(response, context2);
3342
+ if (response.next === "consent") checkConsent4(response, context2);
3343
+ if (response.next === "bankDetails") checkBankDetails(response, context2);
3344
+ };
3345
+ var stepNextActions = [consentShape2, captureNextAction, waitNextAction2, openDepositInstructionsNextAction, bankDetailsShape];
3346
+ var anyNextAction2 = z5.discriminatedUnion("next", [...stepNextActions, orderPendingNextAction2]).superRefine(checkNextAction4);
3347
+ var BankTransferNextActionSchema = anyNextAction2;
3348
+ var done2 = obj5({ next: z5.literal("done"), order: FiatStepResponseSchema });
3349
+ var BankTransferDoneSchema = done2;
3350
+ var refused2 = obj5({
3351
+ next: z5.literal("refused"),
3352
+ reason: z5.enum(["NOT_ELIGIBLE", "KYC_REJECTED"]),
3353
+ recovery: z5.literal("NONE")
3354
+ });
3355
+ var BankTransferRefusedSchema = refused2;
3356
+ var stepResponse2 = z5.discriminatedUnion("next", [...stepNextActions, refused2]).superRefine(checkNextAction4);
3357
+ var BankTransferStepResponseSchema = stepResponse2;
3358
+ var orderResponse2 = z5.discriminatedUnion("next", [done2, orderPendingNextAction2]).superRefine(checkOrderPendingPoll);
3359
+ var BankTransferOrderResponseSchema = orderResponse2;
3360
+ var BankTransferResponseSchemaFor = {
3361
+ observe: BankTransferStepResponseSchema,
3362
+ consent: BankTransferStepResponseSchema,
3363
+ capture: BankTransferStepResponseSchema,
3364
+ openDepositInstructions: BankTransferStepResponseSchema,
3365
+ order: BankTransferOrderResponseSchema
3366
+ };
3367
+ var faultFields3 = {
3368
+ reason: z5.enum(["RATE_LIMITED", "PROVIDER_UNAVAILABLE", "KYC_PROVIDER_UNAVAILABLE", "SERVICE_UNAVAILABLE", "INVALID_REQUEST"]),
3369
+ recovery: z5.enum(["RETRY", "NONE"])
3370
+ };
3371
+ var fault2 = obj5(faultFields3);
3372
+ var BankTransferFaultSchema = fault2;
3373
+ var errorBody2 = obj5({
3374
+ ...faultFields3,
3375
+ errorCode: nonEmpty2,
3376
+ errorMsg: z5.string(),
3377
+ reqId: z5.string().optional(),
3378
+ retryAfterSeconds: z5.number().int().nonnegative().optional()
3379
+ });
3380
+ var BankTransferErrorBodySchema = errorBody2;
3381
+
3382
+ // src/providers/moonpay-guest.schemas.ts
3383
+ import { z as z6 } from "zod";
3384
+ var context = { checkout: MoonPayCheckoutSchema, destinationAsset: DestinationAssetSchema.optional() };
3385
+ var obj6 = (shape) => z6.object(shape).strict();
3386
+ var nonEmpty3 = z6.string().refine((value) => value.trim().length > 0, "must not be blank");
3254
3387
  var actions = [
3255
- { action: z5.literal("observe") },
3256
- { action: z5.literal("session") },
3257
- { action: z5.literal("consent"), acceptances: z5.array(TermsDocumentAcceptanceSchema).min(1).refine((values) => new Set(values.map((v) => v.documentId)).size === values.length, "each document is accepted once") },
3258
- { action: z5.literal("order"), orderId: nonEmpty2, quotedAmount: FiatAmountSchema, transactionId: nonEmpty2.optional() },
3259
- { action: z5.literal("phone"), phoneNumber: z5.string().regex(/^\+[1-9]\d{1,14}$/) },
3260
- { action: z5.literal("phone"), resend: nonEmpty2 },
3261
- { action: z5.literal("phoneCode"), verificationRef: nonEmpty2, otpCode: z5.string().regex(/^\d{6}$/) },
3262
- { action: z5.literal("decline"), reason: MoonPayGuestDeclineReasonSchema }
3388
+ { action: z6.literal("observe") },
3389
+ { action: z6.literal("session") },
3390
+ { action: z6.literal("consent"), acceptances: z6.array(TermsDocumentAcceptanceSchema).min(1).refine((values) => new Set(values.map((v) => v.documentId)).size === values.length, "each document is accepted once") },
3391
+ { action: z6.literal("order"), orderId: nonEmpty3, quotedAmount: FiatAmountSchema, transactionId: nonEmpty3.optional() },
3392
+ { action: z6.literal("phone"), phoneNumber: z6.string().regex(/^\+[1-9]\d{1,14}$/) },
3393
+ { action: z6.literal("phone"), resend: nonEmpty3 },
3394
+ { action: z6.literal("phoneCode"), verificationRef: nonEmpty3, otpCode: z6.string().regex(/^\d{6}$/) },
3395
+ { action: z6.literal("decline"), reason: MoonPayGuestDeclineReasonSchema }
3263
3396
  ];
3264
- var MoonPayGuestObserveRequestSchema = obj5({ ...context, ...actions[0] });
3265
- var MoonPayGuestSessionRequestSchema = obj5({ ...context, ...actions[1] });
3266
- var MoonPayGuestConsentRequestSchema = obj5({ ...context, ...actions[2] });
3267
- var MoonPayGuestOrderRequestSchema = obj5({ ...context, ...actions[3] });
3268
- var MoonPayGuestPhoneNumberRequestSchema = obj5({ ...context, ...actions[4] });
3269
- var MoonPayGuestPhoneResendRequestSchema = obj5({ ...context, ...actions[5] });
3270
- var MoonPayGuestPhoneCodeRequestSchema = obj5({ ...context, ...actions[6] });
3271
- var MoonPayGuestDeclineRequestSchema = obj5({ ...context, ...actions[7] });
3272
- var MoonPayGuestPhoneRequestSchema = z5.union([MoonPayGuestPhoneNumberRequestSchema, MoonPayGuestPhoneResendRequestSchema]);
3273
- var MoonPayGuestRequestSchema = z5.union([
3397
+ var MoonPayGuestObserveRequestSchema = obj6({ ...context, ...actions[0] });
3398
+ var MoonPayGuestSessionRequestSchema = obj6({ ...context, ...actions[1] });
3399
+ var MoonPayGuestConsentRequestSchema = obj6({ ...context, ...actions[2] });
3400
+ var MoonPayGuestOrderRequestSchema = obj6({ ...context, ...actions[3] });
3401
+ var MoonPayGuestPhoneNumberRequestSchema = obj6({ ...context, ...actions[4] });
3402
+ var MoonPayGuestPhoneResendRequestSchema = obj6({ ...context, ...actions[5] });
3403
+ var MoonPayGuestPhoneCodeRequestSchema = obj6({ ...context, ...actions[6] });
3404
+ var MoonPayGuestDeclineRequestSchema = obj6({ ...context, ...actions[7] });
3405
+ var MoonPayGuestPhoneRequestSchema = z6.union([MoonPayGuestPhoneNumberRequestSchema, MoonPayGuestPhoneResendRequestSchema]);
3406
+ var MoonPayGuestRequestSchema = z6.union([
3274
3407
  MoonPayGuestObserveRequestSchema,
3275
3408
  MoonPayGuestSessionRequestSchema,
3276
3409
  MoonPayGuestConsentRequestSchema,
@@ -3280,26 +3413,51 @@ var MoonPayGuestRequestSchema = z5.union([
3280
3413
  MoonPayGuestPhoneCodeRequestSchema,
3281
3414
  MoonPayGuestDeclineRequestSchema
3282
3415
  ]);
3283
- var MoonPayGuestNextRequestSchema = z5.union([
3284
- obj5({ provider: z5.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[0] }),
3285
- obj5({ provider: z5.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[1] }),
3286
- obj5({ provider: z5.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[2] }),
3287
- obj5({ provider: z5.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[3] }),
3288
- obj5({ provider: z5.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[4] }),
3289
- obj5({ provider: z5.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[5] }),
3290
- obj5({ provider: z5.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[6] }),
3291
- obj5({ provider: z5.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty2.optional(), ...context, ...actions[7] })
3416
+ var MoonPayGuestNextRequestSchema = z6.union([
3417
+ obj6({ provider: z6.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty3.optional(), ...context, ...actions[0] }),
3418
+ obj6({ provider: z6.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty3.optional(), ...context, ...actions[1] }),
3419
+ obj6({ provider: z6.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty3.optional(), ...context, ...actions[2] }),
3420
+ obj6({ provider: z6.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty3.optional(), ...context, ...actions[3] }),
3421
+ obj6({ provider: z6.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty3.optional(), ...context, ...actions[4] }),
3422
+ obj6({ provider: z6.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty3.optional(), ...context, ...actions[5] }),
3423
+ obj6({ provider: z6.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty3.optional(), ...context, ...actions[6] }),
3424
+ obj6({ provider: z6.literal("MOONPAY_GUEST"), geo: FiatGeoSchema, depositAddress: nonEmpty3.optional(), ...context, ...actions[7] })
3292
3425
  ]);
3293
- var MoonPayGuestStepResponseSchema = z5.union([
3426
+ var MoonPayGuestStepResponseSchema = z6.union([
3294
3427
  MoonPayConsentNextActionSchema,
3295
3428
  MoonPaySessionNextActionSchema,
3296
3429
  MoonPayPhoneNextActionSchema,
3297
3430
  MoonPayPhoneCodeNextActionSchema,
3298
3431
  MoonPayPayNextActionSchema,
3299
- obj5({ next: z5.literal("refused"), reason: z5.enum(["NOT_ELIGIBLE", "FINAL_REJECTION"]), recovery: z5.enum(["REQUOTE", "NONE"]) })
3432
+ obj6({ next: z6.literal("refused"), reason: z6.enum(["NOT_ELIGIBLE", "FINAL_REJECTION"]), recovery: z6.enum(["REQUOTE", "NONE"]) })
3300
3433
  ]);
3301
- var MoonPayGuestResponseSchema = z5.union([MoonPayGuestStepResponseSchema, MoonPayOrderResponseSchema]);
3434
+ var MoonPayGuestResponseSchema = z6.union([MoonPayGuestStepResponseSchema, MoonPayOrderResponseSchema]);
3302
3435
  export {
3436
+ BANK_TRANSFER_ENDPOINTS,
3437
+ BANK_TRANSFER_MAX_LISTED_ORDERS,
3438
+ BankTransferBankDetailsNextActionSchema,
3439
+ BankTransferCaptureNextActionSchema,
3440
+ BankTransferCaptureRequestSchema,
3441
+ BankTransferCheckoutSchema,
3442
+ BankTransferConsentNextActionSchema,
3443
+ BankTransferConsentRequestSchema,
3444
+ BankTransferDoneSchema,
3445
+ BankTransferErrorBodySchema,
3446
+ BankTransferFaultSchema,
3447
+ BankTransferNextActionSchema,
3448
+ BankTransferNextRequestSchema,
3449
+ BankTransferObserveRequestSchema,
3450
+ BankTransferOpenDepositInstructionsNextActionSchema,
3451
+ BankTransferOpenDepositInstructionsRequestSchema,
3452
+ BankTransferOrderPendingNextActionSchema,
3453
+ BankTransferOrderRequestSchema,
3454
+ BankTransferOrderResponseSchema,
3455
+ BankTransferRefusedSchema,
3456
+ BankTransferRequestContextSchema,
3457
+ BankTransferRequestSchema,
3458
+ BankTransferResponseSchemaFor,
3459
+ BankTransferStepResponseSchema,
3460
+ BankTransferWaitNextActionSchema,
3303
3461
  BlockedReasonSchema,
3304
3462
  BlockedStateSchema,
3305
3463
  COINBASE_ENDPOINTS,
@@ -114,6 +114,11 @@ export type StripeReask = {
114
114
  * An EU buyer gets `round: 'IDENTITY'`, `tier: 'l2'`: Stripe reads `l0` and `l1` as not available there. Its fields add
115
115
  * `NATIONALITY`, `CITY_OF_BIRTH` and `COUNTRY_OF_BIRTH`, which the device passes to `attachKycInfo`. The backend sends
116
116
  * `l2`, `identifiers` and `attestation` only for an EUR checkout, so a client that sends only USD never gets them.
117
+ *
118
+ * `paymentSheetFirst`: open the Apple Pay sheet before this form, and answer the form from the sheet's contact. Only a
119
+ * first ask at `l0` (`correctionRound` 0, no `reask`, no `fieldErrors`) sets it. The backend decides it per buyer, so a
120
+ * client opens the sheet first only when it is `true`. A backend before 0.56.1 sends none; a client may then keep its
121
+ * own first-ask rule.
117
122
  */
118
123
  export type StripeKycNextAction = {
119
124
  next: 'kyc';
@@ -126,6 +131,7 @@ export type StripeKycNextAction = {
126
131
  linkAuthToken: StripeLinkAuthToken | null;
127
132
  fieldErrors?: StripeFieldError[];
128
133
  reask: StripeReask | null;
134
+ paymentSheetFirst: boolean;
129
135
  };
130
136
  /**
131
137
  * `values` is keyed by the ids of the next action's fields: the values the device gave Stripe. `correctionRound` is the
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.56.0";
40
+ var version = "0.58.0";
41
41
 
42
42
  // src/table.ts
43
43
  var TABLE_VERSION = version;
package/dist/table.mjs CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  tableEntry,
13
13
  unofferedEndpoints,
14
14
  unreachableStates
15
- } from "./chunk-T45SRB5E.mjs";
15
+ } from "./chunk-X5HMCOMZ.mjs";
16
16
  export {
17
17
  DOCUMENTED_ENDPOINTS,
18
18
  FUN_AUTH_ERROR_CODES,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fun-xyz/fiat-contract",
3
- "version": "0.56.0",
3
+ "version": "0.58.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": {
@@ -58,6 +58,11 @@
58
58
  "types": "./dist/providers/moonpay-guest.d.ts",
59
59
  "import": "./dist/providers/moonpay-guest.mjs",
60
60
  "require": "./dist/providers/moonpay-guest.js"
61
+ },
62
+ "./bank-transfer": {
63
+ "types": "./dist/flows/bank-transfer.d.ts",
64
+ "import": "./dist/flows/bank-transfer.mjs",
65
+ "require": "./dist/flows/bank-transfer.js"
61
66
  }
62
67
  },
63
68
  "files": [
@@ -75,7 +80,9 @@
75
80
  "terms.js",
76
81
  "terms.d.ts",
77
82
  "routing.js",
78
- "routing.d.ts"
83
+ "routing.d.ts",
84
+ "bank-transfer.js",
85
+ "bank-transfer.d.ts"
79
86
  ],
80
87
  "engines": {
81
88
  "node": ">=18"
@@ -131,6 +138,9 @@
131
138
  ],
132
139
  "moonpay-guest": [
133
140
  "./dist/providers/moonpay-guest.d.ts"
141
+ ],
142
+ "bank-transfer": [
143
+ "./dist/flows/bank-transfer.d.ts"
134
144
  ]
135
145
  }
136
146
  }