@fun-xyz/fiat-contract 0.42.0 → 0.43.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.42.0";
2
+ var version = "0.43.0";
3
3
 
4
4
  // src/table.ts
5
5
  var TABLE_VERSION = version;
@@ -112,7 +112,7 @@ var TRANSITION_TABLE = {
112
112
  "Not in the FE doc, so no screen number: the client renders it on its contact and OTP screens.",
113
113
  "Every FUN_AUTH error is category USER_ERROR with a code from FUN_AUTH_ERROR_CODES. A wrong code re-enters CODE with BAD_CODE and a lower attemptsRemaining; TOO_MANY_ATTEMPTS and CODE_EXPIRED drop the challenge and offer resend; OTP_DISPATCH_THROTTLED re-enters with resendAvailableAtMs set.",
114
114
  "resend carries the verificationRef the client holds, even one the server has dropped (expired, too many attempts); the server starts a fresh challenge for the same email while it still remembers the challenge (its code expiry plus a short grace); once it is forgotten the answer is IDENTIFIER with CODE_EXPIRED.",
115
- "POST /fiat/auth/refresh and /revoke are called by the SDK session store, never offered as transitions."
115
+ "POST /fiat/auth/refresh, /revoke and /recipient are called by the SDK session store, never offered as transitions."
116
116
  ]
117
117
  },
118
118
  SESSION_AUTH: {
@@ -478,6 +478,7 @@ var DOCUMENTED_ENDPOINTS = [
478
478
  "POST /fiat/auth/verify",
479
479
  "POST /fiat/auth/refresh",
480
480
  "POST /fiat/auth/revoke",
481
+ "POST /fiat/auth/recipient",
481
482
  "POST /fiat/payment-session",
482
483
  "POST /fiat/session",
483
484
  "POST /fiat/session/verify",
@@ -509,6 +510,10 @@ var UNOFFERED_ENDPOINTS = [
509
510
  endpoint: "POST /fiat/auth/revoke",
510
511
  reason: "SDK session store, not a transition."
511
512
  },
513
+ {
514
+ endpoint: "POST /fiat/auth/recipient",
515
+ reason: "SDK session store at beginDeposit, not a transition."
516
+ },
512
517
  {
513
518
  endpoint: "POST /fiat/kyc/document",
514
519
  reason: "FILE fields use it for a direct provider/vendor upload handshake and completion report; the harness owns that auxiliary path and it is not a transition (see KYC/INPUT_REQUIRED notes)."
package/dist/index.js CHANGED
@@ -73,6 +73,8 @@ __export(index_exports, {
73
73
  FailureReasonSchema: () => FailureReasonSchema,
74
74
  FeeLineSchema: () => FeeLineSchema,
75
75
  FiatAmountSchema: () => FiatAmountSchema,
76
+ FiatAuthRecipientRequestSchema: () => FiatAuthRecipientRequestSchema,
77
+ FiatAuthRecipientResponseSchema: () => FiatAuthRecipientResponseSchema,
76
78
  FiatAuthRefreshRequestSchema: () => FiatAuthRefreshRequestSchema,
77
79
  FiatAuthRefreshResponseSchema: () => FiatAuthRefreshResponseSchema,
78
80
  FiatAuthRevokeRequestSchema: () => FiatAuthRevokeRequestSchema,
@@ -1287,6 +1289,16 @@ var $authRefreshResponse = obj({ session: $fiatSession });
1287
1289
  var FiatAuthRefreshResponseSchema = $authRefreshResponse;
1288
1290
  var $authRevokeRequest = obj({ refreshHandle: $nonBlank });
1289
1291
  var FiatAuthRevokeRequestSchema = $authRevokeRequest;
1292
+ var $authRecipientRequest = import_zod.z.discriminatedUnion("vm", [
1293
+ obj({ refreshHandle: $nonBlank, vm: import_zod.z.literal("EVM"), chainId: import_zod.z.number().int().positive(), depositAddress: $evmAddress }),
1294
+ obj({ refreshHandle: $nonBlank, vm: import_zod.z.literal("SOLANA"), depositAddress: $solanaAddress })
1295
+ ]);
1296
+ var FiatAuthRecipientRequestSchema = $authRecipientRequest;
1297
+ var $authRecipientResponse = obj({
1298
+ boundAtMs: import_zod.z.number().int().nonnegative(),
1299
+ expiresAtMs: import_zod.z.number().int().nonnegative()
1300
+ });
1301
+ var FiatAuthRecipientResponseSchema = $authRecipientResponse;
1290
1302
  var $stepResponseBase = {
1291
1303
  transitions: import_zod.z.array($transition),
1292
1304
  routingSessionRef: import_zod.z.string().optional(),
@@ -1368,7 +1380,7 @@ var $stepResponse = import_zod.z.union([$providerBoundStepResponse, $funAuthStep
1368
1380
  var FiatStepResponseSchema = $stepResponse;
1369
1381
 
1370
1382
  // package.json
1371
- var version = "0.42.0";
1383
+ var version = "0.43.0";
1372
1384
 
1373
1385
  // src/table.ts
1374
1386
  var TABLE_VERSION = version;
@@ -1481,7 +1493,7 @@ var TRANSITION_TABLE = {
1481
1493
  "Not in the FE doc, so no screen number: the client renders it on its contact and OTP screens.",
1482
1494
  "Every FUN_AUTH error is category USER_ERROR with a code from FUN_AUTH_ERROR_CODES. A wrong code re-enters CODE with BAD_CODE and a lower attemptsRemaining; TOO_MANY_ATTEMPTS and CODE_EXPIRED drop the challenge and offer resend; OTP_DISPATCH_THROTTLED re-enters with resendAvailableAtMs set.",
1483
1495
  "resend carries the verificationRef the client holds, even one the server has dropped (expired, too many attempts); the server starts a fresh challenge for the same email while it still remembers the challenge (its code expiry plus a short grace); once it is forgotten the answer is IDENTIFIER with CODE_EXPIRED.",
1484
- "POST /fiat/auth/refresh and /revoke are called by the SDK session store, never offered as transitions."
1496
+ "POST /fiat/auth/refresh, /revoke and /recipient are called by the SDK session store, never offered as transitions."
1485
1497
  ]
1486
1498
  },
1487
1499
  SESSION_AUTH: {
@@ -1847,6 +1859,7 @@ var DOCUMENTED_ENDPOINTS = [
1847
1859
  "POST /fiat/auth/verify",
1848
1860
  "POST /fiat/auth/refresh",
1849
1861
  "POST /fiat/auth/revoke",
1862
+ "POST /fiat/auth/recipient",
1850
1863
  "POST /fiat/payment-session",
1851
1864
  "POST /fiat/session",
1852
1865
  "POST /fiat/session/verify",
@@ -1878,6 +1891,10 @@ var UNOFFERED_ENDPOINTS = [
1878
1891
  endpoint: "POST /fiat/auth/revoke",
1879
1892
  reason: "SDK session store, not a transition."
1880
1893
  },
1894
+ {
1895
+ endpoint: "POST /fiat/auth/recipient",
1896
+ reason: "SDK session store at beginDeposit, not a transition."
1897
+ },
1881
1898
  {
1882
1899
  endpoint: "POST /fiat/kyc/document",
1883
1900
  reason: "FILE fields use it for a direct provider/vendor upload handshake and completion report; the harness owns that auxiliary path and it is not a transition (see KYC/INPUT_REQUIRED notes)."
package/dist/index.mjs CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  tableEntry,
14
14
  unofferedEndpoints,
15
15
  unreachableStates
16
- } from "./chunk-RGQE53YP.mjs";
16
+ } from "./chunk-6O7Z7WYW.mjs";
17
17
  import {
18
18
  MOONPAY_ENDPOINTS
19
19
  } from "./chunk-TIEGTTFY.mjs";
@@ -1105,6 +1105,16 @@ var $authRefreshResponse = obj({ session: $fiatSession });
1105
1105
  var FiatAuthRefreshResponseSchema = $authRefreshResponse;
1106
1106
  var $authRevokeRequest = obj({ refreshHandle: $nonBlank });
1107
1107
  var FiatAuthRevokeRequestSchema = $authRevokeRequest;
1108
+ var $authRecipientRequest = z.discriminatedUnion("vm", [
1109
+ obj({ refreshHandle: $nonBlank, vm: z.literal("EVM"), chainId: z.number().int().positive(), depositAddress: $evmAddress }),
1110
+ obj({ refreshHandle: $nonBlank, vm: z.literal("SOLANA"), depositAddress: $solanaAddress })
1111
+ ]);
1112
+ var FiatAuthRecipientRequestSchema = $authRecipientRequest;
1113
+ var $authRecipientResponse = obj({
1114
+ boundAtMs: z.number().int().nonnegative(),
1115
+ expiresAtMs: z.number().int().nonnegative()
1116
+ });
1117
+ var FiatAuthRecipientResponseSchema = $authRecipientResponse;
1108
1118
  var $stepResponseBase = {
1109
1119
  transitions: z.array($transition),
1110
1120
  routingSessionRef: z.string().optional(),
@@ -2939,6 +2949,8 @@ export {
2939
2949
  FailureReasonSchema,
2940
2950
  FeeLineSchema,
2941
2951
  FiatAmountSchema,
2952
+ FiatAuthRecipientRequestSchema,
2953
+ FiatAuthRecipientResponseSchema,
2942
2954
  FiatAuthRefreshRequestSchema,
2943
2955
  FiatAuthRefreshResponseSchema,
2944
2956
  FiatAuthRevokeRequestSchema,
package/dist/schemas.d.ts CHANGED
@@ -28,7 +28,7 @@
28
28
  */
29
29
  import { z } from 'zod';
30
30
  import type { UsStateCode } from './codes';
31
- import type { BlockedReason, CryptoAmount, FailureReason, FeeLine, FiatAmount, FiatEndpoint, FiatProvider, FiatAuthRefreshRequest, FiatAuthRefreshResponse, FiatAuthRevokeRequest, FiatAuthStartRequest, FiatAuthVerifyRequest, FiatSession, FiatStepResponse, FieldSpec, FlowState, FormDescriptor, FormField, FormFieldType, InstructionField, Instructions, Instrument, JsonValue, KYCProvider, KycReviewDuration, OrderRef, OrderStatus, OrderSummary, PollSpec, PreparedPayment, PaymentSurface, Quote, QuoteLimitRange, QuoteLimits, Recovery, Refund, ReportSpec, SelectOption, StatusHistoryEntry, Surface, PreferredIdentityDocument, KycFieldId, ClientExecutedDelivery, KycSdkResultReport, SurfaceKind, SurfaceProvider, TermsAcceptance, Transition, TransitionInputs, TransitionParams, Tx, DestinationAsset, FiatGeo, FiatNextRequest } from './types';
31
+ import type { BlockedReason, CryptoAmount, FailureReason, FeeLine, FiatAmount, FiatEndpoint, FiatProvider, FiatAuthRecipientRequest, FiatAuthRecipientResponse, 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>;
@@ -128,5 +128,7 @@ export declare const FiatAuthVerifyRequestSchema: z.ZodType<FiatAuthVerifyReques
128
128
  export declare const FiatAuthRefreshRequestSchema: z.ZodType<FiatAuthRefreshRequest>;
129
129
  export declare const FiatAuthRefreshResponseSchema: z.ZodType<FiatAuthRefreshResponse>;
130
130
  export declare const FiatAuthRevokeRequestSchema: z.ZodType<FiatAuthRevokeRequest>;
131
+ export declare const FiatAuthRecipientRequestSchema: z.ZodType<FiatAuthRecipientRequest>;
132
+ export declare const FiatAuthRecipientResponseSchema: z.ZodType<FiatAuthRecipientResponse>;
131
133
  export declare const FiatStepResponseSchema: z.ZodType<FiatStepResponse>;
132
134
  export {};
package/dist/table.d.ts CHANGED
@@ -97,7 +97,7 @@ export declare const STATE_KEYS: StateKey[];
97
97
  * session-minting call for that rail. The `/fiat/auth/*` routes come from the Fun identity design
98
98
  * that specifies `FUN_AUTH`.
99
99
  */
100
- export declare const DOCUMENTED_ENDPOINTS: readonly ["GET /fiat/payment-methods", "POST /fiat/quote", "POST /fiat/auth", "POST /fiat/auth/verify", "POST /fiat/auth/refresh", "POST /fiat/auth/revoke", "POST /fiat/payment-session", "POST /fiat/session", "POST /fiat/session/verify", "GET /fiat/quotes/:quoteRef", "POST /fiat/kyc/form", "POST /fiat/kyc/capture", "POST /fiat/kyc/sdk-token", "POST /fiat/kyc/document", "POST /fiat/instruments", "POST /fiat/orders", "GET /fiat/orders/:id", "GET /fiat/delivery/:deliveryId", "GET /fiat/orders/:id/instructions", "POST /fiat/orders/:id/confirm-payment", "POST /fiat/orders/:id/reference", "POST /fiat/orders/:id/cancel", "POST /fiat/orders/:id/surface-result"];
100
+ export declare const DOCUMENTED_ENDPOINTS: readonly ["GET /fiat/payment-methods", "POST /fiat/quote", "POST /fiat/auth", "POST /fiat/auth/verify", "POST /fiat/auth/refresh", "POST /fiat/auth/revoke", "POST /fiat/auth/recipient", "POST /fiat/payment-session", "POST /fiat/session", "POST /fiat/session/verify", "GET /fiat/quotes/:quoteRef", "POST /fiat/kyc/form", "POST /fiat/kyc/capture", "POST /fiat/kyc/sdk-token", "POST /fiat/kyc/document", "POST /fiat/instruments", "POST /fiat/orders", "GET /fiat/orders/:id", "GET /fiat/delivery/:deliveryId", "GET /fiat/orders/:id/instructions", "POST /fiat/orders/:id/confirm-payment", "POST /fiat/orders/:id/reference", "POST /fiat/orders/:id/cancel", "POST /fiat/orders/:id/surface-result"];
101
101
  /**
102
102
  * Documented endpoints no flow state offers, and why. Declared so an endpoint nothing can reach is
103
103
  * visible instead of silent — the table test asserts the unoffered set equals exactly these.
package/dist/table.js CHANGED
@@ -37,7 +37,7 @@ __export(table_exports, {
37
37
  module.exports = __toCommonJS(table_exports);
38
38
 
39
39
  // package.json
40
- var version = "0.42.0";
40
+ var version = "0.43.0";
41
41
 
42
42
  // src/table.ts
43
43
  var TABLE_VERSION = version;
@@ -150,7 +150,7 @@ var TRANSITION_TABLE = {
150
150
  "Not in the FE doc, so no screen number: the client renders it on its contact and OTP screens.",
151
151
  "Every FUN_AUTH error is category USER_ERROR with a code from FUN_AUTH_ERROR_CODES. A wrong code re-enters CODE with BAD_CODE and a lower attemptsRemaining; TOO_MANY_ATTEMPTS and CODE_EXPIRED drop the challenge and offer resend; OTP_DISPATCH_THROTTLED re-enters with resendAvailableAtMs set.",
152
152
  "resend carries the verificationRef the client holds, even one the server has dropped (expired, too many attempts); the server starts a fresh challenge for the same email while it still remembers the challenge (its code expiry plus a short grace); once it is forgotten the answer is IDENTIFIER with CODE_EXPIRED.",
153
- "POST /fiat/auth/refresh and /revoke are called by the SDK session store, never offered as transitions."
153
+ "POST /fiat/auth/refresh, /revoke and /recipient are called by the SDK session store, never offered as transitions."
154
154
  ]
155
155
  },
156
156
  SESSION_AUTH: {
@@ -516,6 +516,7 @@ var DOCUMENTED_ENDPOINTS = [
516
516
  "POST /fiat/auth/verify",
517
517
  "POST /fiat/auth/refresh",
518
518
  "POST /fiat/auth/revoke",
519
+ "POST /fiat/auth/recipient",
519
520
  "POST /fiat/payment-session",
520
521
  "POST /fiat/session",
521
522
  "POST /fiat/session/verify",
@@ -547,6 +548,10 @@ var UNOFFERED_ENDPOINTS = [
547
548
  endpoint: "POST /fiat/auth/revoke",
548
549
  reason: "SDK session store, not a transition."
549
550
  },
551
+ {
552
+ endpoint: "POST /fiat/auth/recipient",
553
+ reason: "SDK session store at beginDeposit, not a transition."
554
+ },
550
555
  {
551
556
  endpoint: "POST /fiat/kyc/document",
552
557
  reason: "FILE fields use it for a direct provider/vendor upload handshake and completion report; the harness owns that auxiliary path and it is not a transition (see KYC/INPUT_REQUIRED notes)."
package/dist/table.mjs CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  tableEntry,
13
13
  unofferedEndpoints,
14
14
  unreachableStates
15
- } from "./chunk-RGQE53YP.mjs";
15
+ } from "./chunk-6O7Z7WYW.mjs";
16
16
  export {
17
17
  DOCUMENTED_ENDPOINTS,
18
18
  FUN_AUTH_ERROR_CODES,
package/dist/types.d.ts CHANGED
@@ -56,7 +56,7 @@ export type HttpVerb = 'GET' | 'POST';
56
56
  * cannot express "no slash", so `GET /fiat/orders/${string}` also admits sub-paths. Precision at
57
57
  * that level is the table's job (`allowedTransitions` + `endpointMatches`), not the type's.
58
58
  */
59
- export type FiatEndpoint = 'GET /fiat/payment-methods' | 'POST /fiat/quote' | 'POST /fiat/auth' | 'POST /fiat/auth/verify' | 'POST /fiat/auth/refresh' | 'POST /fiat/auth/revoke' | 'POST /fiat/payment-session' | 'POST /fiat/session' | 'POST /fiat/session/verify' | `GET /fiat/quotes/${string}` | 'POST /fiat/kyc/form' | 'POST /fiat/kyc/capture' | 'POST /fiat/kyc/sdk-token' | 'POST /fiat/kyc/document' | 'POST /fiat/instruments' | 'POST /fiat/orders' | `GET /fiat/orders/${string}` | `GET /fiat/delivery/${string}` | `GET /fiat/orders/${string}/instructions` | `POST /fiat/orders/${string}/confirm-payment` | `POST /fiat/orders/${string}/reference` | `POST /fiat/orders/${string}/cancel` | `POST /fiat/orders/${string}/surface-result`;
59
+ export type FiatEndpoint = 'GET /fiat/payment-methods' | 'POST /fiat/quote' | 'POST /fiat/auth' | 'POST /fiat/auth/verify' | 'POST /fiat/auth/refresh' | 'POST /fiat/auth/revoke' | 'POST /fiat/auth/recipient' | 'POST /fiat/payment-session' | 'POST /fiat/session' | 'POST /fiat/session/verify' | `GET /fiat/quotes/${string}` | 'POST /fiat/kyc/form' | 'POST /fiat/kyc/capture' | 'POST /fiat/kyc/sdk-token' | 'POST /fiat/kyc/document' | 'POST /fiat/instruments' | 'POST /fiat/orders' | `GET /fiat/orders/${string}` | `GET /fiat/delivery/${string}` | `GET /fiat/orders/${string}/instructions` | `POST /fiat/orders/${string}/confirm-payment` | `POST /fiat/orders/${string}/reference` | `POST /fiat/orders/${string}/cancel` | `POST /fiat/orders/${string}/surface-result`;
60
60
  /**
61
61
  * Routing metadata, not sequencing policy. Reserved values may be emitted only after their adapter
62
62
  * and conformance fixture land.
@@ -587,6 +587,45 @@ export type FiatAuthRefreshResponse = {
587
587
  export type FiatAuthRevokeRequest = {
588
588
  refreshHandle: string;
589
589
  };
590
+ /**
591
+ * Body of `POST /fiat/auth/recipient`, sent with `Authorization: Bearer <accessToken>`. Binds the
592
+ * recipient of the deposit in progress for the partner the API key names. The backend records the
593
+ * binding for this login session; the session and its handle are unchanged. `refreshHandle` is the
594
+ * write credential, not a rotation: it must belong to the same login as the Bearer. The SDK calls it
595
+ * at `beginDeposit`, once a session is held, and may bind a new address for every deposit.
596
+ *
597
+ * Split by VM, as `DestinationAsset` is. The recipient is a destination-side value, so the backend
598
+ * checks the binding against the chain the delivery lands on: the quote's `destinationAsset` when
599
+ * there is one, else the rail. Solana carries no chain id for the same reason `DestinationAsset` does
600
+ * not: the backend maps each VM to its own chain ids in one place. `depositAddress` must be a wallet
601
+ * on that chain, and the chain must be a destination registered for the partner.
602
+ *
603
+ * Address form. EVM: any case accepted; a mixed-case address must pass its EIP-55 checksum, and the
604
+ * backend stores and reports the checksummed form. Solana: base58 as given.
605
+ *
606
+ * Errors: 401 when the bearer is expired or not a Fun session, or the handle is not this login's or
607
+ * has ended. The SDK refreshes once and retries; a 401 on the refresh itself means sign in again.
608
+ * 400 with `CHAIN_NOT_SERVED` or `RECIPIENT_NOT_A_WALLET`.
609
+ */
610
+ export type FiatAuthRecipientRequest = {
611
+ refreshHandle: string;
612
+ } & ({
613
+ vm: 'EVM';
614
+ chainId: number;
615
+ depositAddress: `0x${string}`;
616
+ } | {
617
+ vm: 'SOLANA';
618
+ depositAddress: string;
619
+ });
620
+ /**
621
+ * 200 body of `POST /fiat/auth/recipient`. The session and its handle are unchanged. `expiresAtMs`
622
+ * (server clock, ms) is when the binding stops being honoured, 24 h after `boundAtMs`; the SDK binds
623
+ * again after that, or on a `NO_WALLET` or `RECIPIENT_CHAIN_MISMATCH` refusal.
624
+ */
625
+ export type FiatAuthRecipientResponse = {
626
+ boundAtMs: number;
627
+ expiresAtMs: number;
628
+ };
590
629
  /**
591
630
  * The expected length of a provider's KYC review. `BRIEF`: the client stays on its current screen,
592
631
  * polling, for up to `holdMs` (at most 600000), then shows the in-review screen. `EXTENDED`: the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fun-xyz/fiat-contract",
3
- "version": "0.42.0",
3
+ "version": "0.43.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": {