@fun-xyz/fiat-contract 0.45.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.
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "0.45.0";
2
+ var version = "0.46.0";
3
3
 
4
4
  // src/table.ts
5
5
  var TABLE_VERSION = version;
package/dist/index.js CHANGED
@@ -1181,7 +1181,8 @@ var $routingTableRequest = obj({
1181
1181
  // Duplicates are allowed; the response lists each method once.
1182
1182
  methods: import_zod.z.array(import_zod.z.enum(PAYMENT_METHOD_CATEGORIES)).min(1),
1183
1183
  providers: $routingTableProviderInputs.optional(),
1184
- destinationAsset: $destinationAsset.optional()
1184
+ destinationAsset: $destinationAsset.optional(),
1185
+ depositAddress: $nonBlank.optional()
1185
1186
  }).refine((request) => hasUsRegion(request.country, request.region), { message: US_REGION_REQUIRED, path: ["region"] });
1186
1187
  var FiatRoutingTableRequestSchema = $routingTableRequest;
1187
1188
  var $routingTableProvider = obj({
@@ -1229,6 +1230,7 @@ var $routingQuoteTermsShape = {
1229
1230
  prepareSessionAuth: import_zod.z.boolean().optional(),
1230
1231
  routingOverrides: obj({ providers: import_zod.z.array($routingProvider) }).optional(),
1231
1232
  destinationAsset: $destinationAsset.optional(),
1233
+ depositAddress: $nonBlank.optional(),
1232
1234
  handoffPaths: import_zod.z.array($handoffPath).refine(hasUniqueIds, "each handoff path is listed once").optional()
1233
1235
  };
1234
1236
  var $routingQuoteTerms = obj($routingQuoteTermsShape);
@@ -1285,7 +1287,13 @@ var $routingQuoteErrorBody = import_zod.z.union([$routingNoRouteErrorBody, $rout
1285
1287
  var FiatRoutingQuoteErrorBodySchema = $routingQuoteErrorBody;
1286
1288
  var $fiatGeo = obj({ alpha2: import_zod.z.string().regex(/^[A-Z]{2}$/), region: $nonBlank.optional(), ip: $nonBlank.optional() });
1287
1289
  var FiatGeoSchema = $fiatGeo;
1288
- var $nextRequest = import_zod.z.object({ provider: $provider, action: $nonBlank, geo: $fiatGeo, destinationAsset: $destinationAsset.optional() }).catchall(import_zod.z.unknown());
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());
1289
1297
  var FiatNextRequestSchema = $nextRequest;
1290
1298
  var $authStartRequest = import_zod.z.union([obj({ email: $nonBlank }), obj({ verificationRef: $nonBlank })]);
1291
1299
  var FiatAuthStartRequestSchema = $authStartRequest;
@@ -1385,7 +1393,7 @@ var $stepResponse = import_zod.z.union([$providerBoundStepResponse, $funAuthStep
1385
1393
  var FiatStepResponseSchema = $stepResponse;
1386
1394
 
1387
1395
  // package.json
1388
- var version = "0.45.0";
1396
+ var version = "0.46.0";
1389
1397
 
1390
1398
  // src/table.ts
1391
1399
  var TABLE_VERSION = version;
@@ -3455,7 +3463,7 @@ var $request = import_zod2.z.discriminatedUnion("action", [
3455
3463
  $orderRequest
3456
3464
  ]);
3457
3465
  var MoonPayRequestSchema = $request;
3458
- 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 };
3459
3467
  var $nextRequest2 = import_zod2.z.discriminatedUnion("action", [
3460
3468
  obj2({ ...$envelope, ...$observeFields }),
3461
3469
  obj2({ ...$envelope, ...$consentFields }),
@@ -3668,7 +3676,7 @@ var CoinbasePlaceOrderRequestSchema = $placeOrderRequest;
3668
3676
  var CoinbaseOrderRequestSchema = $orderRequest2;
3669
3677
  var $request2 = import_zod3.z.union([$observeRequest2, $consentRequest2, $sessionRequest2, $otpRequest, $kycRequest2, $placeOrderRequest, $orderRequest2]);
3670
3678
  var CoinbaseRequestSchema = $request2;
3671
- 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 };
3672
3680
  var $nextRequest3 = import_zod3.z.union([
3673
3681
  obj3({ ...envelope, ...observeFields }),
3674
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-FXHH22VB.mjs";
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({ provider: $provider, action: $nonBlank, geo: $fiatGeo, destinationAsset: $destinationAsset.optional() }).catchall(z.unknown());
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;
@@ -2600,7 +2608,7 @@ var $request = z2.discriminatedUnion("action", [
2600
2608
  $orderRequest
2601
2609
  ]);
2602
2610
  var MoonPayRequestSchema = $request;
2603
- var $envelope = { provider: z2.literal("MOONPAY"), geo: FiatGeoSchema, ...$context };
2611
+ var $envelope = { provider: z2.literal("MOONPAY"), geo: FiatGeoSchema, depositAddress: $nonEmpty.optional(), ...$context };
2604
2612
  var $nextRequest2 = z2.discriminatedUnion("action", [
2605
2613
  obj2({ ...$envelope, ...$observeFields }),
2606
2614
  obj2({ ...$envelope, ...$consentFields }),
@@ -2800,7 +2808,7 @@ var CoinbasePlaceOrderRequestSchema = $placeOrderRequest;
2800
2808
  var CoinbaseOrderRequestSchema = $orderRequest2;
2801
2809
  var $request2 = z3.union([$observeRequest2, $consentRequest2, $sessionRequest2, $otpRequest, $kycRequest2, $placeOrderRequest, $orderRequest2]);
2802
2810
  var CoinbaseRequestSchema = $request2;
2803
- var envelope = { provider: z3.literal("COINBASE"), geo: FiatGeoSchema, ...contextFields };
2811
+ var envelope = { provider: z3.literal("COINBASE"), geo: FiatGeoSchema, depositAddress: $nonEmpty2.optional(), ...contextFields };
2804
2812
  var $nextRequest3 = z3.union([
2805
2813
  obj3({ ...envelope, ...observeFields }),
2806
2814
  obj3({ ...envelope, ...consentFields }),
@@ -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 and the deposit wallet come from the verified partner assertion, never from a request body.
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
- /** The wire body. The orchestrator reads `provider` and `geo`; Coinbase's action schemas read the rest. */
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`, the context (`checkout`, and
17
- * `credentials` after `connect`), and the action's result. Identity and the deposit wallet always
18
- * come from the verified partner assertion, never from a request body.
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
- /** The wire body. The orchestrator reads `provider` and `geo`; MoonPay's action schemas read the rest. */
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/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.45.0";
40
+ var version = "0.46.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-FXHH22VB.mjs";
15
+ } from "./chunk-IAKK466V.mjs";
16
16
  export {
17
17
  DOCUMENTED_ENDPOINTS,
18
18
  FUN_AUTH_ERROR_CODES,
package/dist/types.d.ts CHANGED
@@ -853,7 +853,8 @@ export type FiatHandoffPathName = FiatHandoffPath extends `${string}/${infer Pat
853
853
  * so its presence never turns a conversion on. Every request field that carries it is named
854
854
  * `destinationAsset`, optional only so a client that predates it still parses; a missing
855
855
  * `destinationAsset` means the partner's configured asset. The recipient always comes from the
856
- * verified partner assertion, never from this field.
856
+ * verified partner assertion or, for a mode-2 partner, from the request's `depositAddress`, never from
857
+ * this field.
857
858
  *
858
859
  * Split by VM, then by asset kind. Solana carries no chain id: the backend maps each VM to its own
859
860
  * chain ids in one place. `NON_FUNGIBLE` is reserved: the backend does not serve it yet and answers
@@ -900,14 +901,21 @@ export type FiatGeo = {
900
901
  ip?: string;
901
902
  };
902
903
  /**
903
- * The body of every `POST /fiat/next`: `provider`, `geo`, the `destinationAsset`, and the
904
- * provider's own request, which names its `action`. Each provider defines its actions and their
905
- * 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`).
906
907
  */
907
908
  export type FiatNextRequest = {
908
909
  provider: FiatProvider;
909
910
  action: string;
910
911
  geo: FiatGeo;
911
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;
912
920
  } & Record<string, unknown>;
913
921
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fun-xyz/fiat-contract",
3
- "version": "0.45.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": {